Download Now

    Reference IResourceStore

    Declared in Codebot.Render.Graphics.pas on line 471

    IResourceStore is associated with a canvas, and allows for the creation and management of bitmap and font resources. Resoruces are tracked by name, and subsequent requests using the same name return an existing resource rather than loading the same resource mutliple times.
      IResourceStore = interface
      public
        { Create a text writer given a font }
        function NewTextWriter(Font: IFont): ITextWriter; overload;
        { Create a text writer given a font and a page }
        function NewTextWriter(Font: IFont; Page: TRectF; Margin: TVec2): ITextWriter; overload;
        { Create a new render bitmap, checking the store first if a render bitmap
          with a matching name already exists. }
        function NewBitmap(const Name: string; Width, Height: LongWord): IRenderBitmap;
        { Check the store if a image exists using name as a the key. If name is not
          found then nil is returned. }
        function LoadBitmap(const Name: string): IBitmap; overload;
        { Check the store if an image already exists. If not found load a new jpg,
          png, psd, tga, pic or gif image from a file or memory and associated it
          with the store using name as a key. }
        function LoadBitmap(const Name: string; FileName: string): IBitmap; overload;
        { Load the image from memory }
        function LoadBitmap(const Name: string; Memory: Pointer; Size: LongWord): IBitmap; overload;
        { Load the image from a resource of the program }
        function LoadBitmapResource(const Name, ResName: string): IBitmap;
        { Release space used by a bitmap and dispose of the underlying resources. }
        procedure DisposeBitmap(Bitmap: IBitmap);
        { Check the store if a font exists using name as a the key. If name is not
          found then nil is returned. }
        function LoadFont(const Name: string): IFont; overload;
        { Check the store if a font already exists. If not found load a new font
          from a file or memory and associated it with the store using name as a key }
        function LoadFont(const Name: string; FileName: string): IFont; overload;
        { Load the font from memory }
        function LoadFont(const Name: string; Memory: Pointer; Size: LongWord): IFont; overload;
        { Load the font from a resource of the program }
        function LoadFontResource(const Name, ResName: string): IFont;
      end;

    See also

    TRectF in Codebot.Graphics.Types.pas
    TVec2 in Codebot.Geometry.pas