timo / cairo-p6

A NativeCall binding to the Cairo 2d graphics library for Perl 6
10 stars 7 forks source link

Zoom problem #15

Closed ccworld1000 closed 5 years ago

ccworld1000 commented 6 years ago

If I want to load the pictures of 512512, which methods can achieve the desired effect and want to be displayed as 256256?

Actually, I want to zoom in on the loaded pictures, but the corresponding "class Image" does not seem to want the method.

ccworld1000 commented 6 years ago

Not scaling the context.

timo commented 6 years ago

displaying an image at a different size from the actual pixel data is achieved by changing the scale of the context, then drawing the image. Check out the clip example (and just ignore the clipping) to see how to combine scaling and drawing an image: https://cairographics.org/samples/clip_image/

If you want the result to be another surface/image (sorry, i'm not quite sure about my cairo terminology) you can render onto a new image instead of the screen (or what have you) and use the result of that later

ccworld1000 commented 6 years ago

The scene I encounter now is to draw multiple pictures at the same time in a context.