Download Now

    Reference TBitmapDataSDL

    Declared in Codebot.Platform.SDL.pas on line 43

    TBitmapDataSDL holds the pixels of a bitmap in memory. Pixels are stored as described by IBitmapData, premultiplied blue, green, red, and alpha with rows from top to bottom.
    Images are decoded by SDL_image in any format it supports. SaveToFile writes a jpeg if the file name ends with .jpg or .jpeg, a bmp if it ends with .bmp, and a png otherwise. SaveToStream always writes a png.
      TBitmapDataSDL = class(TInterfacedObject, IBitmapData)
      public
        function GetWidth: Integer;
        function GetHeight: Integer;
        function GetPixels: Pointer;
        { Resize the bitmap and clear its pixels to transparent black }
        procedure SetSize(Width, Height: Integer);
        procedure LoadFromFile(const FileName: string);
        procedure LoadFromStream(Stream: TStream);
        procedure SaveToFile(const FileName: string);
        procedure SaveToStream(Stream: TStream);
        property Width: Integer read GetWidth;
        property Height: Integer read GetHeight;
        property Pixels: Pointer read GetPixels;
      end;

    See also

    IBitmapData in Codebot.Platform.pas