Page 1 of 1

Chart1.Canvas.ShowImage what arguments

Posted: Thu Mar 26, 2009 1:39 pm
by 9244864
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

Posted: Fri Mar 27, 2009 3:11 pm
by narcis
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!

Posted: Mon Mar 30, 2009 9:25 am
by 9244864
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

Posted: Tue Apr 21, 2009 2:19 pm
by narcis
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.