xtd 0.2.0
Loading...
Searching...
No Matches
image.h
1#pragma once
3#if !defined(__XTD_DRAWING_NATIVE_LIBRARY__)
4#error "Do not include this file: Internal use only"
5#endif
7
8#include <istream>
9#include <map>
10#include <tuple>
11#include <vector>
12#include <xtd/static.h>
13#include <xtd/types.h>
14#include <xtd/string.h>
15#include <xtd/drawing_native_export.h>
16
18namespace xtd {
20 namespace drawing {
22 class bitmap;
23 class image;
25
28 namespace native {
36 class drawing_native_export_ image final static_ {
39 protected:
263 int32 id = 0;
265 int32 len = 0;
280 std::vector<xtd::byte> value;
281 };
282
284
291 static void blur(intptr handle, int32 radius);
292
302 static void color_palette(intptr image, std::vector<std::tuple<xtd::byte, xtd::byte, xtd::byte, xtd::byte>>& entries, int32& flags);
303
312 static intptr create(const xtd::string& filename, std::map<size_t, size_t>& frame_resolutions);
322 static intptr create(const xtd::string& filename, bool use_icm, std::map<size_t, size_t>& frame_resolutions);
331 static intptr create(std::istream& stream, std::map<size_t, size_t>& frame_resolutions);
341 static intptr create(std::istream& stream, bool use_icm, std::map<size_t, size_t>& frame_resolutions);
347 static intptr create(const char* const* bits);
353 static intptr create(int32 width, int32 height);
359 static intptr create(int32 width, int32 height, float horizontal_resolution, float vertical_resolution);
366 static intptr create(int32 width, int32 height, int32 format);
375 static intptr create(int32 width, int32 height, int32 stride, int32 format, intptr scan0);
376
380 static void destroy(intptr image);
381
386 static size_t flags(intptr image);
387
393
399
405
411
421
427
433
449 static void lock_bits(intptr image, int32 left, int32 top, int32 width, int32 height, int32 flags, int32 format, int32& image_data_height, int32& image_data_pixel_format, int32& image_data_reserved, intptr& image_data_scan0, int32& image_data_stride, int32& image_data_width);
450
457 static void make_transparent(intptr image, xtd::byte transparent_color_a, xtd::byte transparent_color_r, xtd::byte transparent_color_g, xtd::byte transparent_color_b);
458
464 static void physical_dimension(intptr image, int32& width, int32& height);
465
470 static std::vector<int32> property_id_list(intptr image);
471
476 static std::vector<property_item> property_items(intptr image);
477
482 static size_t pixel_format(intptr image);
483
488 static size_t raw_format(intptr image);
489
495 static void rescale(intptr image, int32 width, int32 height);
496
502
507 static void set_resolution(intptr image, int32 x_dpi, int32 y_dpi);
508
513 static void save(intptr image, const xtd::string& filename);
519 static void save(intptr image, const xtd::string& filename, size_t raw_format);
525 static void save(intptr image, std::ostream& stream, size_t raw_format);
526
530 static float screen_dpi();
531
537 static void size(intptr image, int32& width, int32& height);
538
547 static void unlock_bits(intptr image, int32& image_data_height, int32& image_data_pixel_format, int32& image_data_reserved, intptr& image_data_scan0, int32& image_data_stride, int32& image_data_width);
548
555 };
556 }
557 }
558}
Represents text as a sequence of character units.
Definition basic_string.h:79
Encapsulates a GDI+ bitmap, which consists of the pixel data for a graphics image and its attributes....
Definition bitmap.h:26
An abstract base class that provides functionality for the bitmap and metafile descended classes.
Definition image.h:49
Contains icon native API.
Definition icon.h:34
Contains image native API.
Definition image.h:36
static xtd::byte * get_data(intptr image)
Get the access to the data from this image.
static void color_palette(intptr image, std::vector< std::tuple< xtd::byte, xtd::byte, xtd::byte, xtd::byte > > &entries, int32 &flags)
Gets the color palette used for the image.
static intptr get_hbitmap(intptr image, xtd::byte a, xtd::byte r, xtd::byte g, xtd::byte b)
Creates a GDI bitmap object from this image.
static void save(intptr image, std::ostream &stream, size_t raw_format)
Saves image to the specified stream and raw format.
static void set_resolution(intptr image, int32 x_dpi, int32 y_dpi)
Sets the resolution for this bitmap.
static void make_transparent(intptr image, xtd::byte transparent_color_a, xtd::byte transparent_color_r, xtd::byte transparent_color_g, xtd::byte transparent_color_b)
Makes the specified color transparent for this bitmap.
static intptr get_hbitmap(intptr image)
Creates a GDI bitmap object from this image.
static intptr create(std::istream &stream, bool use_icm, std::map< size_t, size_t > &frame_resolutions)
Creates an image from specified std::istream and get the frame_solution collection.
static intptr create(std::istream &stream, std::map< size_t, size_t > &frame_resolutions)
Creates an image from specified std::istream and get the frame_solution collection.
static intptr get_hicon(intptr image)
Returns the handle to an icon.
static void lock_bits(intptr image, int32 left, int32 top, int32 width, int32 height, int32 flags, int32 format, int32 &image_data_height, int32 &image_data_pixel_format, int32 &image_data_reserved, intptr &image_data_scan0, int32 &image_data_stride, int32 &image_data_width)
Locks a xtd::drawing::bitmap into system memory.
static intptr create(int32 width, int32 height)
Creates an empty image from size.
static void physical_dimension(intptr image, int32 &width, int32 &height)
Gets the width and height of this image.
static float screen_dpi()
Get the screen dpi.
static std::vector< property_item > property_items(intptr image)
Gets all the property items (pieces of metadata) stored in the image.
static intptr create(int32 width, int32 height, int32 stride, int32 format, intptr scan0)
Creates an empty image from size, pixel format and pixel datas.
static intptr create(int32 width, int32 height, float horizontal_resolution, float vertical_resolution)
Creates an empty image from size, and horzontal and vertical resolution.
static intptr create(const char *const *bits)
Creates an image from bits.
static void unlock_bits(intptr image, int32 &image_data_height, int32 &image_data_pixel_format, int32 &image_data_reserved, intptr &image_data_scan0, int32 &image_data_stride, int32 &image_data_width)
Unlocks this Bitmap from system memory.
static intptr create(int32 width, int32 height, int32 format)
Creates an empty image from size, and pixel format.
static size_t raw_format(intptr image)
Gets the file format of the image.
static size_t pixel_format(intptr image)
Gets the pixel format for the image.
static void size(intptr image, int32 &width, int32 &height)
Gets the width and height, in pixels, of the image.
static xtd::byte * get_alpha(intptr image)
Get the access to the alpah from this image.
static intptr from_hicon(intptr icon)
Creates a bitmap from a Windows handle to an icon.
static float vertical_resolution(intptr image)
Gets the vertical resolution, in pixels per inch, of the image.
static void rescale(intptr image, int32 width, int32 height)
Rescale the image.
static void destroy(intptr image)
Destroys the image.
static void blur(intptr handle, int32 radius)
Blurs the image whith the specified radius.
static intptr create(const xtd::string &filename, std::map< size_t, size_t > &frame_resolutions)
Creates an image from specified filename and get the frame_solution collection.
static float horizontal_resolution(intptr image)
Gets the horizontal resolution, in pixels per inch, of the image.
static void rotate_flip(intptr image, int32 rotate_flip_type)
Rotates, flips, or rotates and flips the image.
static intptr create(const xtd::string &filename, bool use_icm, std::map< size_t, size_t > &frame_resolutions)
Creates an image from specified filename and get the frame_solution collection.
static void save(intptr image, const xtd::string &filename)
Saves image to the specified output filename.
static std::vector< int32 > property_id_list(intptr image)
Gets IDs of the property items stored in the image.
static size_t flags(intptr image)
Gets attribute flags for the pixel data of this Image.
static void save(intptr image, const xtd::string &filename, size_t raw_format)
Saves image to the specified output filename and raw format.
#define static_
This keyword is use to represent a static object. A static object can't be instantiated (constructors...
Definition static.h:37
int32_t int32
Represents a 32-bit signed integer.
Definition int32.h:23
intmax_t intptr
Represent a pointer or a handle.
Definition intptr.h:23
uint8_t byte
Represents a 8-bit unsigned integer.
Definition byte.h:23
std::type_info type
Stores information about a type.
Definition type.h:23
rotate_flip_type
Specifies how much an image is rotated and the axis used to flip the image.
Definition rotate_flip_type.h:19
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition xtd_about_box.h:10
Contains xtd::static_object class.
Contains xtd::string alias.
Encapsulates a metadata property to be included in an image file.
Definition image.h:41
std::vector< xtd::byte > value
the value of the property item.
Definition image.h:280
Contains xtd fundamental types.