mixing metafiles and bitmaps

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

mixing metafiles and bitmaps

Post by David Novo » Wed Aug 17, 2005 10:58 pm

Hello,

I have a small problem. I am creating a pdf file from a bunch of teecharts (about 300 of them). Each tchart has about 20000 points on them. So what is happening, is that each metafile has 20,000 instructions from the drawPointer method. Adobe takes about 20 seconds to render each page (with about 10 plots per page). Its almost unuseable.

What I want to do is create the metafile as follows. Draw all legends, titles, text etc to the metafile so that the text comes out beautiful. Draw the plot values to a bitmap and then when all values are done, draw the bitmap to the metafile. That way I will have high resolution text, and have all the data points in bitmap.

Looking at your internal draw method, there does not seem to be an easy way to do this. the tPointSeries.DrawPointer method uses parentChart.canvas. There does not seem to be an easy place to pass in another canvas to draw the points on.

Do you guys have a suggestion of how I can easily accomplish this?

Bert
Newbie
Newbie
Posts: 17
Joined: Fri Nov 15, 2002 12:00 am
Location: Netherlands
Contact:

Post by Bert » Thu Aug 18, 2005 7:40 am

Maybe you can use these functions:

Chart.SaveToBitmapFile
Chart.SaveToMetafile

Bert

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Thu Aug 18, 2005 3:48 pm

Hi Bert,

Thank you for the response, but this is not what I need.

I can calling TeeCreateMetafile. however, that creates a separate drawing instruction for every dot on the plot in the metafile. Which leads to huge metafiles that take a while to render.

I need to be able to call TeeCreateMetafile to create the metafile as usual, but then output the points in a bitmap that is embedded in the metafile.

Any ideas on this?

David Novo
Newbie
Newbie
Posts: 71
Joined: Fri Jul 02, 2004 4:00 am
Location: Culver City
Contact:

Post by David Novo » Tue Nov 08, 2005 12:07 am

Its a bit complicated, but what ended up working was putting in a fake bitmap canvas in the onBeforeDrawSeries so that when the series were being drawn, it drew to a bitmap. Then, I made a new event (changed the TChart source) to include an onAfterDrawAllSeries, where I then drew the bitmap into the metafile canvas and then put the charts canvas back to the metafile canvas.

I had to change the tchart source a bit to add the events and make a couple of protected methods public, but it works quite well..

Post Reply