Up \Display

{@abstract(TPainterLight and TPainter classes)

author: Nikolai Shokhirev )

created: June 6, 2002)

last modified: November 2, 2002)

ŠNikolai V. Shokhirev, 2002-2003 }


unit uPainter;

interface

uses
  classes, extctrls, uMatTypes, controls, Graphics, Windows;

type

  TPainterLight = class(TPaintBox)
  public
    constructor Create(aOwner: TComponent; aParent: TWinControl);  reintroduce;
    destructor Destroy; override;
    procedure SetRanges(aXmin, aXmax, aYmin, aYmax, aXYRatio: TFloat);
    procedure SetPPU;
    procedure Clear;
    function rRect2iRect(x1, x2, y1, y2: TFloat): TRect;
    function rx2ix(x: TFloat): TInt;
    function ry2iy(y: TFloat): TInt;
    function ix2rx(ix: TInt): TFloat;
    function iy2ry(iy: TInt): TFloat;
    procedure MoveTo(x, y: TFloat);
    procedure LineTo(x, y: TFloat);
    procedure Line(x1, y1, x2, y2: TFloat);
    procedure Circle(x, y, r: TFloat);
    property Xmin: TFloat read GetXmin write SetXmin;
    property Xmax: TFloat read GetXmax write SetXmax;
    property Ymin: TFloat read GetYmin write SetYmin;
    property Ymax: TFloat read GetYmax write SetYmax;
    property PPUX: TFloat read GetPPUX;
    property PPUY: TFloat read GetPPUY;
    property XYRatio: TFloat read GetXYRatio write SetXYRatio;
    property BgColor: TColor read GetBgColor write SetBgColor;
    property PenColor: TColor read GetPenColor write SetPenColor;
    property PenWidth: integer read GetPenWidth write SetPenWidth;
    property BrushColor: TColor read GetBrushColor write SetBrushColor;
  end;

  TPainter = class(TPainterLight)
  public
    constructor Create(aOwner: TComponent; aParent: TWinControl); 
    procedure SetRanges(aXmin, aXmax, aYmin, aYmax, aXYRatio: TFloat);
    procedure LineC(x1, y1, x2, y2: TFloat; c: TColor);
    procedure CircleC(x, y, r: TFloat; c: TColor);
    function Angle(x, y: TFloat): TFloat;
    function RelAngle(x2, y2, x1, y1: TFloat): TFloat;
    function HitLine(x1, y1, x2, y2: TFloat; ix, iy: TInt): boolean;
    function HitDot(rx, ry: TFloat; ix, iy: TInt): boolean;
    property Delta: TFloat read GetDelta write SetDelta;
    property XOrigin: TFloat read GetXOrigin write SetXOrigin;
    property YOrigin: TFloat read GetYOrigin write SetYOrigin;
    property InitialAngle: TFloat read GetInitialAngle write SetInitialAngle;
    property CurrentAngle: TFloat read GetCurrentAngle write SetCurrentAngle;
    property MouseIsDown: boolean read GetMouseIsDown write SetMouseIsDown;
  end;

implementation

end.

Up \Display