-
Notifications
You must be signed in to change notification settings - Fork 74
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
Capability to resize Images #119
Comments
Hmm, does using Lines 18 to 32 in e3bbb93
(Alternatively, you could implement a custom |
Thanks for the quick reply @ryanmcgrath! Im trying with let img = Image::draw(DrawConfig {
source: (512., 512.), // Original Image Size
target: (64., 64.), // Expected Size
resize: ResizeBehavior::AspectFit, // Maintain Aspect Ratio
}, |cg_rect, ctx| {
// My understanding is that here I could attempt load my Image bytes into
// a `CGImage` instance but I didn't found any `from_bytes` like method
// in `core-graphics`
ctx.draw_image(cg_rect, /* need a CGImage instance representing my file */);
true
}); Any suggestions? |
Hmmm, yeah, you'd need to dig around in Core Graphics to find an equivalent for drawing the image directly - it's been a bit since I've had to spelunk that low so my memory is unfortunately hazy there. One odd path you could also consider: creating a |
It would be nice to have support to set a fixed height and width for an image.
Im using
cacao::image::Image
instance withImage::with_data
to set an image from bytes intoa view, but I don't seem to find a way to set image dimensions.
I have found the following snippet on StackOverflow on how could it be done:
But given that Im not very familiar with Objective-C Im not pretty sure if there could be a simpler approach.
Thanks in advance!
The text was updated successfully, but these errors were encountered: