ImageEn, unit iexBitmaps

TIEBitmap.VirtualBitmapProvider

TIEBitmap.VirtualBitmapProvider


Declaration

property VirtualBitmapProvider: TObject;


Description

Specifies a bitmap content provider. The assigned object will be de-allocated when TIEBitmap destruction, assigning Nil or replacing it with a new object.
Using this property it is possible to create a bitmap without allocating memory. When the image (or part of it) needs to be displayed a method will be called.
This is an alternative way to OnRenderVirtualPixel.

At this time, only classes inherited from the abstract class TIEVirtualBitmapProvider are supported.


Example 1

ImageEnView1.IEBitmap.VirtualBitmapProvider := TIESlippyMap.Create();
with TIESlippyMap(ImageEnView1.IEBitmap.VirtualBitmapProvider) do
begin
  // move to London
  Latitude := 51.503614574056016;
  Longitude := -0.12774750793460043;
  // location at bitmap center
  PointPosition := Point(ImageEnView1.IEBitmap.Width div 2, ImageEnView1.IEBitmap.Height div 2);
  // zoom
  Zoom := 14;
end;
ImageEnView1.Update();



Example 2

type TMyRenderer = class(TIEVirtualBitmapProvider)
  public
    procedure Render(Container: TIEBitmap; DestWidth: integer; DestHeight: integer; DestScanlines: PPointerArray; DestX1, DestY1, DestX2, DestY2: integer; SrcCols, SrcRows: PInteger; Transparency: integer; RenderOperation: TIERenderOperation; Opacity: double); override;
    function GetSegment(Container: TIEBitmap; Row: integer; Col: integer; Width: integer): pointer; override;
end;

procedure TMyRenderer.Render(Container: TIEBitmap; DestWidth: integer; DestHeight: integer; DestScanlines: PPointerArray; DestX1, DestY1, DestX2, DestY2: integer; SrcCols, SrcRows: PInteger; Transparency: integer; RenderOperation: TIERenderOperation; Opacity: double);
begin
  ...application specific...
end;

function TMyRenderer.GetSegment(Container: TIEBitmap; Row: integer; Col: integer; Width: integer): pointer;
begin
  ...application specific...
end;


// assign TMyRenderer to ImageEnView1.IEBitmap
ImageEnView1.IEBitmap.VirtualBitmapProvider := TMyRenderer.Create();
ImageEnView1.Update();


See Also

OnRenderVirtualPixel
TIESlippyMap