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 - Bad shadow rendering with Metafile export in GDI+
Summary: Bad shadow rendering with Metafile export in GDI+
Status: IN_PROGRESS
Alias: None
Product: VCL TeeChart
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 131119
Hardware: PC Windows
: High normal
Target Milestone: ---
Assignee: Steema Issue Manager
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-02-06 11:17 EST by narcís calvet
Modified: 2014-02-07 03:00 EST (History)
1 user (show)

See Also:
Chart Series: ---
Delphi / C++ Builder RAD IDE Version:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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;