C# Класс Eto.Drawing.Bitmap

Represents an image
Наследование: Image
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание

Открытые методы

Метод Описание
Bitmap ( IHandler handler ) : System

Initializes a new instance of a Bitmap with the specified handler

This is intended to be used by platform specific code to return bitmap instances with a particular handler

Bitmap ( Image image, int width = null, int height = null, ImageInterpolation interpolation = ImageInterpolation.Default ) : System

Create a new scaled bitmap with the specified width and height

Bitmap ( Eto.Drawing.Size size, PixelFormat pixelFormat ) : System

Initializes a new instance of a Bitmap with the specified size and format

Bitmap ( Stream stream ) : System

Initializes a new instance of a Bitmap from a stream

Bitmap ( byte bytes ) : System

Initializes a new instance of a Bitmap from a bytes array

Bitmap ( int width, int height, Eto.Drawing.Graphics graphics ) : System

Creates a new bitmap optimized for drawing on the specified graphics

Bitmap ( int width, int height, PixelFormat pixelFormat ) : System

Initializes a new instance of a Bitmap with the specified size and format

Bitmap ( string fileName ) : System

Initializes a new instance of a Bitmap from a file

Clone ( Eto.Drawing.Rectangle rectangle = null ) : Bitmap

Creates a clone of the bitmap

FromResource ( string resourceName, Assembly assembly = null ) : Bitmap

Loads a bitmap from the resource in the specified or caller's assembly

FromResource ( string resourceName, Type type ) : Bitmap

Loads a bitmap from a resource in the same assembly as the specified type

GetPixel ( Point position ) : Color

Gets the color of the pixel at the specified position

Note that this method can be extremely slow to go through each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.GetPixel(Point) to get each pixel value.

GetPixel ( int x, int y ) : Color

Gets the color of the pixel at the specified coordinates.

Note that this method can be extremely slow to go through each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.GetPixel(int,int) to get each pixel value.

Lock ( ) : Eto.Drawing.BitmapData

Locks the data of the image to directly access the bytes of the image

This locks the data to read and write to directly using unsafe pointers. After reading or updating the data, you must call BitmapData.Dispose() to unlock the data before using the bitmap. e.g.: using (var bd = bitmap.Lock ()) { byte* pdata = bd.Data; // access data }

Save ( Stream stream, ImageFormat format ) : void

Saves the bitmap to a stream in the specified format

Save ( string fileName, ImageFormat format ) : void

Saves the bitmap to a file in the specified format

SetPixel ( Point position, Color color ) : void

Sets the pixel color at the specified position.

Note that this method can be extremely slow to set each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.SetPixel(Point,Color) to set each pixel value.

SetPixel ( int x, int y, Color color ) : void

Sets the color of the pixel at the specified coordinates.

Note that this method can be extremely slow to set each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.SetPixel(int,int,Color) to set each pixel value.

ToByteArray ( ImageFormat imageFormat ) : byte[]

Saves the bitmap to an image of the specified imageFormat into a byte array

This is merely a helper to save to a byte array instead of a stream.

Описание методов

Bitmap() публичный Метод

Initializes a new instance of a Bitmap with the specified handler
This is intended to be used by platform specific code to return bitmap instances with a particular handler
public Bitmap ( IHandler handler ) : System
handler IHandler Platform handler to use for this instance
Результат System

Bitmap() публичный Метод

Create a new scaled bitmap with the specified width and height
public Bitmap ( Image image, int width = null, int height = null, ImageInterpolation interpolation = ImageInterpolation.Default ) : System
image Image Image to scale
width int Width to scale the source image to
height int Height to scale the source image to
interpolation ImageInterpolation Interpolation quality
Результат System

Bitmap() публичный Метод

Initializes a new instance of a Bitmap with the specified size and format
public Bitmap ( Eto.Drawing.Size size, PixelFormat pixelFormat ) : System
size Eto.Drawing.Size Size of the bitmap to create
pixelFormat PixelFormat Format of each pixel
Результат System

Bitmap() публичный Метод

Initializes a new instance of a Bitmap from a stream
public Bitmap ( Stream stream ) : System
stream Stream Stream to load from the bitmap
Результат System

Bitmap() публичный Метод

Initializes a new instance of a Bitmap from a bytes array
public Bitmap ( byte bytes ) : System
bytes byte Array of bytes containing the image data in one of the supported types
Результат System

Bitmap() публичный Метод

Creates a new bitmap optimized for drawing on the specified graphics
public Bitmap ( int width, int height, Eto.Drawing.Graphics graphics ) : System
width int Width of the bitmap
height int Height of the bitmap
graphics Eto.Drawing.Graphics Graphics context the bitmap is intended to be drawn on
Результат System

Bitmap() публичный Метод

Initializes a new instance of a Bitmap with the specified size and format
public Bitmap ( int width, int height, PixelFormat pixelFormat ) : System
width int Width of the new bitmap
height int Height of the new bitmap
pixelFormat PixelFormat Format of each pixel
Результат System

Bitmap() публичный Метод

Initializes a new instance of a Bitmap from a file
public Bitmap ( string fileName ) : System
fileName string File to load as a bitmap
Результат System

Clone() публичный Метод

Creates a clone of the bitmap
public Clone ( Eto.Drawing.Rectangle rectangle = null ) : Bitmap
rectangle Eto.Drawing.Rectangle
Результат Bitmap

FromResource() публичный статический Метод

Loads a bitmap from the resource in the specified or caller's assembly
public static FromResource ( string resourceName, Assembly assembly = null ) : Bitmap
resourceName string Name of the resource in the caller's assembly to load
assembly System.Reflection.Assembly Assembly to load the resource from, or null to use the caller's assembly
Результат Bitmap

FromResource() публичный статический Метод

Loads a bitmap from a resource in the same assembly as the specified type
public static FromResource ( string resourceName, Type type ) : Bitmap
resourceName string Full name of the resource in the type's assembly.
type System.Type Type of the assembly to get the resource.
Результат Bitmap

GetPixel() публичный Метод

Gets the color of the pixel at the specified position
Note that this method can be extremely slow to go through each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.GetPixel(Point) to get each pixel value.
public GetPixel ( Point position ) : Color
position Point Position to get the color of the pixel.
Результат Color

GetPixel() публичный Метод

Gets the color of the pixel at the specified coordinates.
Note that this method can be extremely slow to go through each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.GetPixel(int,int) to get each pixel value.
public GetPixel ( int x, int y ) : Color
x int The x coordinate
y int The y coordinate
Результат Color

Lock() публичный Метод

Locks the data of the image to directly access the bytes of the image
This locks the data to read and write to directly using unsafe pointers. After reading or updating the data, you must call BitmapData.Dispose() to unlock the data before using the bitmap. e.g.: using (var bd = bitmap.Lock ()) { byte* pdata = bd.Data; // access data }
public Lock ( ) : Eto.Drawing.BitmapData
Результат Eto.Drawing.BitmapData

Save() публичный Метод

Saves the bitmap to a stream in the specified format
public Save ( Stream stream, ImageFormat format ) : void
stream Stream Stream to save the bitmap to
format ImageFormat Format to save as
Результат void

Save() публичный Метод

Saves the bitmap to a file in the specified format
public Save ( string fileName, ImageFormat format ) : void
fileName string File to save the bitmap to
format ImageFormat Format to save as
Результат void

SetPixel() публичный Метод

Sets the pixel color at the specified position.
Note that this method can be extremely slow to set each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.SetPixel(Point,Color) to set each pixel value.
public SetPixel ( Point position, Color color ) : void
position Point Position to set the pixel color.
color Color Color to set.
Результат void

SetPixel() публичный Метод

Sets the color of the pixel at the specified coordinates.
Note that this method can be extremely slow to set each pixel of a bitmap. If you need better performance, use Lock to get access to the bitmap's pixel buffer directly, then optionally use BitmapData.SetPixel(int,int,Color) to set each pixel value.
public SetPixel ( int x, int y, Color color ) : void
x int The x coordinate of the pixel to set.
y int The y coordinate of the pixel to set.
color Color Color to set the pixel to.
Результат void

ToByteArray() публичный Метод

Saves the bitmap to an image of the specified imageFormat into a byte array
This is merely a helper to save to a byte array instead of a stream.
public ToByteArray ( ImageFormat imageFormat ) : byte[]
imageFormat ImageFormat
Результат byte[]