2#ifndef _aspose_system_drawing_bitmap_h_
3#define _aspose_system_drawing_bitmap_h_
7#include "drawing/image.h"
8#include "drawing/color.h"
9#include "drawing/rectangle.h"
10#include "drawing/rectangle_f.h"
11#include "drawing/imaging/bitmap_data.h"
12#include "drawing/imaging/pixel_format.h"
13#include "drawing/imaging/image_lock_mode.h"
14#include "drawing/size_f.h"
15#include "system/io/stream.h"
16#include "system/string.h"
20#if defined(ASPOSECPPLIB_BEING_BUILT) || defined(ASPOSECPP_SKIA_EXTERNAL_USAGE)
21#include <core/SkEncodedImageFormat.h>
22#include <core/SkBitmap.h>
23#include <core/SkCanvas.h>
27ASPOSECPP_3RD_PARTY_CLASS(SkBitmap);
29ASPOSECPP_3RD_PARTY_CLASS(SkCanvas);
31ASPOSECPP_3RD_PARTY_CLASS(SkData);
33ASPOSECPP_3RD_PARTY_CLASS(SkWStream);
35ASPOSECPP_3RD_PARTY_CLASS(SkMatrix);
37ASPOSECPP_3RD_PARTY_STRUCT(SkImageInfo);
39ASPOSECPP_3RD_PARTY_STRUCT(SkRect);
41ASPOSECPP_3RD_PARTY_TYPEDEF(SkColor, uint32_t);
43#if defined(ASPOSECPPLIB_BEING_BUILT) || !defined(ASPOSECPP_SKIA_EXTERNAL_USAGE)
45ASPOSECPP_3RD_PARTY_ENUM_CLASS(SkEncodedImageFormat);
48namespace System {
namespace Drawing {
53 ASPOSECPP_3RD_PARTY_ENUM_HOLDER(SkEncodedImageFormat,
int, SkEncodedFormatHolder);
98 MEMBER_FUNCTION_MAKE_OBJECT(
Bitmap, CODEPORTING_ARGS(
const SharedPtr<Image>& original,
int width,
int height), CODEPORTING_ARGS(original, width, height));
101 virtual ASPOSECPP_SHARED_API
int get_Width()
const override;
103 virtual ASPOSECPP_SHARED_API
int get_Height()
const override;
177 virtual ASPOSECPP_SHARED_API
const SkBitmap*
GetSkBitmap()
const override;
210 void PutRawBytesBmp(SkWStream *to);
222 bool m_is_multi_image =
false;
225 bool m_pixel_processing_mode =
false;
228 static const SkColor s_bw_colors[];
230 static const SkColor s_indexed_colors[];
232 static const SkColor s_gray_colors[];
259 virtual ASPOSECPP_SHARED_API sk_sp<SkData>
GetRawBytes(SkEncodedImageFormat encoder_type,
int quality)
override;
273 virtual void Draw(SkCanvas* sk_canvas,
const SkRect& dest_rect,
const SkRect& src_rect, SkMatrix* matrix, SkFilterQuality quality, SkBlendMode blend_mode)
const override;
281 virtual void Draw(SkCanvas* sk_canvas,
const SkRect& dest_rect, SkMatrix* matrix, SkFilterQuality quality, SkBlendMode blend_mode)
const override;
290 virtual void Draw(SkCanvas* sk_canvas,
ArrayPtr<PointF> dest_points,
const SkRect& src_rect, SkMatrix* matrix, SkFilterQuality quality, SkBlendMode blend_mode)
const override;
299 virtual void Draw(SkCanvas* sk_canvas,
const System::Details::ArrayView<PointF>& dest_points,
const SkRect& src_rect, SkMatrix* matrix, SkFilterQuality quality, SkBlendMode blend_mode)
const override;
Represents a GDI+ bitmap image. Objects of this class should only be allocated using System::MakeObje...
Definition: bitmap.h:64
~Bitmap() override
Destructor.
virtual SharedPtr< Image > Clone() override
Creates a copy of the current object.
Bitmap(const SharedPtr< Bitmap > &original, Rectangle rect, Imaging::PixelFormat format)
Constructs a Bitmap object that represents a copy of a region of the bitmap image represented by the ...
Bitmap(const String &filename)
Constructs a new Bitmap object from the specified file.
Bitmap(const SharedPtr< System::IO::Stream > &stream, bool useIcm=false)
Constructs a new Bitmap object from the specified stream.
bool GetSkBitmapFromArray(const ArrayPtr< uint8_t > &data)
Assigns the bitmap image data from the specified byte array to the specfied SkBitmap object.
virtual Imaging::ImageFormatPtr get_RawFormat() const override
Returns the file format of the image represented by the current object.
void MakeTransparent(Color transparent_color=Color::get_LightGray())
Changes the color of all pixels with the specified color to transparent.
virtual void Draw(SkCanvas *sk_canvas, const SkRect &dest_rect, const SkRect &src_rect, SkMatrix *matrix, SkFilterQuality quality, SkBlendMode blend_mode) const override
Draws the specified region of the image represented by the current object to the specified region on ...
Detail::SkEncodedFormatHolder m_sk_encoded_format
The format of the image represented by the current object.
Definition: bitmap.h:304
std::unique_ptr< SkBitmap > m_sk_bitmap
The underlying object that contains the binary image represented by the current object.
Definition: bitmap.h:302
virtual const SkEncodedImageFormat GetSkEncodedFormat() const override
Returns a value that specifies the format of the image represented by the current object.
virtual bool IsMultiImage() const override
Returns whether the original format is a multi-image.
virtual Imaging::ColorPalettePtr get_Palette() const override
Returns the color palette used by the image represented by the current object.
virtual Imaging::PixelFormat get_PixelFormat() const override
Returns the pixel format of the image represented by the current object.
void UnlockBits(const Imaging::BitmapDataPtr &bitmap_data)
Unlocks the specified bitmap from system memory.
void set_Palette(Imaging::ColorPalettePtr value) override
Sets the color palette used by the image represented by the current object.
Bitmap(const SharedPtr< Image > &original, int width, int height)
Constructs a new Bitmap object from the specified existing image with width and height scaled to the ...
ArrayPtr< uint8_t > ComputeHash()
Computes the SHA1 hash value.
Bitmap(const SharedPtr< Image > &original, const Size &size)
Constructs a new Bitmap object from the specified existing image, scaled to the specified size.
virtual void Draw(SkCanvas *sk_canvas, ArrayPtr< PointF > dest_points, const SkRect &src_rect, SkMatrix *matrix, SkFilterQuality quality, SkBlendMode blend_mode) const override
Draws the specified region of the image represented by the current object to the specified region on ...
Bitmap(const String &filename, bool useIcm)
Constructs a new Bitmap object from the specified file.
void SetResolution(float xDpi, float yDpi)
Sets the resolution of the image.
virtual std::unique_ptr< SkCanvas > GetDrawingCanvas() const override
Returns the drawing canvas object.
Imaging::BitmapDataPtr LockBits(const Rectangle &rect, Imaging::ImageLockMode flags, Imaging::PixelFormat format, const Imaging::BitmapDataPtr &bitmap_data)
Locks a Bitmap into system memory.
SharedPtr< Bitmap > Clone(Rectangle rect, Imaging::PixelFormat format)
Creates a Bitmap object that represents a copy of a region of the bitmap image represented by the cur...
virtual void Draw(SkCanvas *sk_canvas, const System::Details::ArrayView< PointF > &dest_points, const SkRect &src_rect, SkMatrix *matrix, SkFilterQuality quality, SkBlendMode blend_mode) const override
Draws the specified region of the image represented by the current object to the specified region on ...
SharedPtr< Bitmap > Clone(RectangleF rect, Imaging::PixelFormat format)
Creates a Bitmap object that represents a copy of a region of the bitmap image represented by the cur...
IntPtr GetHbitmap()
Creates a GDI bitmap object from the bitmap represented by the current object.
virtual void Draw(SkCanvas *sk_canvas, const SkRect &dest_rect, SkMatrix *matrix, SkFilterQuality quality, SkBlendMode blend_mode) const override
Draws the the image represented by the current object to the specified region on the specified canvas...
virtual int get_Width() const override
Returns the width of the image in pixels.
Imaging::BitmapDataPtr LockBits(const Rectangle &rect, Imaging::ImageLockMode flags, Imaging::PixelFormat format)
Locks a Bitmap into system memory.
Bitmap(int width, int height, Imaging::PixelFormat format=Imaging::PixelFormat::Format32bppArgb)
Constructs a new Bitmap object that represents a bitmap image with the specified width,...
void SetPixel(int x, int y, Color color)
Sets the color of the specified pixel in the bitmap image represented by the current object.
virtual int get_Height() const override
Returns the height of the image in pixels.
bool EndPixelProcessing(bool update_colors=true)
Disables pixel processing mode.
bool BeginPixelProcessing(bool update_colors=true)
Enables pixel processing mode.
Color GetPixel(int x, int y)
Returns the color of the specified pixel.
virtual void RotateFlip(RotateFlipType rotate_flip_type) override
Rotates image to multiple of 90 degrees and flips.
virtual sk_sp< SkData > GetRawBytes(SkEncodedImageFormat encoder_type, int quality) override
Saves an image represented by the current object in the specified format using the specified image qu...
virtual Imaging::PixelFormat GetOriginalFormat() const override
Returns the original image format of the bitmap image represented by the current object.
Definition: bitmap.h:263
static SharedPtr< Bitmap > ConvertToARGBImage(const SharedPtr< Bitmap > &src_bmp)
Creates a copy of the specified bitmap image with pixel format changed to Format32bppArgb.
void PremultipleColors()
Premultiplies the colors of the pixels of the image represented by the current object.
Bitmap(const SharedPtr< Image > &original)
Constructs a new Bitmap object from the specified existing image.
virtual const SkBitmap * GetSkBitmap() const override
Returns a raw pointer to the underlying SkBitmap object.
Represents a color. This type should be allocated on stack and passed to functions by value or by ref...
Definition: color.h:24
static Color get_LightGray()
Returns a color whose ARGB value in hexadecimal notation is #FFD3D3D3.
Represents a drawing surface. Objects of this class should only be allocated using System::MakeObject...
Definition: graphics.h:68
A base class for System::Drawing::Bitmap and System::Drawing::Metafile classes providing basic functi...
Definition: image.h:72
Represents a rectangular area of an image defined as single-precision floating point X and Y coordina...
Definition: rectangle_f.h:15
Represents a rectangular area of an image defined as integer X and Y coordinates of its upper left co...
Definition: rectangle.h:19
Represents a pair of integer values that represent width and height of an image. This type should be ...
Definition: size.h:14
Pointer class to wrap types being allocated on heap. Use it to manage memory for classes inheriting O...
Definition: smart_ptr.h:180
String class used across the library. Is a substitute for C# System.String when translating code....
Definition: string.h:122
PixelFormat
Specifies the color data format of a pixel.
Definition: pixel_format.h:17
@ Format32bppArgb
Specifies that the pixel format is 32 bits per pixel with 8 bits for each of red, green,...
@ Undefined
Specifies that the pixel format is undefined.
ImageLockMode
Specifies properties of the region of an image being locked.
Definition: image_lock_mode.h:9
RotateFlipType
Specifies the type of rotation and/or flipping operation.
Definition: rotate_flip_type.h:7
Definition: db_command.h:9