Package com.iizigo.image
Class ImageHelper
java.lang.Object
com.iizigo.image.ImageHelper
Class to create a tooltip for images in the Assets directory.
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- static void- addImageTooltipBottomPart- (PropCnr prop, Composite composite, AssetReference ref, IFile file, String id, Rectangle rect, SingleImageControl ic) Adds the bottom part to the tooltip composite.- static SingleImageControl- addImageTooltipImagePart- (Composite composite, AssetReference ref, IFile file, Rectangle rect) Creates the default image part for the tooltip, added to the top composite.- static void- addImageTooltipPreviews- (Composite composite, ArrayList<AssetReference> refs, ArrayList<Position> offsets, int cx, int cy, SingleImageControl ic) Creates a preview of the part images with a separator line below.- static Composite- createImageTooltip- (PropCnr prop, Composite parent, AssetReference ref, Image typeImage, String type, String id) Creates a composite for the specified file name.- static Composite- createImageTooltip- (PropCnr prop, Composite parent, AssetReference ref, Image typeImage, String type, String id, Rectangle rect) Creates a composite for the specified file name.- static CompositeCreates a composite for the specified file name.- static Composite- createImageTooltipTopPart- (Composite parent, Image typeImage, String type, String id) Creates the top part of the image composite for tooltips.- static voidFlags changes when asset changed or asset file reference input changed.- static String- getSize- (LastVerified last) Gets the size string.- static String- getSizeString- (IFile file) Helper to get the size of a file.- static String- getTypeString- (PropCnr stateCnr) Gets the type string.- static intGets the mask value for types defined.- static boolean- isImageExtension- (FilePropCnr fpc, boolean includeSVG) Checks if it's an image resource, i.e.- static boolean- isImageExtension- (String ext, boolean includeSVG) Checks if it's an image file, i.e.- static boolean- isImageExtension- (IResource resource, boolean includeSVG) Checks if it's an image resource, i.e.- static Image- loadImage- (IFile file, StringBuilder error) Loads an image from a file.- static boolean- verify- (PropCnr pc, PropVerification verification) Verifies an image against a size.
- Constructor Details- ImageHelperpublic ImageHelper()
 
- Method Details- isImageExtensionChecks if it's an image file, i.e. that the file extension is "gif", "png", "jpg", or "jpeg".- Parameters:
- ext- The file extension without the "dot", can be null for none.
- includeSVG- Include "svg" as potential file extensions.
- Returns:
- If it's potentially an image or not.
 
- isImageExtensionChecks if it's an image resource, i.e. that the file extension is "gif", "png", "jpg" or "jpeg".- Parameters:
- resource- The resource, or null for none.
- includeSVG- Include "svg" as potential file extensions.
- Returns:
- If it's potentially an image or not.
 
- isImageExtensionChecks if it's an image resource, i.e. it's a file in Assets and that the file extension is "gif", "png", "jpg" or "jpeg".- Parameters:
- fpc- The file property.
- includeSVG- Include "svg" as potential file extensions.
- Returns:
- If it's potentially an image or not.
 
- loadImageLoads an image from a file.- Parameters:
- file- The file.
- error- Buffer where possible error message is stored when image can't be loaded, null for none.
- Returns:
- The image or null if it couldn't be loaded.
 
- createImageTooltippublic static Composite createImageTooltip- (Composite parent, IFile file, Image typeImage, String type, String id) Creates a composite for the specified file name.- Parameters:
- parent- The parent composite.
- file- The file.
- Returns:
- The composite to use for tooltips, null if not possible. The composite uses a GridLayout with two columns in case additional information should be added, such as property errors or other properties.
 
- createImageTooltippublic static Composite createImageTooltip- (PropCnr prop, Composite parent, AssetReference ref, Image typeImage, String type, String id) Creates a composite for the specified file name.- Parameters:
- parent- The parent composite.
- Returns:
- The composite to use for tooltips, null if not possible. The composite uses a GridLayout with two columns in case additional information should be added, such as property errors or other properties.
 
- createImageTooltippublic static Composite createImageTooltip- (PropCnr prop, Composite parent, AssetReference ref, Image typeImage, String type, String id, Rectangle rect) Creates a composite for the specified file name.- Parameters:
- parent- The parent composite.
- Returns:
- The composite to use for tooltips, null if not possible. The composite uses a GridLayout with two columns in case additional information should be added, such as property errors or other properties.
 
- createImageTooltipTopPartpublic static Composite createImageTooltipTopPart- (Composite parent, Image typeImage, String type, String id) Creates the top part of the image composite for tooltips.
- addImageTooltipImagePartpublic static SingleImageControl addImageTooltipImagePart- (Composite composite, AssetReference ref, IFile file, Rectangle rect) Creates the default image part for the tooltip, added to the top composite.
- addImageTooltipBottomPartpublic static void addImageTooltipBottomPart- (PropCnr prop, Composite composite, AssetReference ref, IFile file, String id, Rectangle rect, SingleImageControl ic) Adds the bottom part to the tooltip composite.
- addImageTooltipPreviewspublic static void addImageTooltipPreviews- (Composite composite, ArrayList<AssetReference> refs, ArrayList<Position> offsets, int cx, int cy, SingleImageControl ic) Creates a preview of the part images with a separator line below. If- offsetsis null, offsets are not used.
- getSizeStringHelper to get the size of a file.
- verifyVerifies an image against a size.- Parameters:
- pc- Property container to verify that also must implement ILastVerified
- verification- Verification instance.
 
- flagVerificationFlags changes when asset changed or asset file reference input changed.
- getTypeValueGets the mask value for types defined. Several values can be combined with '+'.
- getTypeStringGets the type string.
- getSizeGets the size string.