Steema Issues Database

Note: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;
otherwise you can use StackOverflow.
Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy.



Bug 562

Summary: Bad shadow rendering with Metafile export in GDI+
Product: VCL TeeChart Reporter: narcís calvet <narcis>
Component: CanvasAssignee: Steema Issue Manager <issuemanager>
Status: IN_PROGRESS ---    
Severity: normal CC: david
Priority: High    
Version: 131119   
Target Milestone: ---   
Hardware: PC   
OS: Windows   
Chart Series: --- Delphi / C++ Builder RAD IDE Version:

Description narcís calvet 2014-02-06 11:17:16 EST
Shadows are not rendered correctly when exporting to a Metafile image in GDI+ canvas. Works fine in GDI. To reproduce drop a TImage and TChart components to a form and use this code:

uses Series, TeCanvas;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TPieSeries.Create(Self)).FillSampleValues;
  //Chart1.Canvas:=TTeeCanvas3D.Create; //GDI canvas works fine
  Image1.Picture.Graphic := Chart1.TeeCreateMetafile(True, Rect(0, 0, Chart1.Width, Chart1.Height));
end;
Comment 1 david berneda 2014-02-06 12:34:41 EST
Fixed. The problem is GDI+ draws shadows are displayed using semi-transparent colors to obtain a "smooth" shadow effect.  This semi-transparent colors are converted to Metafiles as "brush patterns".

Pending to investigate how to convert our metafiles from Enhanced to Enhanced Plus.

Enhanced Plus (GDI+ only) metafiles should support both antialiasing and semi-transparent colors without patterns.
Comment 2 narcís calvet 2014-02-07 03:00:52 EST
Workaround are either using the GDI canvas for the export:

uses VCLTee.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;

Or hiding all shadows:

procedure TForm1.Button1Click(Sender: TObject); begin
  Series1.Shadow.Visible:=False;
  Series1.Marks.Shadow.Visible:=False;
  Chart1.Legend.Shadow.Visible:=False;
  Chart1.Legend.Symbol.Shadow.Visible:=False;

  Image1.Picture.Graphic := Chart1.TeeCreateMetafile(True, Rect(0, 0, Chart1.Width, Chart1.Height)); end;