SerieRegion with pattern - PDF export

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

SerieRegion with pattern - PDF export

Post by athely » Mon Dec 18, 2017 1:40 pm

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SerieRegion with pattern - PDF export

Post by Yeray » Mon Dec 18, 2017 3:00 pm

Hello,

This is what I'm getting with a new simple example using RAD 10.2 Tokyo, TeeChart v2017.22 and PdfCreator 2.5:
Chart1.zip
(14.39 KiB) Downloaded 1210 times
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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

Re: SerieRegion with pattern - PDF export

Post by athely » Mon Dec 18, 2017 3:33 pm

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
Attachments
TestTChartSerieRegionPattern - XE10.1.zip
(118.54 KiB) Downloaded 1102 times

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SerieRegion with pattern - PDF export

Post by Yeray » Tue Dec 19, 2017 8:49 am

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
AcroRd32_2017-12-19_09-38-43.png (238.98 KiB) Viewed 25785 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.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

Re: SerieRegion with pattern - PDF export

Post by athely » Tue Dec 19, 2017 9:57 am

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
D9Pattern.png (65.14 KiB) Viewed 25781 times

As you can see, quality of pdf export is very well!
Attachments
TestTChartSerieRegionPattern - D9.zip
(51.03 KiB) Downloaded 1186 times

athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

Re: SerieRegion with pattern - PDF export

Post by athely » Thu Dec 21, 2017 1:09 pm

Below same example as previous with Delphi XE10.1 & TeeChart 2017.10:
TChartSerieRegionPattern.png
TChartSerieRegionPattern.png (79.22 KiB) Viewed 25782 times
Pattern seems to be streched!
Any idea or workarround?

Anthony

Marc
Site Admin
Site Admin
Posts: 1272
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: SerieRegion with pattern - PDF export

Post by Marc » Thu Dec 28, 2017 9:34 am

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
Steema Support

athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

Re: SerieRegion with pattern - PDF export

Post by athely » Mon Feb 05, 2018 4:36 pm

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SerieRegion with pattern - PDF export

Post by Yeray » Wed Feb 07, 2018 9:37 am

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?
TestTChartSerieRegionPattern.zip
(862.64 KiB) Downloaded 1201 times
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

Re: SerieRegion with pattern - PDF export

Post by athely » Thu Feb 08, 2018 8:13 am

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

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: SerieRegion with pattern - PDF export

Post by Yeray » Thu Feb 08, 2018 10:45 am

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;
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

athely
Newbie
Newbie
Posts: 10
Joined: Mon Mar 13, 2017 12:00 am

Re: SerieRegion with pattern - PDF export

Post by athely » Mon Feb 12, 2018 4:28 pm

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

Post Reply