BitmapContent¶
-
class
BitmapContent
: ContentItem Provides properties and methods for creating and maintaining a bitmap resource.
-
readonly int
Height
Gets or sets the height of the bitmap, in pixels.
-
readonly int
Width
Gets or sets the width of the bitmap, in pixels.
-
public void
Copy
(BitmapContent sourceBitmap, BitmapContent destinationBitmap) 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.
Parameters: - sourceBitmap (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent) – BitmapContent being copied.
- destinationBitmap (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent) – BitmapContent being overwritten.
-
public void
Copy
(BitmapContent sourceBitmap, Rectangle sourceRegion, BitmapContent destinationBitmap, Rectangle destinationRegion) 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.
Parameters: - sourceBitmap (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent) – BitmapContent being copied.
- sourceRegion (Microsoft.Xna.Framework.Rectangle) – Region of sourceBitmap.
- destinationBitmap (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent) – BitmapContent being overwritten.
- destinationRegion (Microsoft.Xna.Framework.Rectangle) – Region of bitmap to be overwritten.
-
public abstract System.Byte[]
GetPixelData
() Reads encoded bitmap content.
Returns: Array containing encoded bitmap data.
-
public abstract void
SetPixelData
(System.Byte[] sourceData) Writes encoded bitmap content.
Parameters: - sourceData (System.Byte[]) – Array containing encoded bitmap data to be set.
-
public string
ToString
() Returns a string description of the bitmap resource.
Returns: Description of the bitmap.
-
protected abstract bool
TryCopyFrom
(BitmapContent sourceBitmap, Rectangle sourceRegion, Rectangle destinationRegion) Attempts to copy a region from a specified bitmap.
Parameters: - sourceBitmap (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent) – BitmapContent being copied.
- sourceRegion (Microsoft.Xna.Framework.Rectangle) – Location of sourceBitmap.
- destinationRegion (Microsoft.Xna.Framework.Rectangle) – Region of destination bitmap to be overwritten.
Returns: true if region copy is supported; false otherwise.
-
protected abstract bool
TryCopyTo
(BitmapContent destinationBitmap, Rectangle sourceRegion, Rectangle destinationRegion) Attempts to copy a region of the specified bitmap onto another.
Parameters: - destinationBitmap (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BitmapContent) – BitmapContent being overwritten.
- sourceRegion (Microsoft.Xna.Framework.Rectangle) – Location of the source bitmap.
- destinationRegion (Microsoft.Xna.Framework.Rectangle) – Region of destination bitmap to be overwritten.
Returns: true if region copy is supported; false otherwise.
-
public abstract bool
TryGetFormat
(ref SurfaceFormat format) Parameters: - (ref) format (Microsoft.Xna.Framework.Graphics.SurfaceFormat) –
-
readonly int