Get canvas pixel color

TeeChart FireMonkey (Windows,OSX,iOS & Android) for Embarcadero RAD Studio, Delphi and C++ Builder (XE5+)
Post Reply
Peter Carr
Newbie
Newbie
Posts: 5
Joined: Tue Nov 08, 2016 12:00 am

Get canvas pixel color

Post by Peter Carr » Fri Mar 10, 2017 12:35 am

I am trying to obtain a pixel color in the OnAfterDraw event with

Code: Select all

X := Chart1.BottomAxis.CalcPosValue(XCoord);
Y :=Chart1.LeftAxis.CalcPosValue(YCoord);
AColor:=Chart1.Canvas.Pixels[X,Y];
But this always returns claWhite even though I have applied color fill with the Series Region Tool during the plotting.

Yeray
Site Admin
Site Admin
Posts: 9622
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Get canvas pixel color

Post by Yeray » Mon Mar 13, 2017 9:30 am

Hello,

We can't map the pixels as we are drawing elements directly in the canvas.
If you activate UseBuffer to use an internal bitmap, then it should work:

Code: Select all

Chart1.Canvas.UseBuffer:=True;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply