Showing
3 changed files
with
24 additions
and
13 deletions
| @@ -193,18 +193,14 @@ class PDFGraphics extends PdfGraphics { | @@ -193,18 +193,14 @@ class PDFGraphics extends PdfGraphics { | ||
| 193 | 193 | ||
| 194 | @deprecated | 194 | @deprecated |
| 195 | class PDFImage extends PdfImage { | 195 | class PDFImage extends PdfImage { |
| 196 | - PDFImage(PdfDocument pdfDocument, | ||
| 197 | - {@required Uint8List image, | 196 | + PDFImage( |
| 197 | + PdfDocument pdfDocument, { | ||
| 198 | + @required Uint8List image, | ||
| 198 | @required int width, | 199 | @required int width, |
| 199 | @required int height, | 200 | @required int height, |
| 200 | bool alpha = true, | 201 | bool alpha = true, |
| 201 | - bool alphaChannel = false}) | ||
| 202 | - : super(pdfDocument, | ||
| 203 | - image: image, | ||
| 204 | - width: width, | ||
| 205 | - height: height, | ||
| 206 | - alpha: alpha, | ||
| 207 | - alphaChannel: alphaChannel); | 202 | + }) : super._(pdfDocument, |
| 203 | + image: image, width: width, height: height, alpha: alpha); | ||
| 208 | } | 204 | } |
| 209 | 205 | ||
| 210 | @deprecated | 206 | @deprecated |
| @@ -23,8 +23,22 @@ class PdfImage extends PdfXObject { | @@ -23,8 +23,22 @@ class PdfImage extends PdfXObject { | ||
| 23 | /// @param width | 23 | /// @param width |
| 24 | /// @param height | 24 | /// @param height |
| 25 | /// @param alpha if the image is transparent | 25 | /// @param alpha if the image is transparent |
| 26 | - /// @param alphaChannel if this is transparency mask | ||
| 27 | - PdfImage(PdfDocument pdfDocument, | 26 | + factory PdfImage( |
| 27 | + PdfDocument pdfDocument, { | ||
| 28 | + @required Uint8List image, | ||
| 29 | + @required int width, | ||
| 30 | + @required int height, | ||
| 31 | + bool alpha = true, | ||
| 32 | + }) => | ||
| 33 | + PdfImage._( | ||
| 34 | + pdfDocument, | ||
| 35 | + image: image, | ||
| 36 | + width: width, | ||
| 37 | + height: height, | ||
| 38 | + alpha: alpha, | ||
| 39 | + ); | ||
| 40 | + | ||
| 41 | + PdfImage._(PdfDocument pdfDocument, | ||
| 28 | {@required this.image, | 42 | {@required this.image, |
| 29 | @required this.width, | 43 | @required this.width, |
| 30 | @required this.height, | 44 | @required this.height, |
| @@ -42,7 +56,7 @@ class PdfImage extends PdfXObject { | @@ -42,7 +56,7 @@ class PdfImage extends PdfXObject { | ||
| 42 | params['/Name'] = PdfStream.string(_name); | 56 | params['/Name'] = PdfStream.string(_name); |
| 43 | 57 | ||
| 44 | if (alphaChannel == false && alpha) { | 58 | if (alphaChannel == false && alpha) { |
| 45 | - final PdfImage _sMask = PdfImage(pdfDocument, | 59 | + final PdfImage _sMask = PdfImage._(pdfDocument, |
| 46 | image: image, | 60 | image: image, |
| 47 | width: width, | 61 | width: width, |
| 48 | height: height, | 62 | height: height, |
| @@ -103,7 +117,7 @@ class PdfImage extends PdfXObject { | @@ -103,7 +117,7 @@ class PdfImage extends PdfXObject { | ||
| 103 | offset += len - 2; | 117 | offset += len - 2; |
| 104 | } | 118 | } |
| 105 | 119 | ||
| 106 | - return PdfImage(pdfDocument, | 120 | + return PdfImage._(pdfDocument, |
| 107 | image: image, width: width, height: height, jpeg: true, alpha: false); | 121 | image: image, width: width, height: height, jpeg: true, alpha: false); |
| 108 | } | 122 | } |
| 109 | 123 |
-
Please register or login to post a comment