Ugly metafile image when using gradients

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
DeskCenter
Newbie
Newbie
Posts: 9
Joined: Fri Dec 21, 2012 12:00 am

Ugly metafile image when using gradients

Post by DeskCenter » Thu Feb 27, 2014 10:09 am

Hello.

We are using TeeChart Pro 2014 together with Report Builder 15.02 in Delphi 7.

Digital Metaphors told me, that they only call an internal TeeChart routine to export the chart to a metafile image and then display that image on the report.

When using gradients within the chart, the metafile image looks quite horrible.
UglyMetafileImage.png
UglyMetafileImage.png (58.14 KiB) Viewed 5734 times
We just updated from TeeChart Pro 7.06 to 2014. The metafile image generated by the old TeeChart version looked pretty ok.

Regards

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

Re: Ugly metafile image when using gradients

Post by Narcís » Fri Feb 28, 2014 11:03 am

Hello,

This is a GDI+ bug with gradients (ID562). If you sign up to Steema Software's bugzilla system, you'll be able to receive automatic updates. The GDI+ canvas was set as the default canvas in May 2013 release (see version info page) for aesthetic purposes as it offers superior rendering but GDI is faster than GDI+ so is still preferable in some scenarios.

A workaround to the problem is using the GDI canvas for the export:

Code: Select all

uses TeCanvas;

procedure TForm1.Button1Click(Sender: TObject);
begin
 Chart1.Canvas:=TTeeCanvas3D.Create;
 Image1.Picture.Graphic := Chart1.TeeCreateMetafile(True, Rect(0, 0,
Chart1.Width, Chart1.Height));
 Chart1.Canvas:=TGDIPlusCanvas.Create;
end;
Does using GDI canvas for the export works fine for you? Is it available in Report Builder?
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

DeskCenter
Newbie
Newbie
Posts: 9
Joined: Fri Dec 21, 2012 12:00 am

Re: Ugly metafile image when using gradients

Post by DeskCenter » Fri Feb 28, 2014 11:26 am

Hello,

Using GDI instead of GDI+ looks indeed a lot better in this case.
I have no idea about Report Builder, but I just sent them a mail.

Can you tell me how to check at runtime whether the gradient is active or not?

Regards

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

Re: Ugly metafile image when using gradients

Post by Narcís » Fri Feb 28, 2014 11:36 am

Hello,
DeskCenter wrote: Using GDI instead of GDI+ looks indeed a lot better in this case.
Thanks for your feedback, I'm glad to hear that.
DeskCenter wrote: I have no idea about Report Builder, but I just sent them a mail.
They should be aware of that. They brought the issue to me earlier this month. That's why I created the bugzilla ticket. I also told them about the workaround.
DeskCenter wrote: Can you tell me how to check at runtime whether the gradient is active or not?
Yes, you should use TPieSeries.Gradient.Visible property, for example:

Code: Select all

  if Series1.Gradient.Visible then
  begin
    //Use GDI canvas to export
  end
  else
  begin
    //Use GDI+ canvas to export
  end;
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

DeskCenter
Newbie
Newbie
Posts: 9
Joined: Fri Dec 21, 2012 12:00 am

Re: Ugly metafile image when using gradients

Post by DeskCenter » Fri Feb 28, 2014 12:02 pm

Hello,

Thanks for the example code, that was exactly what I was looking for.

I'll stay in touch with Report Builder to get around this bug.

Thanks for your help.
Regards.

Post Reply