-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't scale images #3
Comments
Image scaling is not supported at this time. If it were what API would you propose? |
Well, with the current API design where everything returns void, I guess I would just expect the Scale() function to up-scale whatever's on the canvas at the time. Going forward, I think that returning some sort of context structure back to the user would make things like this easier -- e.g., Image() and makeimage() would return a context back to the caller, then the caller can call Scale(), Rotate(), etc. on those "objects". |
Here's an idea -- instead of directly adding support for scaling images, what about giving users a canvas-like object (opaque pointer) that they can then scale, rotate, translate, etc. and then place within other canvases? I think this is how other 2D toolkits like MagickWand and GD do it. In fact, even without scaling, the ability to compose canvases within canvases would be very useful on its own. |
You can scale images in OpenVG, OpenVG just uses different matrices to store the transformation of paths and images. For example that code would do it and then reset the matrix you're currently modifying to the one applied to paths. vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); |
After playing some hours with openvg I found the following solution. A change in libshapes.c. void Image(VGfloat x, VGfloat y, int w, int h, char *filename) { It does break older code, because this way translate and scale do work on images too. Hope it helps someone... |
Hi klkl140 I have the same problem with scaling images, I modified libshape.c with your code but the image is not scaled :( Any suggestions? Thanks!! EDIT: Solve :) |
HI @LucaSoldi and @klkl140 , I am looking for a solution to scale the image from res 1920x1080 to 320x240. Regards, |
this happened too long ago.
Can you give me a link to the conversation you’ve found in the net?
Greetings Klaus
Am 13.05.2017 um 08:27 schrieb gurtajs4 <[email protected]>:
… HI @LucaSoldi and @klkl140 ,
I am looking for a solution to scale the image from res 1920x1080 to 320x240.
@LucaSoldi you did commented above that the in first try it didn't worked for you but later you solved it.
Can you guys provide some insight, perhaps some code sharing on how this is done.
Regards,
Gurtaj
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Hi @klkl140 , https://github.com/ajstarks/openvg/issues/3
void Image(VGfloat x, VGfloat y, int w, int h, char *filename) { I always see full size Image. Thanks, |
Are you scaling the VG_MATRIX_IMAGE_USER_TO_SURFACE matrix? If not then drawn images won't get scaled (see jamazerto's post above). By default the matrix to be altered is VG_MATRIX_PATH_USER_TO_SURFACE which only affects how paths are transformed. OpenVG uses 5 separate matrices, VG_MATRIX_PATH_USER_TO_SURFACE to transform paths (which are used to draw the various shapes) and VG_MATRIX_IMAGE_USER_TO_SURFACE to transform images (the others transform the fill and stroke paints and text glyphs). |
HI @paeryn
Remember I want to scale down the image from resolution 1920x1080 to 320x240. |
Is it possible to use Scale() to up-scale images? I tried using Scale() with makeimage() and Image() but it doesn't seem to do anything.
The text was updated successfully, but these errors were encountered: