Bitmap
System.Drawing.Bitmap
Namespace: System.Drawing
Assembly: System.Drawing.Managed (4.0.0.0)
Encapsulates a bitmap, which consists of the pixel data for a graphics image and its attributes.
public class Bitmap : ImagePublic Class Bitmap
Inherits ImageConstructors
Bitmap(image)
Initializes a new instance of the Bitmap class using an existing image.
Bitmap(stream)
Initializes a new instance of the Bitmap class from a stream containing image data.
Bitmap(stream, useEmbeddedColorManagement)
Initializes a new instance of the Bitmap class from the specified data
Bitmap(fileName)
Initializes a new instance of the Bitmap class from a file on disk.
Bitmap(image, size)
Initializes a new instance of the Bitmap class with the specified size.
Bitmap(image, width, height)
Initializes a new instance of the Bitmap class with the specified width and height.
Bitmap(type, resource)
Initializes a new instance of the Bitmap class from a resource in the specified assembly.
Bitmap(width, height)
Initializes a new instance of the Bitmap class with the specified size.
Bitmap(width, height, format)
Initializes a new instance of the Bitmap class with the specified width and height, using the specified pixel format.
Methods
Clone(rect, format)
Creates a copy of the section of this Bitmap defined by with a specified PixelFormat.
format
The pixel format for the new Bitmap. This must specify a value that begins with Format.
Returns: Bitmap. The new cloned bitmap.
Clone(rect, format)
Creates a copy of the section of this Bitmap defined by with a specified PixelFormat.
format
The pixel format for the new Bitmap. This must specify a value that begins with Format.
Returns: Bitmap. The new cloned bitmap.
GetPixel(x, y)
Returns the color of the specified pixel in this Bitmap.
Returns: Color. A Color structure that represents the color of the specified pixel.
LockBits(rect, flags, format)
Locks a portion of the bitmap for direct pixel manipulation.
Returns: BitmapData. A BitmapData object representing the locked region.
LockBits(rect, flags, format, bitmapData)
Locks a portion of the bitmap for direct pixel manipulation.
Returns: BitmapData. A BitmapData object representing the locked region.
The parameter flags is not used in this implementation and is present only for compatibility with the original GDI+ method signature. Locked bits are always locked for read and write access and can be manipulated directly via the Scan0 in parallel. Therefore there is no guarantee that the pixel data will remain unchanged during the lock period if other threads are accessing the bitmap.
Moreover the memory pointed by Scan0 is a copy of the original bitmap data. The bitmap is not modified until UnlockBits is called.
MakeGrayscale()
Converts the current image to grayscale in place, preserving the alpha channel.
MakeTransparent()
Makes the default transparent color, which is the pixels at the bottom left corner, transparent in the bitmap.
MakeTransparent(transparentColor)
Makes the specified color transparent in the bitmap.
SetPixel(x, y, color)
Sets the color of the specified pixel in this Bitmap.
SetResolution(xDpi, yDpi)
Sets the resolution for this Bitmap.
UnlockBits(bitmapData)
Unlocks the previously locked region of the bitmap and updateds the bitmap with any changes made to the pixel data.
Last updated
Was this helpful?