xtd.drawing - Reference Guide  0.1.0
Modern c++17 library providing access to GDI+ basic graphics functionality. More advanced functionality is provided in the drawing 2D, imaging, and text.
xtd::drawing::image Class Reference

An abstract base class that provides functionality for the bitmap and metafile descended classes. More...

#include <image.h>

Inheritance diagram for xtd::drawing::image:
xtd::drawing::bitmap

Classes

struct  data
 

Public Member Functions

int32_t flags () const
 Gets attribute flags for the pixel data of this Image. More...
 
const std::vector< guid > & frame_dimentions_list () const
 Gets an array of GUIDs that represent the dimensions of frames within this image. More...
 
intptr_t handle () const
 Get the handle of this image. More...
 
int32_t height () const
 Gets the height, in pixels, of this image. More...
 
float horizontal_resolution () const
 Gets the horizontal resolution, in pixels per inch, of this image. More...
 
imaging::color_palette palette () const
 Gets the color palette used for this image. More...
 
void palette (const imaging::color_palette &palette)
 Sets the color palette used for this image. More...
 
const size_fphysical_dimension () const
 Gets the width and height of this image. More...
 
const imaging::pixel_format pixel_format () const
 Gets the pixel format for this image. More...
 
const std::vector< int32_t > & property_id_list () const
 Gets IDs of the property items stored in this image. More...
 
const std::vector< imaging::property_item > & property_items () const
 Gets all the property items (pieces of metadata) stored in this image. More...
 
const imaging::image_formatraw_format () const
 Gets the file format of this image. More...
 
void save (const std::string &filename) const
 
void save (const std::string &filename, const imaging::image_format &format) const
 
void save (std::ostream &stream, const imaging::image_format &format) const
 
const drawing::sizesize () const
 Gets the width and height, in pixels, of this image. More...
 
const std::any & tag () const
 Gets an object that provides additional data about the image. More...
 
void tag (const std::any &tag)
 Sets an object that provides additional data about the image. More...
 
float vertical_resolution () const
 Gets the vertical resolution, in pixels per inch, of this image. More...
 
int32_t width () const
 Gets the width, in pixels, of this image. More...
 

Static Public Member Functions

static image from_data (const char *const *bits)
 
static image from_file (const std::string &filename)
 Creates an image from the specified file. More...
 
static image from_hbitmap (intptr_t hbitmap)
 
static image from_stream (std::istream &stream)
 

Static Public Attributes

static image empty
 

Protected Member Functions

 image (intptr_t hbitmap)
 
 image (const std::string &fileName)
 
 image (std::istream &stream)
 
 image (const char *const *bits)
 
 image (int32_t width, int32_t height)
 
 image (const image &image, int32_t width, int32_t height)
 
 image (const image &image, const rectangle &rect)
 
void update_properties ()
 

Protected Attributes

std::shared_ptr< datadata_ = std::make_shared<data>()
 

Detailed Description

An abstract base class that provides functionality for the bitmap and metafile descended classes.

Remarks
To draw an image on a Windows Form, you should use one of the draw_image methods.

Member Function Documentation

§ flags()

int32_t xtd::drawing::image::flags ( ) const
inline

Gets attribute flags for the pixel data of this Image.

Returns
The integer representing a bitwise combination of image_flags for this Image.
Remarks
The integer value returned from this method will correspond to a sum of image_flags, as described in the following table.
image_flag value Integer representation
image_flags_none 0
Iimage_flags_scalable 1
Iimage_flags_has_alpha 2
Iimage_flags_has_translucent 4
Iimage_flags_partially_scalable 8
Iimage_flags_color_space_rgb 16
Iimage_flags_color_space_cmyk 32
Iimage_flags_color_space_gray 64
Iimage_flags_color_space_ycbr 128
Iimage_flags_color_space_ycck 256
Iimage_flags_has_real_dpi 4096
Iimage_flags_has_real_pixel_size 8192
Iimage_flags_read_only 65536
Iimage_flags_caching 131072
For example, if the Flags property for an image returned 77960, the image_flags for the image would be read_only, has_real_dpi, has_real_pixel_size, color_space_ycbcr, and partially_scalable.

§ frame_dimentions_list()

const std::vector<guid>& xtd::drawing::image::frame_dimentions_list ( ) const
inline

Gets an array of GUIDs that represent the dimensions of frames within this image.

Returns
An array of GUIDs that specify the dimensions of frames within this Image from most significant to least significant.
Remarks
This method returns information about multiple-frame images, which come in two styles: multiple page and multiple resolution.
A multiple-page image is an image that contains more than one image. Each page contains a single image (or frame). These pages (or images, or frames) are typically displayed in succession to produce an animated sequence, such as an animated .gif file.
A multiple-resolution image is an image that contains more than one copy of an image at different resolutions. This is commonly used by MIP mapping where the displayed image size determines the resolution of the image used for drawing. GDI+ can support an arbitrary number of pages (or images, or frames), as well as an arbitrary number of resolutions. The defined dimensions are properties of the frame_dimension.

§ from_file()

static image xtd::drawing::image::from_file ( const std::string &  filename)
inlinestatic

Creates an image from the specified file.

Parameters
filenameA string that contains the name of the file from which to create the image.
Returns
The Image this method creates.

§ handle()

intptr_t xtd::drawing::image::handle ( ) const
inline

Get the handle of this image.

Returns
The handle of this image.

§ height()

int32_t xtd::drawing::image::height ( ) const
inline

Gets the height, in pixels, of this image.

Returns
The height, in pixels, of this image.

§ horizontal_resolution()

float xtd::drawing::image::horizontal_resolution ( ) const
inline

Gets the horizontal resolution, in pixels per inch, of this image.

Returns
The horizontal resolution, in pixels per inch, of this image.

§ palette() [1/2]

imaging::color_palette xtd::drawing::image::palette ( ) const
inline

Gets the color palette used for this image.

Returns
A color_palette that represents the color palette used for this image.
Remarks
This property returns a copy of the color_palette object used by this Image.

§ palette() [2/2]

void xtd::drawing::image::palette ( const imaging::color_palette palette)
inline

Sets the color palette used for this image.

Parameters
paletteA color_palette that represents the color palette used for this image.

§ physical_dimension()

const size_f& xtd::drawing::image::physical_dimension ( ) const
inline

Gets the width and height of this image.

Returns
A SizeF structure that represents the width and height of this image.
Remarks
If the image is a bitmap, the width and height are returned in pixels. If the image is a metafile, the width and height are returned in 0.01 millimeter units.

§ pixel_format()

const imaging::pixel_format xtd::drawing::image::pixel_format ( ) const
inline

Gets the pixel format for this image.

Returns
A pixel_format that represents the pixel format for this image.

§ property_id_list()

const std::vector<int32_t>& xtd::drawing::image::property_id_list ( ) const
inline

Gets IDs of the property items stored in this image.

Returns
An array of the property IDs, one for each property item stored in this image.
Remarks
If the image has no property items or if the image format does not support property items, the property_id_list property returns an empty array (that is, an array of length zero).

§ property_items()

const std::vector<imaging::property_item>& xtd::drawing::image::property_items ( ) const
inline

Gets all the property items (pieces of metadata) stored in this image.

Returns
An array of PropertyItem objects, one for each property item stored in the image.
Remarks
IIf the image has no property items or if the image format does not support property items, property_items returns an empty array (that is, an array of length zero).

§ raw_format()

const imaging::image_format& xtd::drawing::image::raw_format ( ) const
inline

Gets the file format of this image.

Returns
The image_format that represents the file format of this image.

§ size()

const drawing::size& xtd::drawing::image::size ( ) const
inline

Gets the width and height, in pixels, of this image.

Returns
A size structure that represents the width and height, in pixels, of this image.

§ tag() [1/2]

const std::any& xtd::drawing::image::tag ( ) const
inline

Gets an object that provides additional data about the image.

Returns
The object that provides additional data about the image.

§ tag() [2/2]

void xtd::drawing::image::tag ( const std::any &  tag)
inline

Sets an object that provides additional data about the image.

Parameters
tagThe object that provides additional data about the image.

§ vertical_resolution()

float xtd::drawing::image::vertical_resolution ( ) const
inline

Gets the vertical resolution, in pixels per inch, of this image.

Returns
The vertical resolution, in pixels per inch, of this image.

§ width()

int32_t xtd::drawing::image::width ( ) const
inline

Gets the width, in pixels, of this image.

Returns
The width, in pixels, of this image.

The documentation for this class was generated from the following file: