-
Sep 13th, 2024, 09:01 AM
#1
Thread Starter
Fanatic Member
-
Sep 13th, 2024, 10:44 AM
#2
Re: RC6: Rendering parts of one cairo surface to another
Not sure if there's a better way, but one option would be to create a rectangle path for each corner at the size you want, then call TranslateDrawings to "offset" the rendering, and finally Fill the path with a surface pattern. Something like this:
Code:
Cairo.ImageList.AddImage "button", "path to a button image file" ' Add a button image to the Cairo ImageList with the key "button"
With New_c.Cairo.CreateSurface(1000, 1000)
With .CreateContext
.Rectangle 100, 100, 16, 16 ' Create a 16x16 rectangle path at 100px from the top-left corner of the surface
.TranslateDrawings 100, 100 ' Translate the drawings so the top-left corner of the button surface appears at 100x100
.Fill , Cairo.ImageList("button").CreateSurfacePattern ' Fill the path with the button image
End With
End With
-
Sep 14th, 2024, 11:27 PM
#3
Thread Starter
Fanatic Member
Re: RC6: Rendering parts of one cairo surface to another
Thank you. It works.
It even works when I draw a rectangle that exceeds the size of the surface. I expected that this would throw an error, but it does not.
I don't understand why these 2 arguments were left out that would make RenderSurfaceContent behave like BitBlt. I miss that, and while you have shown me a solution now, I find it unexcepted that I must do it like this.
ps: I really really like the syntax of cCairoSurface and cCairoContext. It is very beautiful code! That is why I ask myself what the deal with the 2 left-out arguments is.
Last edited by tmighty2; Sep 14th, 2024 at 11:35 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|