Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - GetCanvasDC, Delphi, PatternBrush
  FAQ FAQ  Forum Search   Register Register  Login Login

GetCanvasDC, Delphi, PatternBrush

 Post Reply Post Reply
Author
Message
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Topic: GetCanvasDC, Delphi, PatternBrush
    Posted: 28 Jan 10 at 2:15PM

Hallo,

I am re-writing a delphi function which originally draws textured rectangles with a patternbrush to a printer canvas. I have changed the printer.canvas.handle to the QP.GetCanvasDC. Nearly everything works fine, with the exception of the textures. The PDF shows only the borderlines.

The same bitmaps (1 bit or 4 color grayscale, it doesn't matter) can be drawn with QP.Drawimage w/o problems. They will also be drawn on a PaintBox.Canvas with the same GDI commands.

Has anybody an idea, how to solve this problem?

Detlev

Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 28 Jan 10 at 2:46PM
Hi Detlev
 
At the momment, Quickpdf can't handle pattern-brushes. Perhaps you can use some plain grayed or colored brushes ?
 
Back to Top
Detlev View Drop Down
Beginner
Beginner
Avatar

Joined: 28 Jan 10
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote Detlev Quote  Post ReplyReply Direct Link To This Post Posted: 28 Jan 10 at 7:44PM

Hi Delbeke,

I use colored brushes too. I write a simple mapping application, therefore filling polygons with some kind of pattern is mandatory. Is it possible to use QP functions to "floodfill" rectangles with the selected image? Or do you know any library for filling closed areas with vector based pattern basically by tiling and clipping, like in Adobe Illustrator? (elementary pattern described by a kind of scripting language)

Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 29 Jan 10 at 12:49AM
Hi Detlev, can you contact me directly at  jean-luc(at)delbeke(point)fr
Back to Top
fellafoo View Drop Down
Team Player
Team Player


Joined: 21 May 22
Location: Simsbury, CT
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote fellafoo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 22 at 4:06PM
Hello,

I've been looking at this and I am stumped as well. I can use Windows.CreatePatternBrush or Windows.CreateHatchBrush and draw the fill onto a metafile canvas then use ImportEMFFromStream  to get the pattern fill onto the page, but that's a long way around.

Has anyone come up with a more-direct method?

Thank You,

MFM
Back to Top
fellafoo View Drop Down
Team Player
Team Player


Joined: 21 May 22
Location: Simsbury, CT
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote fellafoo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 22 at 9:01PM
This is what I've come up with so far. It seems to work.

function PDF_CreateSetTilingPattern(var PDFLib: TDebenuPDFLibrary; ImgFile: String; Page: Integer): Boolean;
{ Create and set a bitmap tiling pattern for filled boundaries. }
var
  ImageID, CaptureID: Integer;
  PatternName: WideString;

begin
  Result := False;

  { Add temporary page and select it. }
  PDFLib.NewPage;
  PDFLib.SelectPage(PDFLib.PageCount);

  { Load bitmap for tile pattern. }
  ImageID := PDFLib.AddImageFromFile(ImgFile, 0);

  { Set page dimensions in inches (bitmap pixels divided by dpi). }
  PDFLib.SetPageDimensions(PDFLib.ImageWidth / PrintPDF.Dpi.X, PDFLib.ImageHeight / PrintPDF.Dpi.X);

  { Select image and draw it to fill page. }
  PDFLib.SelectImage(ImageID);
  PDFLib.DrawImage(0, 0, PDFLib.PageWidth , PDFLib.PageHeight);
  //PDFLib.DrawRotatedImage(0, 0, PDFLib.PageWidth , PDFLib.PageHeight, 270)

  { Reset selected page }
  PDFLib.SelectPage(Page);

  { Capture last page and set pattern name. }
  CaptureID := PDFLib.CapturePage(PDFLib.PageCount);
  //CaptureID := PDFLib.CapturePageEx(PDFLib.PageCount, 0);
  PatternName := IntToStr(CaptureID) + '_' + ExtractFileName(ImgFile);

  PDFLib.NewTilingPatternFromCapturedPage(PatternName, CaptureID);

  PDFLib.DeletePages(PDFLib.PageCount, 1);

  Result := (PDFLib.SetFillTilingPattern(PatternName) = 1);
  //PDFLib.SetTilingPatternMatrix()
end; { PDF_CreateSetTilingPattern }
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store