Page 1 of 1

Ugly metafile image when using gradients

Posted: Thu Feb 27, 2014 10:09 am
by 16564481
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 5728 times
We just updated from TeeChart Pro 7.06 to 2014. The metafile image generated by the old TeeChart version looked pretty ok.

Regards

Re: Ugly metafile image when using gradients

Posted: Fri Feb 28, 2014 11:03 am
by narcis
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?

Re: Ugly metafile image when using gradients

Posted: Fri Feb 28, 2014 11:26 am
by 16564481
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

Re: Ugly metafile image when using gradients

Posted: Fri Feb 28, 2014 11:36 am
by narcis
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;

Re: Ugly metafile image when using gradients

Posted: Fri Feb 28, 2014 12:02 pm
by 16564481
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.