xtd 0.2.0
xtd::drawing::image_converter Class Referencefinal
Inheritance diagram for xtd::drawing::image_converter:
xtd::static_object

Definition

Converts images to and from xtd::drawing::image class. This class cannot be inherited.

Converts images to and from xtd::drawing::image class. This class cannot be inherited.
Definition image_converter.hpp:28
#define drawing_export_
Define shared library export.
Definition drawing_export.hpp:13
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.hpp:37
Inheritance
xtd::static_objectxtd::drawing::image_converter
Namespace
xtd::drawing
Library
xtd.drawing

Public Static Methods

static xtd::drawing::image from_base64_string (const xtd::string &value)
 Convert specified base64 string to image.
 
static xtd::array< xtd::byteto_array (const xtd::drawing::image &value)
 Convert specified image to byte array.
 
static xtd::string to_base64_string (const xtd::drawing::image &value)
 Convert specified image to base64 string.
 
static void to_file (const xtd::drawing::image &value, const xtd::string &filename)
 Convert specified image to file.
 
static void to_file (const xtd::drawing::image &value, const xtd::string &filename, const xtd::drawing::imaging::image_format &format)
 Convert specified image to file.
 
static xtd::drawing::image to_image (const xtd::array< xtd::byte > &value)
 Convert specified byte array to image.
 
static xtd::drawing::image to_image (const xtd::read_only_span< xtd::byte > &value)
 Convert specified bytes span to image.
 
static xtd::drawing::image to_image (const xtd::string &filename)
 Convert specified file name string.
 
static xtd::drawing::image to_image (std::istream &stream)
 Convert specified stream to image.
 
static void to_stream (const xtd::drawing::image &value, std::ostream &stream, const xtd::drawing::imaging::image_format &format)
 Convert specified image to stream.
 

Member Function Documentation

◆ from_base64_string()

static xtd::drawing::image xtd::drawing::image_converter::from_base64_string ( const xtd::string value)
static

Convert specified base64 string to image.

Parameters
valueA base64 string that contains the image.
Returns
The converted image from base64 string.
Remarks
The first eight bytes contain the width followed by the height of the image. The following bytes contain the ARGB components of the image pixels.

◆ to_array()

static xtd::array< xtd::byte > xtd::drawing::image_converter::to_array ( const xtd::drawing::image value)
static

Convert specified image to byte array.

Parameters
valueThe image to convert into byte array.
Returns
A byte array that contains the image.
Remarks
The first eight bytes contain the width followed by the height of the image. The following bytes contain the ARGB components of the image pixels.

◆ to_base64_string()

static xtd::string xtd::drawing::image_converter::to_base64_string ( const xtd::drawing::image value)
static

Convert specified image to base64 string.

Parameters
valueThe image to convert into base64 string.
Returns
A base64 string that contains the image.
Remarks
The first eight bytes contain the width followed by the height of the image. The following bytes contain the ARGB components of the image pixels.

◆ to_file() [1/2]

static void xtd::drawing::image_converter::to_file ( const xtd::drawing::image value,
const xtd::string filename 
)
static

Convert specified image to file.

Parameters
valueThe image to convert into base64 string.
filenameA string that contains the name of the file to which to save this xtd::drawing::image.
Remarks
If no encoder exists for the file format of the image, the Portable Network Graphics (PNG) encoder is used. When you use the xtd::drawing::image::save method to save a graphic image as a Windows Metafile Format (WMF) or Enhanced Metafile Format (EMF) file, the resulting file is saved as a Portable Network Graphics (PNG) file. This behavior occurs because the GDI+ component of the .NET Framework does not have an encoder that you can use to save files as .wmf or .emf files.
Saving the image to the same file it was constructed from is not allowed and throws an exception.

◆ to_file() [2/2]

static void xtd::drawing::image_converter::to_file ( const xtd::drawing::image value,
const xtd::string filename,
const xtd::drawing::imaging::image_format format 
)
static

Convert specified image to file.

Parameters
valueThe image to convert into base64 string.
filenameA string that contains the name of the file to which to save this xtd::drawing::image.
formatThe xtd::drawing::imaging::image_format for this xtd::drawing::image.

◆ to_image() [1/4]

static xtd::drawing::image xtd::drawing::image_converter::to_image ( const xtd::array< xtd::byte > &  value)
static

Convert specified byte array to image.

Parameters
valueA byte array that contains the image.
Returns
The converted image from byte array.
Remarks
The first eight bytes contain the width followed by the height of the image. The following bytes contain the ARGB components of the image pixels.

◆ to_image() [2/4]

static xtd::drawing::image xtd::drawing::image_converter::to_image ( const xtd::read_only_span< xtd::byte > &  value)
static

Convert specified bytes span to image.

Parameters
valueA bytes span that contains the image.
Returns
The converted image from byte array.
Remarks
The first eight bytes contain the width followed by the height of the image. The following bytes contain the ARGB components of the image pixels.

◆ to_image() [3/4]

static xtd::drawing::image xtd::drawing::image_converter::to_image ( const xtd::string filename)
static

Convert specified file name string.

Parameters
filenameA file name string that contains the image.
Returns
The converted image from file name string.

◆ to_image() [4/4]

static xtd::drawing::image xtd::drawing::image_converter::to_image ( std::istream &  stream)
static

Convert specified stream to image.

Parameters
streamThe input stream that contains the image.
Returns
The converted image from stream.

◆ to_stream()

static void xtd::drawing::image_converter::to_stream ( const xtd::drawing::image value,
std::ostream &  stream,
const xtd::drawing::imaging::image_format format 
)
static

Convert specified image to stream.

Parameters
valueThe image to convert.
streamThe output stream where to write the image.
formatThe xtd::drawing::imaging::image_format for this xtd::drawing::image.
Remarks
You should avoid saving an image to the same stream that was used to construct it. Doing so might damage the stream.
The image must be saved to the stream at an offset of zero. If any additional data has been written to the stream before saving the image, the image data in the stream will be corrupted.

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