TMoveCanvas has a FTopLeft that everything inside the object references to and draws on the original canvas
I wanting to make a procedure smoothLineTo(
FMoved is the Pointer of last position moved to
"If (cEnd.X > cEnd.Y) then" is to separate and identify the longest side of the vector
as cEnd is the Line vector to be drawn
aColor gives me access to the colour faster
a) I need a quick way to identify the colour strength of the pixel and the pixel above it or below it may be to give the smooth line effect.
I need a faster way to paint the pixel than through the TCanvas object. Is their a way to go back to the handle or DC or something and point to the pixel in raw memory that is faster.
Code:
Type
aColor = record
case Integer of
0: (Y, B, G, R: byte);
1: (C: TColor);
end;
procedure TMoveCanvas.SmoothLineTo(X, Y: Integer);
Var
cEnd: TPoint;
I, G, R, S: Integer;
C1, C2: TColor;
Function GetColour(Colour: TColor; Strength: Word): TColor;
Var Y, B, G, R: byte;
begin
aColor(Colour).B * (Strength div 1000)
end;
begin
If (X = FMoved.X) or (Y = FMoved.Y) then
Begin
FCanvas.LineTo(X - TFTopLeft.X, Y - TFTopLeft.Y);
FMoved := Point(X, Y);
Exit;
end;
cEnd.X := X - FMoved.X;// - TFTopLeft.X;
cEnd.Y := Y - FMoved.Y;
If (cEnd.X <> cEnd.Y) then
If (cEnd.X > cEnd.Y) then
begin
G := 1000 * cEnd.X div cEnd.Y;
For I := 0 to cEnd.X do
Begin
R := I * G;
S := R and 1000;
end
end else
begin
end;
end;
Connect with Us