DeviceImage constructor
- LocalImage localImage, {
- double scale = 1.0,
- int minPixels = 0,
- int? compression,
Creates an object that decodes a LocalImage as an image.
The arguments must not be null. scale
returns a scaled down
version of the image. For example to load a thumbnail you could
use something like .1 as the scale. There's a convenience method
on LocalImage that can calculate the scale for a given pixel
size.
minPixels
can be used to specify a minimum independent of the
requested scale. The idea is that scaling an image that you don't know
the original size of can result in some results that are too small.
If the goal is to display the image in a 50x50 thumbnail then you might
want to set 50 as the minPixels, then regardless of the image size and
scale you'll get at least 50 pixels in each dimension. This parameter
was added as a result of a strange result in iOS where an image with
a portrait aspect ratio was failing to load when scaled below 120 pixels.
Setting 150 as the minimum in this case resolved the problem.
Implementation
const DeviceImage(this.localImage,
{this.scale = 1.0, this.minPixels = 0, this.compression});