On Sat, 24 Aug 2013, Willy Raets wrote: > On Sat, 2013-08-24 at 03:19 +0200, Willy Raets wrote: > > Hi All, > > > > Been struggling with inserting an existing .png file onto a > > CairoPdfSurface (gb.cairo). > > > > Done some extensive reading in the documentation but do not seem to find > > a method get the job done. Is this not possible or am I misunderstanding > > the documentation? > > > > Piece of the code of the project: > > > > Public Sub MakePdf() > > > > Dim hPdfProjectFile As CairoPdfSurface > > Dim sPdfPath, sPicPath As String > > Dim iX, iY As Float > > sPicPath = User.Home & "/MyFolder/mypicture.png" > > sPdfPath = User.Home & "/MyFolder/project.pdf" > > hPdfProjectFile = New CairoPdfSurface(sPdfPath, 210, 297) > > Cairo.Begin(hPdfProjectFile) > > '--Draw title -- > > iY = 250 > > '-- Some code to determine X co??rdinate iX -- > > ... > > ... > > Cairo.Font.Bold = True > > Cairo.Font.Size = 18 > > Cairo.MoveTo(iX, iY) > > Cairo.DrawText(Start.ProjectLoadedTitle) > > Cairo.Font.Bold = False > > ' > > '--Draw project logo -- > > iY = 285 > > ... '<== stuck right here!! > > ' > > '--Draw Document Version-- > > iY = 500 > > ... > > ... > > Cairo.End > > > > End > > > > Anyone any ideas, suggestions, links? > > > > Just to clarify, I need the .png in sPicPath = User.Home & > "/MyFolder/mypicture.png" do be drawn underneath the Title at > section '--Draw project logo -- >
Maybe you could (ab)use Cairo.ImagePattern()? Load the image, call that method and assign the result to Cairo.Source. Cairo.Paint() then does the job. I don't know Cairo but this seems like how it's done here[0]. It works in my test case. Regards, Tobi [0] http://zetcode.com/gfx/cairo/cairoimages/ ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user