Page 1 of 1
SerieRegion with pattern - PDF export
Posted: Mon Dec 18, 2017 1:40 pm
by 16580506
Hi,
I have some problems when i want to print (in pdf throught PDFCreator in attachement) a chart with a serie region using a pattern.
1- Pattern seems to be zoomed and streched when canvas size is changed before print. The rendering is really not acceptable
2- Contrary to old version (Delphi 9 & Teechat v8.08), filled area seems to be a picture and not vectorial. Besides, pdf file size is very larger!
I use Delphi XE10.1 and TeeChart Pro VCL FMX Source Code 2017.20.
Thanks for your help
Anthony
Re: SerieRegion with pattern - PDF export
Posted: Mon Dec 18, 2017 3:00 pm
by yeray
Hello,
This is what I'm getting with a new simple example using RAD 10.2 Tokyo, TeeChart v2017.22 and PdfCreator 2.5:
If you still find problems with it, please try to arrange a simple example project we can run as-is to reproduce the problem here.
Thanks in advance.
Re: SerieRegion with pattern - PDF export
Posted: Mon Dec 18, 2017 3:33 pm
by 16580506
I'm sorry, i forgot attachement in previous post...
Please find attached small project with serie region using pattern.
Pattern plotting is very important for me because it is representing geology.
Regards
Re: SerieRegion with pattern - PDF export
Posted: Tue Dec 19, 2017 8:49 am
by yeray
Hello,
Here it is a screenshot comparing the chart and the pdf your project generates for me with v2017.22:
- AcroRd32_2017-12-19_09-38-43.png (238.98 KiB) Viewed 25790 times
I'm trying to compare the result with TeeChart v8 but I'm getting an "29100 - Internal GhostScript Error" with GDI and I get a blank pattern in GDIPlus.
Re: SerieRegion with pattern - PDF export
Posted: Tue Dec 19, 2017 9:57 am
by 16580506
Hi,
"29100 - Internal GhostScript Error" from PDFCreator is one of some reasons i decided to update my RAD & Teechart version.
Effectivelly, I'm getting this error with certain pattern and not with other.
Please find attached, small project (D9 & Teechat v8.08) using working pattern:
- D9Pattern.png (65.14 KiB) Viewed 25786 times
As you can see, quality of pdf export is very well!
Re: SerieRegion with pattern - PDF export
Posted: Thu Dec 21, 2017 1:09 pm
by 16580506
Below same example as previous with Delphi XE10.1 & TeeChart 2017.10:
- TChartSerieRegionPattern.png (79.22 KiB) Viewed 25787 times
Pattern seems to be streched!
Any idea or workarround?
Anthony
Re: SerieRegion with pattern - PDF export
Posted: Thu Dec 28, 2017 9:34 am
by Marc
Hello Anthony,
Any image pattern is likely to be stretched for a different output width/height ratio to the original Chart. I tried with a smaller image as brush pattern and note that it tiles so that may be a workaround. An alternative would be to use hatchstyle.
Regards,
Marc Meumann
Re: SerieRegion with pattern - PDF export
Posted: Mon Feb 05, 2018 4:36 pm
by 16580506
Hi Marc!
HashStyle is not a good alternative for me, because user can choose its own geological pattern which is a bitmap.
To avoid stretch problem, i resize chart canvas to have exactly the same output width/height ratio (as you could have seen in my example). That's why I don't understand where the problem comes from! Besides, in previous TeeChart version, it works fine...
I really need to have this print feature working and so need your help.
Regards,
Anthony
Re: SerieRegion with pattern - PDF export
Posted: Wed Feb 07, 2018 9:37 am
by yeray
Hello Anthony,
I've restored the technique that was used in AssignBrush in previous versions. Could you please tell us if this test version gives you the expected result?
Re: SerieRegion with pattern - PDF export
Posted: Thu Feb 08, 2018 8:13 am
by 16580506
Hi Yeray,
This is exactly what i want!
How can I restore "the technique that was used in AssignBrush in previous versions" in my side?
Thanks a lot for your help!!!
Anthony
Re: SerieRegion with pattern - PDF export
Posted: Thu Feb 08, 2018 10:45 am
by yeray
Hello Anthony,
Since you have the sources, you can just open TeCanvas.pas, backup it, replace the TTeeCanvas.AssignBrush that matches the signature of the method below, and recompile.
Code: Select all
Procedure TTeeCanvas.AssignBrush(const ABrush:TTeeBrush; AColor,ABackColor:TColor);
procedure SetBrushBitmap(ABitmap:{$IFDEF LCL}TCustomBitmap{$ELSE}TBitmap{$ENDIF});
begin
Brush.Bitmap{$IFDEF FMX}.Bitmap{$ENDIF}:=ABitmap;
{$IFNDEF FMX}
{$IFDEF TEEWINDOWS}
SetTextColor(Handle,ColorToRGB(AColor));
{$ENDIF}
{$ENDIF}
BackMode:=cbmOpaque;
BackColor:=ABackColor;
end;
var tmp: TBitmap;
begin
FBrush.OnChange:=nil;
if Assigned(ABrush.FImage) and Assigned(ABrush.FImage.Graphic)
{$IFDEF FMX}and (not ABrush.FImage.Graphic.IsEmpty) {$ENDIF} then
begin
Brush.Style:=bsClear;
if not (ABrush.FImage.Graphic is TBitmap) then
begin
{$IFDEF FMX}
tmp:=TBitmap.Create(ABrush.FImage.Width, ABrush.FImage.Height);
tmp.Canvas.DrawBitmap(ABrush.FImage, TRectF.Create(0,0,tmp.Width,tmp.Height),
TRectF.Create(0,0,tmp.Width, tmp.Height),
1);
{$ELSE}
tmp:=TBitmap.Create;
TeeSetBitmapSize(tmp,ABrush.FImage.Width,ABrush.FImage.Height);
tmp.Canvas.Draw(0,0,ABrush.FImage.Graphic);
{$ENDIF}
ABrush.FImage.Bitmap:=tmp;
tmp.Free;
end;
SetBrushBitmap(ABrush.FImage.Bitmap);
end
else
if Assigned(ABrush.Bitmap)
{$IFDEF FMX}and Assigned(ABrush.Bitmap.Bitmap) and (not ABrush.Bitmap.Bitmap.IsEmpty){$ENDIF}
{$IFDEF CLX}and (not ABrush.Bitmap.Empty){$ENDIF}
then
begin
Brush.Style:=bsClear;
SetBrushBitmap(ABrush.Bitmap{$IFDEF FMX}.Bitmap{$ENDIF});
end
else
begin
{$IFDEF FMX}
Brush.Assign(ABrush);
{$ELSE}
Brush.Bitmap:=nil;
{$ENDIF}
if Monochrome then
AColor:=clWhite;
FBrush.BackColor:=ABackColor;
FCanvas.Brush.Assign(ABrush); // <-- redundant for GDI+ etc
end;
if Assigned(ABrush.FGradient) then
Gradient.Assign(ABrush.Gradient)
else
Gradient.Visible:=False;
FBrush.OnChange:=ChangedBrush;
DoChangedBrush(FBrush);
end;
Re: SerieRegion with pattern - PDF export
Posted: Mon Feb 12, 2018 4:28 pm
by 16580506
Hi Yeray,
Thank you a lot for your workarround, it is working very well!!!
Is it planned to fix this issue in futur release?
Again, thank you for your excellent support!
Anthony