Chart1.Canvas.ShowImage what arguments

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Andy
Newbie
Newbie
Posts: 32
Joined: Wed Apr 18, 2007 12:00 am
Location: Germany Oldenburg
Contact:

Chart1.Canvas.ShowImage what arguments

Post by Andy » Thu Mar 26, 2009 1:39 pm

Hello !

I want to make a copy of the current chart bitmap.
Following help text I found:

TCanvas3D.ShowImage
procedure ShowImage(DestCanvas, DefaultCanvas: TCanvas; Const UserRect: TRect); virtual; abstract;

Makes copy of Canvas to other location.

procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
{Rect Right and Bottom overriden for Chart Width and Height. Copied Chart placed at Left 5,Top 5}
Chart1.Canvas.ShowImage(TCanvas(Form1.Canvas),TCanvas(Chart1.Canvas),Rect(5,5,0,0));

My Questions:

1. It is not clear what is the default canvas - image if chart has no image, yet?

2. How code in C++ TCanvas(Chart1->Canvas)
This code does not work (in C++) because Chart1->Canvas
is a TCanvas3D and not a TCanvas

Bye Andreas

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Mar 27, 2009 3:11 pm

Hi Andreas,

In that case the easiest solution would be using TChart.TeeCreateBitmap method which doesn't take any argument and returns a TBitmap.

Hope this helps!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Andy
Newbie
Newbie
Posts: 32
Joined: Wed Apr 18, 2007 12:00 am
Location: Germany Oldenburg
Contact:

Post by Andy » Mon Mar 30, 2009 9:25 am

Hello Narcís!

I know this function, but this is not what I want.
TeeCreateBitmap make a full (vector) redraw in a new bitmap.
So it is very slow - about 2 seconds for my complex graphic.
(and that for every mouse move event for my special task)

I want to access it current bitmap directy. If found this very fast code.

ChartImage is a TImage on a form;
PChart->Canvas->ShowImage(ChartImage->Picture->Bitmap->Canvas,
PChart->Canvas->ReferenceCanvas, TRect(0,0, PChart->Width, PChart->Height));

The main problem with TChart is that the usul property of TWinControl PChart->DoubleBuffered=true; does not work.
PChart->BufferedDisplay=true; does not work, too - or what is its meaning.

Is this a bug ?


Best regards
Andreas

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Apr 21, 2009 2:19 pm

Hi Andreas,

Sorry for the delayed reply. Only BufferedDisplay is used in TeeChart. Code where it is used internally is this:

Code: Select all

Procedure TTeeCanvas3D.SetUseBuffer(Value:Boolean);
begin
  if FBufferedDisplay<>Value then
  begin
    FBufferedDisplay:=Value;

    if (not FBufferedDisplay) and Assigned(FBitmap) then
    begin
      if not IKeepBitmap then
      begin
        DeleteBitmap;
        FDirty:=True;
      end;
    end
    else
    if FBufferedDisplay and Assigned(FBitmap) then
       SetCanvas(FBitmap.Canvas);
  end;
end;
DoubleBuffered is not used.

Which is the difference you think it should be with or without using BufferedDisplay?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply