class Bitmap

in global :: Sandbox

😔 No documentation found.


public void Clear( Color color )

Clears the bitmap to the specified color.

  • color The color to fill the bitmap with.

public Color GetPixel( int x, int y )

Retrieves the color of a specific pixel in the bitmap.

  • x The x-coordinate of the pixel.
  • y The y-coordinate of the pixel.
  • Returns The color of the pixel at the specified coordinates.

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

Sets the color of a specific pixel in the bitmap.

  • x The x-coordinate of the pixel.
  • y The y-coordinate of the pixel.
  • color The color to set the pixel to.

public void DrawRect( Rect rect )

Draws a rectangle using the current pen settings.

  • rect The rectangle to draw.

public void DrawRect( float x, float y, float width, float height )

Draws a rectangle using the current pen settings.

  • x The x-coordinate of the top-left corner.
  • y The y-coordinate of the top-left corner.
  • width The width of the rectangle.
  • height The height of the rectangle.

public void DrawRoundRect( Rect rect, Margin margins )

Draws a rectangle using the current pen settings.

public void DrawCircle( Vector2 center, float radius )

Draws a circle using the current pen settings.

  • center The center of the circle.
  • radius The radius of the circle.

public void DrawCircle( float x, float y, float radius )

Draws a circle using the current pen settings.

  • x The x-coordinate of the circle's center.
  • y The y-coordinate of the circle's center.
  • radius The radius of the circle.

public void DrawPolygon( Vector2[] points )

Draws a polygon using the current pen settings.

  • points The points of the polygon.

public void DrawArc( Rect rect, float startAngle, float sweepAngle )

Draws an arc using the current pen settings.

  • rect The bounding rectangle of the arc.
  • startAngle The starting angle of the arc, in degrees.
  • sweepAngle The sweep angle of the arc, in degrees.

public void DrawArc( Rect rect, float startAngle, float sweepAngle, bool useCenter )

Draws an arc using the current pen settings, with an option to connect to the center.

  • rect The bounding rectangle of the arc.
  • startAngle The starting angle of the arc, in degrees.
  • sweepAngle The sweep angle of the arc, in degrees.
  • useCenter If true, connects the arc endpoints to the center point, forming a pie shape.

public void DrawBitmap( Bitmap bitmap, Rect destRect )

Draws another bitmap onto this bitmap.

  • bitmap The bitmap to draw.
  • destRect The destination rectangle for the drawn bitmap.

public void DrawLine( Vector2 start, Vector2 end )

Draws a line using the current pen settings.

  • start The starting point of the line.
  • end The ending point of the line.

public void DrawLines( Vector2[] points )

Draws connected lines through a series of points using the current pen settings.

  • points The points to connect with lines.

public void Blur( float radius, bool tileClamp = True )

Applies a Gaussian blur effect to the current bitmap.

  • radius The radius of the blur, controlling its intensity. Must be non-negative.
  • tileClamp Determines the behavior at the edges of the bitmap: true to clamp the edges (default), or false to repeat the edges.

public void Sharpen( float amount, bool tileClamp = True )

Applies a Gaussian blur effect to the current bitmap.

public void Adjust( float brightness = 1, float contrast = 1, float saturation = 1, float hueDegrees = 0 )

Adjusts brightness, contrast, and saturation in one pass.

public void AdjustHue( float angle )

Adjusts the hue of the bitmap.

  • angle The angle to rotate the hue, in degrees (0 to 360).

public void Colorize( Color color )

Color the bitmap using this color, respect alpha

public void InsertPadding( Margin margin )

Shrink the image by adding padding all around - without resizing the bitmap

public Bitmap HeightmapToNormalMap( float strength = 1 )

Converts a heightmap to a normal map using parallel processing.

  • strength The strength of the normal map effect (default is 1.0).
  • Returns The generated normal map as an SKBitmap.

public static Bitmap CreateFromBytes( byte[] data )

Loads a bitmap from the specified byte array.

  • data The byte array containing the image data.
  • Returns A new instance.

public static bool IsIes( byte[] data )

Return true if this data is a Ies file

public static Bitmap CreateFromPsdBytes( byte[] data )

Creates a Bitmap instance from PSD file data.

  • data Byte array containing the PSD file data.
  • Returns A Bitmap instance if successful, or null if the data is not valid PSD.

public static bool IsPsd( byte[] data )

Checks if the provided byte array is a valid PSD file.

  • data Byte array to check.
  • Returns True if the data is a PSD file, otherwise false.

public static bool IsTga( byte[] data )

Return true if this data is a Tga file

public void SetAntialias( bool on )

Sets the pen for drawing with a solid color and stroke style.

public void SetBlendMode( BlendMode blendMode )

Sets the pen to use a specific blend mode.

  • blendMode The blend mode to apply.

public void SetPen( Color color, float width )

Sets the pen for drawing with a solid color and stroke style.

  • color The color of the pen.
  • width The width of the pen in pixels.

public void SetDashedPen( Color color, float width, float[] dashPattern )

Sets the pen for drawing dashed or dotted lines.

  • color The color of the pen.
  • width The width of the pen in pixels.
  • dashPattern An array defining the dash pattern (e.g., [10, 5] for 10px dash, 5px gap).

public void SetFill( Color color )

Sets the pen for drawing filled shapes with a solid color.

  • color The color to fill the shapes with.

public void SetLinearGradient( Vector2 start, Vector2 end, Gradient gradient )

Sets the pen for drawing with a linear gradient.

  • start the gradient's start point.
  • end the gradient's end point.
  • gradient The color of the gradient.

public void SetRadialGradient( Vector2 center, float radius, Gradient gradient )

Sets the pen for drawing with a radial gradient.

  • center The gradient's center.
  • radius The radius of the gradient.
  • gradient The color of the gradient.

public byte[] ToJpg( int quality = 100 )

Exports the bitmap as a JPEG byte array with the specified quality.

  • quality The quality of the JPEG, between 0 and 100.
  • Returns A byte array containing the JPEG image data.

public byte[] ToWebP( int quality = 100 )

Exports the bitmap as an HDR WebP byte array with the specified quality.

  • quality The quality of the WebP image, between 0 and 100.
  • Returns A byte array containing the WebP HDR image data.

public byte[] ToFormat( ImageFormat format )

Exports the bitmap to the specified engine format

public void DrawText( TextRendering.Scope scope, Rect rect, TextFlag flags = Center )

Draws text onto this bitmap

public Texture ToTexture( bool mips = True )

Try to create a texture from this bitmap

public Bitmap Rotate( float degrees )

Rotates the bitmap by the specified angle.

  • degrees The angle in degrees to rotate the bitmap.
  • Returns A new instance with the rotated image.

public Bitmap Resize( int newWidth, int newHeight )

Resizes the bitmap to the specified dimensions and returns a new bitmap.

  • newWidth The new width of the bitmap.
  • newHeight The new height of the bitmap.
  • Returns A new instance with the specified dimensions.

public Bitmap Crop( Rect rect )

Crops the bitmap to the specified rectangle.

  • rect The rectangle to crop to.
  • Returns A new instance with the cropped image.

public bool Equals( object obj )

😔 No documentation found.

public string ToString( )

😔 No documentation found.

public Type GetType( )

😔 No documentation found.

public Bitmap FlipHorizontal( )

😔 No documentation found.

public Bitmap FlipVertical( )

😔 No documentation found.

public byte[] ToBmp( )

😔 No documentation found.

public byte[] ToPng( )

😔 No documentation found.

public Bitmap( int width, int height, bool floatingPoint = False )

😔 No documentation found.

public int Width { get; }

😔 No documentation found.

public int Height { get; }

😔 No documentation found.

public int BytesPerPixel { get; }

😔 No documentation found.

public int ByteCount { get; }

😔 No documentation found.

public Rect Rect { get; }

😔 No documentation found.

public Vector2 Center { get; }

😔 No documentation found.

public bool IsFloatingPoint { get; set; }

😔 No documentation found.

public bool IsValid { get; }

😔 No documentation found.

public void Dispose( )

😔 No documentation found.

public static bool IsTif( ReadOnlySpan<byte> data )

😔 No documentation found.

public Color[] GetPixels( )

😔 No documentation found.

public Color32[] GetPixels32( )

😔 No documentation found.

public Bitmap Clone( )

😔 No documentation found.

public bool IsOpaque( )

😔 No documentation found.

public int GetHashCode( )

😔 No documentation found.

public void InvertColor( )

😔 No documentation found.

public static Bitmap CreateFromIesBytes( byte[] data )

😔 No documentation found.

public static Bitmap CreateFromSvgString( string svgContents, Nullable<int> width, Nullable<int> height, Nullable<Vector2> scale = null, Nullable<Vector2> offset = null, Nullable<float> rotation = null )

😔 No documentation found.

public static Bitmap CreateFromTgaBytes( byte[] data )

😔 No documentation found.

public Color.Rgba16[] GetPixels16( )

😔 No documentation found.

public static Bitmap CreateFromTifBytes( byte[] data )

😔 No documentation found.