Download Now

    Reference TSurfaceBitmap

    Declared in Codebot.Graphics.pas on line 59

    TSurfaceBitmap is a TGraphic representation of an IBitmap
      TSurfaceBitmap = class(TGraphic)
      public
        { Create an empty surface bitmap }
        constructor Create; override;
        { Set the underlying bitmap reference directly }
        procedure CopyReference(Bitmap: IBitmap);
        { Draw the image on a surface at x and y, optionally picking a frame as the
          source }
        procedure Draw(Surface: ISurface; X, Y: Integer; FrameIndex: Integer = -1); overload;
        { Draw the image on a surface stretching it from the source to dest
          rectangles }
        procedure Draw(Surface: ISurface; const Source, Dest: TRectF); overload;
        { Load a bitmap from a file }
        procedure LoadFromFile(const Filename: string); override;
        { Load a bitmap from a stream }
        procedure LoadFromStream(Stream: TStream); override;
        { Save a bitmap to a file }
        procedure SaveToFile(const Filename: string); override;
        { Save a bitmap to a stream }
        procedure SaveToStream(Stream: TStream); override;
        { Output the mime types to a TStrings }
        procedure GetSupportedSourceMimeTypes(List: TStrings); override;
        { Convert the image to a solid color }
        procedure Colorize(Color: TColorB);
        { Convert the image to grayscale when 1 }
        procedure Desaturate(Percent: Float);
        { Convert the image to white when 1 }
        procedure Lighten(Percent: Float);
        { Convert the image to black when 1 }
        procedure Darken(Percent: Float);
        { Alter a destination bitmap to width and height copy of pixels }
        procedure ResizeTo(Width, Height: Integer; Dest: TSurfaceBitmap);
        { Alter a destination bitmap to a copy of rect pixels }
        procedure ClipTo(const Rect: TRectI; Dest: TSurfaceBitmap);
        { Resample the image to width and height an optional quality }
        procedure Resample(Width, Height: Integer; Quality: TResampleQuality = rqNormal);
        { Resize the image erasing its contents and surface }
        procedure SetSize(Width, Height: Integer);
        { Access to the underlying bitmap }
        property Bitmap: IBitmap read FBitmap;
        { Access to the underlying bitmap's surface }
        property Surface: ISurface read GetSurface;
        { Boundary rect of the image }
        property ClientRect: TRectI read GetClientRect;
        { Frames provides access to sub image locations when using TSurfaceBitmap as
          an image strip }
        property Frames[Index: Integer]: TRectI read GetFrames;
        { FrameCount is the number of frames available when using TSurfaceBitmap as
          an image strip }
        property FrameCount: Integer read GetFrameCount;
        { Direct access to image pixels }
        property Pixels: PPixel read GetPixels;
        { Image format used when loading or saving }
        property Format: TImageFormat read GetFormat write SetFormat;
        { Opacity controls the transparency of the image when drawing }
        property Opacity: Byte read FOpacity write SetOpacity;
      end;

    See also

    Float in Codebot.System.pas
    IBitmap in Codebot.Graphics.Types.pas
    ISurface in Codebot.Graphics.Types.pas
    TColorB in Codebot.Graphics.Types.pas
    TImageFormat in Codebot.Graphics.Types.pas
    TRectF in Codebot.Graphics.Types.pas
    TRectI in Codebot.Graphics.Types.pas
    TResampleQuality in Codebot.Graphics.Types.pas