Class BitmapContent
- Assembly
- MonoGame.Framework.Content.Pipeline.dll
Provides properties and methods for creating and maintaining a bitmap resource.
public abstract class BitmapContent : ContentItem
- Inheritance
-
BitmapContent
- Derived
- Inherited Members
Constructors
BitmapContent()
Initializes a new instance of BitmapContent.
protected BitmapContent()
BitmapContent(int, int)
Initializes a new instance of BitmapContent with the specified width or height.
protected BitmapContent(int width, int height)
Parameters
width
intWidth, in pixels, of the bitmap resource.
height
intHeight, in pixels, of the bitmap resource.
Properties
Height
Gets or sets the height of the bitmap, in pixels.
public int Height { get; protected set; }
Property Value
Width
Gets or sets the width of the bitmap, in pixels.
public int Width { get; protected set; }
Property Value
Methods
Copy(BitmapContent, BitmapContent)
Copies one bitmap into another. The destination bitmap can be in any format and size. If the destination is larger or smaller, the source bitmap is scaled accordingly.
public static void Copy(BitmapContent sourceBitmap, BitmapContent destinationBitmap)
Parameters
sourceBitmap
BitmapContentBitmapContent being copied.
destinationBitmap
BitmapContentBitmapContent being overwritten.
Copy(BitmapContent, Rectangle, BitmapContent, Rectangle)
Copies one bitmap into another. The destination bitmap can be in any format and size. If the destination is larger or smaller, the source bitmap is scaled accordingly.
public static void Copy(BitmapContent sourceBitmap, Rectangle sourceRegion, BitmapContent destinationBitmap, Rectangle destinationRegion)
Parameters
sourceBitmap
BitmapContentBitmapContent being copied.
sourceRegion
RectangleRegion of sourceBitmap.
destinationBitmap
BitmapContentBitmapContent being overwritten.
destinationRegion
RectangleRegion of bitmap to be overwritten.
GetPixelData()
Reads encoded bitmap content.
public abstract byte[] GetPixelData()
Returns
- byte[]
Array containing encoded bitmap data.
SetPixelData(byte[])
Writes encoded bitmap content.
public abstract void SetPixelData(byte[] sourceData)
Parameters
sourceData
byte[]Array containing encoded bitmap data to be set.
ToString()
Returns a string description of the bitmap resource.
public override string ToString()
Returns
- string
Description of the bitmap.
TryCopyFrom(BitmapContent, Rectangle, Rectangle)
Attempts to copy a region from a specified bitmap.
protected abstract bool TryCopyFrom(BitmapContent sourceBitmap, Rectangle sourceRegion, Rectangle destinationRegion)
Parameters
sourceBitmap
BitmapContentBitmapContent being copied.
sourceRegion
RectangleLocation of sourceBitmap.
destinationRegion
RectangleRegion of destination bitmap to be overwritten.
Returns
- bool
true if region copy is supported; false otherwise.
TryCopyTo(BitmapContent, Rectangle, Rectangle)
Attempts to copy a region of the specified bitmap onto another.
protected abstract bool TryCopyTo(BitmapContent destinationBitmap, Rectangle sourceRegion, Rectangle destinationRegion)
Parameters
destinationBitmap
BitmapContentBitmapContent being overwritten.
sourceRegion
RectangleLocation of the source bitmap.
destinationRegion
RectangleRegion of destination bitmap to be overwritten.
Returns
- bool
true if region copy is supported; false otherwise.
TryGetFormat(out SurfaceFormat)
Gets the corresponding GPU texture format for the specified bitmap type.
public abstract bool TryGetFormat(out SurfaceFormat format)
Parameters
format
SurfaceFormatFormat being retrieved.
Returns
- bool
The GPU texture format of the bitmap type.
ValidateCopyArguments(BitmapContent, Rectangle, BitmapContent, Rectangle)
Validates the arguments to the Copy function.
protected static void ValidateCopyArguments(BitmapContent sourceBitmap, Rectangle sourceRegion, BitmapContent destinationBitmap, Rectangle destinationRegion)
Parameters
sourceBitmap
BitmapContentBitmapContent being copied.
sourceRegion
RectangleLocation of sourceBitmap.
destinationBitmap
BitmapContentBitmapContent being overwritten.
destinationRegion
RectangleRegion of bitmap to be overwritten.