SkiaImage
Category | refcounted |
Type | hime_skia_image_t |
Inherits | Object |
Container for the same image at different densities, similar to NSImage.
Image height and width are in DIP (Density Indepent Pixel) coordinates. SkiaImage should be used whenever possible instead of Bitmap.
NOTE: This class should not be used to store multiple logical sizes of an image (e.g., small, medium and large versions of an icon); use an ImageFamily for that. An SkiaImage represents an image of a single logical size, with potentially many different densities for high-DPI displays.
Constructors
hime_skia_image_t hime_skia_image_create_empty()
Create an empty image.
Return
hime_skia_image_t
hime_skia_image_t hime_skia_image_create_from_bitmap(bitmap, scale)
Create an image from the passed in bitmap
, which is designed for display
at the device scale factor given in scale
.
The DIP width and height will be based on that scale factor.
Parameters
hime_bitmap_t
bitmapfloat
scale
Return
hime_skia_image_t
Class methods
hime_skia_image_t hime_skia_image_create_from_file_path(path)
Create a SkiaImage by reading from the file located at path
.
This function will try to decode the image with supported formats, and NULL will returned if decoding fails.
Parameters
hime_file_path_t
path
Return
hime_skia_image_t
Methods
bool hime_skia_image_is_empty(self)
Return true if the image stores no representations.
Parameters
Return
bool
hime_size_t hime_skia_image_get_size(self)
Get size of image in DIP coordinate system.
Parameters
Return
hime_size_t
void hime_skia_image_add_bitmap_representation(self, bitmap, scale)
Add the bitmap
to the image reps contained by this object.
Parameters
hime_skia_image_t
selfhime_bitmap_t
bitmapfloat
scale
Return
void
void hime_skia_image_remove_representation(self, scale)
Remove the image rep of |scale| if present.
Parameters
hime_skia_image_t
selffloat
scale
Return
void
bool hime_skia_image_has_representation(self, scale)
Return true if the object owns an image rep whose density matches scale
exactly.
Parameters
hime_skia_image_const_t
selffloat
scale
Return
bool