cef_image_t

Container for a single image represented at different scale factors. All image representations should be the same size in density independent pixel (DIP) units. For example, if the image at scale factor 1.0 is 100x100 pixels then the image at scale factor 2.0 should be 200x200 pixels -- both images will display with a DIP size of 100x100 units. The functions of this structure can be called on any browser process thread.

version(cef && embedded_cef_bindings)
extern (C)
struct cef_image_t {
extern (System)
int function(cef_image_t* self) nothrow is_empty;
extern (System)
int function(cef_image_t* self, cef_image_t* that) nothrow is_same;
}

Members

Variables

add_bitmap
int function(cef_image_t* self, float scale_factor, int pixel_width, int pixel_height, cef_color_type_t color_type, cef_alpha_type_t alpha_type, const(void)* pixel_data, size_t pixel_data_size) nothrow add_bitmap;

Add a bitmap image representation for |scale_factor|. Only 32-bit RGBA/BGRA formats are supported. |pixel_width| and |pixel_height| are the bitmap representation size in pixel coordinates. |pixel_data| is the array of pixel data and should be |pixel_width| x |pixel_height| x 4 bytes in size. |color_type| and |alpha_type| values specify the pixel format.

add_jpeg
int function(cef_image_t* self, float scale_factor, const(void)* jpeg_data, size_t jpeg_data_size) nothrow add_jpeg;

Create a JPEG image representation for |scale_factor|. |jpeg_data| is the image data of size |jpeg_data_size|. The JPEG format does not support transparency so the alpha byte will be set to 0xFF for all pixels.

add_png
int function(cef_image_t* self, float scale_factor, const(void)* png_data, size_t png_data_size) nothrow add_png;

Add a PNG image representation for |scale_factor|. |png_data| is the image data of size |png_data_size|. Any alpha transparency in the PNG data will be maintained.

base
cef_base_ref_counted_t base;

Base structure.

get_as_bitmap
cef_binary_value_t* function(cef_image_t* self, float scale_factor, cef_color_type_t color_type, cef_alpha_type_t alpha_type, int* pixel_width, int* pixel_height) nothrow get_as_bitmap;

Returns the bitmap representation that most closely matches |scale_factor|. Only 32-bit RGBA/BGRA formats are supported. |color_type| and |alpha_type| values specify the desired output pixel format. |pixel_width| and |pixel_height| are the output representation size in pixel coordinates. Returns a cef_binary_value_t containing the pixel data on success or NULL on failure.

get_as_jpeg
cef_binary_value_t* function(cef_image_t* self, float scale_factor, int quality, int* pixel_width, int* pixel_height) nothrow get_as_jpeg;

Returns the JPEG representation that most closely matches |scale_factor|. |quality| determines the compression level with 0 == lowest and 100 == highest. The JPEG format does not support alpha transparency and the alpha channel, if any, will be discarded. |pixel_width| and |pixel_height| are the output representation size in pixel coordinates. Returns a cef_binary_value_t containing the JPEG image data on success or NULL on failure.

get_as_png
cef_binary_value_t* function(cef_image_t* self, float scale_factor, int with_transparency, int* pixel_width, int* pixel_height) nothrow get_as_png;

Returns the PNG representation that most closely matches |scale_factor|. If |with_transparency| is true (1) any alpha transparency in the image will be represented in the resulting PNG data. |pixel_width| and |pixel_height| are the output representation size in pixel coordinates. Returns a cef_binary_value_t containing the PNG image data on success or NULL on failure.

get_height
size_t function(cef_image_t* self) nothrow get_height;

Returns the image height in density independent pixel (DIP) units.

get_representation_info
int function(cef_image_t* self, float scale_factor, float* actual_scale_factor, int* pixel_width, int* pixel_height) nothrow get_representation_info;

Returns information for the representation that most closely matches |scale_factor|. |actual_scale_factor| is the actual scale factor for the representation. |pixel_width| and |pixel_height| are the representation size in pixel coordinates. Returns true (1) on success.

get_width
size_t function(cef_image_t* self) nothrow get_width;

Returns the image width in density independent pixel (DIP) units.

has_representation
int function(cef_image_t* self, float scale_factor) nothrow has_representation;

Returns true (1) if this image contains a representation for |scale_factor|.

remove_representation
int function(cef_image_t* self, float scale_factor) nothrow remove_representation;

Removes the representation for |scale_factor|. Returns true (1) on success.

Meta