var recorder = new ui.PictureRecorder();
var canvas = new Canvas(recorder, new Rect.fromLTWH(0.0, 0.0, 200.0, 200.0));
var painter = new TestCustomPainter(50.0, 50.0);
painter.paint(canvas, const Size(200.00, 200.00));
var pic = recorder.endRecording();
var image = pic.toImage(200, 200);
print(sprintf("%dx%d", [image.width, image.height]));
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
There are contributing instructions for the engine here:If I were going to do this, I'd probably start by just trying to add Image.toByteData as described in #11648. I suspect this almost entirely boils down to an API design question. The amount of code to add APIs to dart:ui is typically pretty small, e.g. https://github.com/flutter/engine/pull/4222I'm not entirely sure what the right API design here is. We've typically tried to expose Skia's APIs directly through dart:ui as much as possible, but the SkData and SkPixelSerializer abstractions here would probably be overkill.One way to proceed would be to just hack something together in your local engine and post a PR for review. Having a concrete proposal would likely move the issue to resolution pretty quickly.Hope that helps?Eric
--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
I see, it is good to know that flutter devs are striving to make binary size as minimum as possible. Thanks Todd. Any ETA for next beta?
So, after we got unencoded image bytes then encode it using image package, is it safe to say that we can write (save) it as an image file on android and ios?
Looks like this is a good entry for Flutter cookbook. I hope there is a member of community who is much more knowledgeable than me willing to share his/her knowledge to us newbies! :)
On Friday, April 13, 2018 at 5:39:46 AM UTC+7, Todd Volkert wrote:For those following along, this API is likely to change before the next beta release. The newly added dependency on image encoding in the Flutter engine increased our release binary size by an unacceptable amount. The final API will likely return raw, unencoded, image bytes -- and it will be up to the caller to perform the encoding (using something like package:image or a platform plugin).-T
--
[if(feature='Flutter.Image.encodeImage')]
enum EncodedImageFormat {
[if(feature='Flutter.Image.encodeImage.jpeg')]
JPEG,
[if(feature='Flutter.Image.encodeImage.png')]
PNG,
[if(feature='Flutter.Image.encodeImage.webp')]
WEBP,
}
class Image ... {
[if(feature='Flutter.Image.toByteData')]
Future<ByteData> toByteData({EncodingFormat format: const EncodingFormat.jpeg()}) { ... }
[if(feature='Flutter.Image.encodeImage')]
void encodeImage(EncodedImageFormat format, int quality, ImageEncoderCallback callback) { ... }
}
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.