Bitmap

Bitmap class

Represents a GDI+ bitmap image. Objects of this class should only be allocated using System::MakeObject() function. Never create instance of this type on stack or using operator new, as it will result in runtime errors and/or assertion faults. Always wrap this class into System::SmartPtr pointer and use this pointer to pass it to functions as argument.

class Bitmap : public System::Drawing::Image

Methods

MethodDescription
bool BeginPixelProcessing(bool)Enables pixel processing mode.
Bitmap(const SharedPtr<Image>&)Constructs a new Bitmap object from the specified existing image.
Bitmap(const SharedPtr<System::IO::Stream>&, bool)Constructs a new Bitmap object from the specified stream.
Bitmap(const String&)Constructs a new Bitmap object from the specified file.
Bitmap(const String&, bool)Constructs a new Bitmap object from the specified file.
Bitmap(int, int, Imaging::PixelFormat)Constructs a new Bitmap object that represents a bitmap image with the specified width, height, pixel format and pixel data.
Bitmap(const SharedPtr<Image>&, const Size&)Constructs a new Bitmap object from the specified existing image, scaled to the specified size.
Bitmap(const SharedPtr<Image>&, int, int)Constructs a new Bitmap object from the specified existing image with width and height scaled to the specified values.
SharedPtr<Image> Clone() overrideCreates a copy of the current object.
SharedPtr<Bitmap> Clone(Rectangle, Imaging::PixelFormat)Creates a Bitmap object that represents a copy of a region of the bitmap image represented by the current object.
SharedPtr<Bitmap> Clone(RectangleF, Imaging::PixelFormat)Creates a Bitmap object that represents a copy of a region of the bitmap image represented by the current object.
ArrayPtr<uint8_t> ComputeHash()Computes the SHA1 hash value.
static SharedPtr<Bitmap> ConvertToARGBImage(const SharedPtr<Bitmap>&)Creates a copy of the specified bitmap image with pixel format changed to Format32bppArgb.
void Dispose() overrideReleases all resources aquired by the current object.
bool EndPixelProcessing(bool)Disables pixel processing mode.
virtual bool Equals(ptr)Compares objects using C# Object.Equals semantics.
static std::enable_if<IsSmartPtr<T1>::value&&IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares reference type objects in C# style.
static std::enable_if<!IsSmartPtr<T1>::value&&!IsSmartPtr<T2>::value, bool>::type Equals(T1 const&, T2 const&)Compares value type objects in C# style.
static bool Equals(float const&, float const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
static bool Equals(double const&, double const&)Emulates C#-style floating point comparison where two NaNs are considered equal even though according to IEC 60559:1989 NaN is not equal to any value, including NaN.
virtual bool FastCast(const Details::FastRttiBase&, void **) constFor internal purposes only.
static SharedPtr<Image> FromFile(const String&, bool)Creates an Image object from the specified file.
static SharedPtr<Bitmap> FromHbitmap(IntPtr)Constructs a Bitmap object from the specified GDI bitmap.
static SharedPtr<Image> FromStream(const SharedPtr<System::IO::Stream>&, bool, bool)Creates an Image object from the specified stream.
virtual int32_t get_Flags() constReturns a bit-wise combination of ImageFlags enum values that represents the attributes of the image.
ArrayPtr<Guid> get_FrameDimensionsList() constReturns an array of GUIDs that represent the dimensions of frames within the image represented by the current object.
int get_Height() const overrideReturns the height of the image in pixels.
float get_HorizontalResolution() constReturns the horizontal resolution of the image represented by the current object in pixels per inch.
Imaging::ColorPalettePtr get_Palette() const overrideReturns the color palette used by the image represented by the current object.
Imaging::PixelFormat get_PixelFormat() const overrideReturns the pixel format of the image represented by the current object.
virtual ArrayPtr<int> get_PropertyIdList() constGets IDs of the property items stored in this image.
virtual ArrayPtr<SharedPtr<Imaging::PropertyItem>> get_PropertyItems() constGets all the property items(pieces of metadata) stored in this image.
Imaging::ImageFormatPtr get_RawFormat() const overrideReturns the file format of the image represented by the current object.
Size get_Size() constReturns a Size object that represents the width and height of the image in pixels.
virtual System::SharedPtr<System::Object> get_Tag() constGets an object that provides additional data about the image.
float get_VerticalResolution() constReturns the vertical resolution of the image represented by the current object in pixels per inch.
int get_Width() const overrideReturns the width of the image in pixels.
RectangleF GetBounds(GraphicsUnit&)Returns the image bounds in the specified measurement units.
Detail::SmartPtrCounter * GetCounter()Gets reference counter data structure associated with the object.
int GetFrameCount(const Imaging::FrameDimensionPtr&)Returns the number of frames of the specified frame dimension.
virtual int32_t GetHashCode() constAnalog of C# Object.GetHashCode() method. Enables hashing of custom objects.
IntPtr GetHbitmap()Creates a GDI bitmap object from the bitmap represented by the current object.
Color GetPixel(int, int)Returns the color of the specified pixel.
static int GetPixelFormatSize(Imaging::PixelFormat)Returns the number of bits used to represent the color depth in the specified pixel format.
const SkBitmap * GetSkBitmap() const overrideReturns a raw pointer to the underlying SkBitmap object.
SharedPtr<Image> GetThumbnailImage(int, int, Image::GetThumbnailImageAbort, IntPtr)Gets a thumbnail for this System::Drawing::Image object.
virtual const TypeInfo& GetType() constGets actual type of object. Analog of C# System.Object.GetType() call.
virtual bool Is(const TypeInfo&) constCheck if object represents an instance of type described by targetType. Analog of C# ‘is’ operator.
static bool IsAlphaPixelFormat(Imaging::PixelFormat)Determines if the specified pixel format contains alpha information.
bool IsMultiImage() const overrideReturns whether the original format is a multi-image.
void Lock()Implements C# lock() statement locking. Call directly or use LockContext sentry object.
Imaging::BitmapDataPtr LockBits(const Rectangle&, Imaging::ImageLockMode, Imaging::PixelFormat)Locks a Bitmap into system memory.
Imaging::BitmapDataPtr LockBits(const Rectangle&, Imaging::ImageLockMode, Imaging::PixelFormat, const Imaging::BitmapDataPtr&)Locks a Bitmap into system memory.
void MakeTransparent(Color)Changes the color of all pixels with the specified color to transparent.
virtual ptr MemberwiseClone() constAnalog of C# Object.MemberwiseClone() method. Enables cloning custom types.
Object()Creates object. Initializes all internal data structures.
Object(Object const&)Copy constructor. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
Object& operator=(Object const&)Assignment operator. Doesn’t copy anything, really, just initializes new object and enables copy constructing subclasses.
void PremultipleColors()Premultiplies the colors of the pixels of the image represented by the current object.
static bool ReferenceEquals(ptr const&, ptr const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, T const&)Compares objects by reference.
static std::enable_if<!IsSmartPtr<T>::value, bool>::type ReferenceEquals(T const&, std::nullptr_t)Reference-compares value type object with nullptr.
bool ReferenceEquals(String const&, std::nullptr_t)Specialization of Object::ReferenceEquals for case of string and nullptr.
bool ReferenceEquals(String const&, String const&)Specialization of Object::ReferenceEquals for case of strings.
int RemovedSharedRefs(int)Decreases shared reference count by specified value.
void RotateFlip(RotateFlipType) overrideRotates image to multiple of 90 degrees and flips.
void Save(const String&)Saves the image represented by the current object to the specified file in PNG format.
void Save(const String&, const Imaging::ImageFormatPtr&)Saves the image represented by the current object to the specified file in the specified format.
void Save(const SharedPtr<System::IO::Stream>&, const Imaging::ImageFormatPtr&)Saves the image represented by the current object to the specified stream in the specified format.
void Save(const String&, const Imaging::ImageCodecInfoPtr&, const Imaging::EncoderParametersPtr&)Saves the image represented by the current object to the specified file using the specified encoder and encoder parameters.
void Save(const SharedPtr<System::IO::Stream>&, const Imaging::ImageCodecInfoPtr&, const Imaging::EncoderParametersPtr&)Saves the image represented by the current object to the specified stream using the specified encoder and encoder parameters.
void SaveAdd(const Imaging::EncoderParametersPtr&)Adds a frame to the file or stream specified in a previous call to the Save() method.
void SaveAdd(const SharedPtr<Image>&, const Imaging::EncoderParametersPtr&)Adds a frame to the file or stream specified in a previous call to the Save() method.
int SelectActiveFrame(const Imaging::FrameDimensionPtr&, int)Selects the specified frame.
void set_Palette(Imaging::ColorPalettePtr) overrideSets the color palette used by the image represented by the current object.
virtual void set_Tag(const System::SharedPtr<System::Object>)Sets an object that provides additional data about the image.
void SetPixel(int, int, Color)Sets the color of the specified pixel in the bitmap image represented by the current object.
void SetResolution(float, float)Sets the resolution of the image.
virtual void SetTemplateWeakPtr(uint32_t)Set n’th template argument a weak pointer (rather than shared). Allows switching pointers in containers to weak mode.
int SharedCount() constGets current value of shared reference counter.
Object * SharedRefAdded()Increments shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
int SharedRefRemovedSafe()Decrements and returns shared reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
virtual String ToString() constAnalog of C# Object.ToString() method. Enables converting custom objects to string.
static const TypeInfo& Type()Implements C# typeof(System.Object) construct.
void Unlock()Implements C# lock() statement unlocking. Call directly or use LockContext sentry object.
void UnlockBits(const Imaging::BitmapDataPtr&)Unlocks the specified bitmap from system memory.
Detail::SmartPtrCounter * WeakRefAdded()Increments weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
void WeakRefRemoved()Decrements weak reference count. Shouldn’t be called directly; instead, use smart pointers or ThisProtector.
virtual ~Object()Destroys object. Frees all internal data structures.

See Also