Unit 'MUIClass.DrawPanel' Package
[Overview][Types][Classes][Variables][Index] [#MUIClass]

TDrawBuffer

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A off screeen DrawBuffer for flicker free drawing.

Declaration

Source position: MUIClass.DrawPanel.pas line 40

type TDrawBuffer = class

public

  constructor Create();

  

Create a new DrawBuffer

  destructor Destroy; override;

  

Destroy the DrawBuffer and free all Bitmap, Layers and RastPorts

  procedure Clear();

  procedure Line();

  procedure DrawRect();

  procedure Draw3DBox();

  procedure DrawCircle();

  procedure DrawEllipse();

  procedure FillRect();

  procedure DrawText();

  procedure DrawImage();

  procedure DrawToRastPort();

  procedure StretchDrawToRastPort();

  procedure Resize();

  property RP: PRastPort; [r]

  

The Buffer Rastport to draw

  property Width: Integer; [r]

  

Width of the created Buffer

  property Height: Integer; [r]

  

Height of the created Buffer

  property APen: Integer; [rw]

  property BPen: Integer; [rw]

  property DrawMode: Integer; [rw]

  property PenPos: TPoint; [rw]

end;

Inheritance

TDrawBuffer

  

A off screeen DrawBuffer for flicker free drawing.

|

TObject

Description

It will create a Bitmap and a Layer with the given size. and provide the RasPort to draw into.

Example:

procedure TMyWindow.DrawObjectEvent(Sender: ObjectPRastPort; DrawRect: TRect); // Paint Event
begin
  if not Assigned(DB) then // Create a Image Buffer to paint on (create in the first Draw Event, to have the friend Bitmap)
  begin
    DB := TDrawBuffer.Create(256, 256, RP^.Bitmap^.Depth, RP^.Bitmap);
    SetAPen(DB.RP, 2);  // fill it with white color
    RectFill(DB.RP, 0, 0, 256, 256);
  end;
  ClipBlit(DB.Rp, 0, 0, RP, DrawRect.Left, DrawRect.Top, DB.Width, DB.Height, $00C0); // Just draw the picture
end;

// Somewhere else (for example in Mouse move or button press)
GFXMove(DB.RP, x1, y1); // draw a line (x1, y1, x2, y2)
Draw(DB.RP, x2, y2);
DrawPanel.RedrawObject; // let the Panel redraw

See also

DrawPanel.OnDrawObject

  


Documentation generated on: 2024-12-21