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
widthintWidth, in pixels, of the bitmap resource.
heightintHeight, 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
sourceBitmapBitmapContentBitmapContent being copied.
destinationBitmapBitmapContentBitmapContent 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
sourceBitmapBitmapContentBitmapContent being copied.
sourceRegionRectangleRegion of sourceBitmap.
destinationBitmapBitmapContentBitmapContent being overwritten.
destinationRegionRectangleRegion 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
sourceDatabyte[]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
sourceBitmapBitmapContentBitmapContent being copied.
sourceRegionRectangleLocation of sourceBitmap.
destinationRegionRectangleRegion 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
destinationBitmapBitmapContentBitmapContent being overwritten.
sourceRegionRectangleLocation of the source bitmap.
destinationRegionRectangleRegion 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
formatSurfaceFormatFormat 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
sourceBitmapBitmapContentBitmapContent being copied.
sourceRegionRectangleLocation of sourceBitmap.
destinationBitmapBitmapContentBitmapContent being overwritten.
destinationRegionRectangleRegion of bitmap to be overwritten.