Page 1 of 1

color of CANVAS.PIXELS[X,Y]

Posted: 09 Oct 2015, 14:19
by PERE-LAPERNE
Alexander ,

I try to find the color of the pixel when i use the mouse down on the sgPaintBox ( property sgPaintBox: TsgDrawingNavigator read FsgPaintBox); ( Exemple Viewer )
The sgPaintBox is load with an AUTOCAD File

I Use this code :

procedure TFormViewPlan.imgFrameMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
var vPt: TFPoint;
vUnits : String;
acolor : Tcolor ;
Begin
vPt := sgPaintBox.GetDrawingCoords(X, Y, vUnits);
aColor := sgPaintBox.Canvas.Pixels
[Round(Vpt.X),Round(sgPaintBox.Picture.Height-Vpt.Y)] ;
end;

The color is Black
Where is my problem ?

Thank you

Jacques

Re: color of CANVAS.PIXELS[X,Y]

Posted: 09 Oct 2015, 17:27
by support
Hello Jacques,

The TsgDrawingNavigator.GetDrawingCoords function returns drawing coordinates in CAD units (TFPoint), not the pixel coordinates.


Mikhail

Re: color of CANVAS.PIXELS[X,Y]

Posted: 09 Oct 2015, 20:07
by PERE-LAPERNE
Thank you Mikhail ,

Ok ,
How can i found the color of the pixel when i use the mouse down on a TsgDrawingNavigator ?

thank you

Jacques