Showing
2 changed files
with
7 additions
and
0 deletions
| @@ -19,6 +19,7 @@ import 'dart:typed_data'; | @@ -19,6 +19,7 @@ import 'dart:typed_data'; | ||
| 19 | import 'dart:ui' as ui; | 19 | import 'dart:ui' as ui; |
| 20 | 20 | ||
| 21 | import 'package:flutter/painting.dart'; | 21 | import 'package:flutter/painting.dart'; |
| 22 | +import 'package:image/image.dart' as im; | ||
| 22 | 23 | ||
| 23 | /// Represents a bitmap image | 24 | /// Represents a bitmap image |
| 24 | class PdfRaster { | 25 | class PdfRaster { |
| @@ -61,6 +62,11 @@ class PdfRaster { | @@ -61,6 +62,11 @@ class PdfRaster { | ||
| 61 | await image.toByteData(format: ui.ImageByteFormat.png); | 62 | await image.toByteData(format: ui.ImageByteFormat.png); |
| 62 | return data.buffer.asUint8List(); | 63 | return data.buffer.asUint8List(); |
| 63 | } | 64 | } |
| 65 | + | ||
| 66 | + /// Returns the image as an [Image] object from the pub:image library | ||
| 67 | + im.Image asImage() { | ||
| 68 | + return im.Image.fromBytes(width, height, pixels); | ||
| 69 | + } | ||
| 64 | } | 70 | } |
| 65 | 71 | ||
| 66 | /// Image provider for a [PdfRaster] | 72 | /// Image provider for a [PdfRaster] |
-
Please register or login to post a comment