diff --git a/example/lib/_processing_demo_sketch_display.dart b/example/lib/_processing_demo_sketch_display.dart index 99f1c0b..2721f15 100644 --- a/example/lib/_processing_demo_sketch_display.dart +++ b/example/lib/_processing_demo_sketch_display.dart @@ -364,26 +364,26 @@ class ProcessingDemoState extends State with SingleTickerProvide // Retrieve the pixel data for the current sketch painting. final frameBytes = await image.toByteData(); - final rawImageData = frameBytes!.buffer.asUint8List(); + final rawImageBuffer = frameBytes!.buffer; // Convert the pixel data to the desired format. late List formattedImageData; switch (imageFormat) { case ImageFileFormat.png: formattedImageData = imageFormats.encodePng( - imageFormats.Image.fromBytes(image.width, image.height, rawImageData), + imageFormats.Image.fromBytes(width: image.width, height: image.height, bytes: rawImageBuffer), ); break; case ImageFileFormat.jpeg: formattedImageData = imageFormats.encodeJpg( - imageFormats.Image.fromBytes(image.width, image.height, rawImageData), + imageFormats.Image.fromBytes(width: image.width, height: image.height, bytes: rawImageBuffer), ); break; case ImageFileFormat.tiff: throw UnimplementedError('Tiff images are not supported in save()'); case ImageFileFormat.targa: formattedImageData = imageFormats.encodeTga( - imageFormats.Image.fromBytes(image.width, image.height, rawImageData), + imageFormats.Image.fromBytes(width: image.width, height: image.height, bytes: rawImageBuffer), ); break; } diff --git a/example/lib/io/gif.dart b/example/lib/io/gif.dart index cf11ba3..d747509 100644 --- a/example/lib/io/gif.dart +++ b/example/lib/io/gif.dart @@ -40,7 +40,7 @@ class GifGenerator { await sketch.loadPixels(); - final gifFrame = gif.Image.fromBytes(sketch.width, sketch.height, sketch.pixels!.buffer.asUint8List()); + final gifFrame = gif.Image.fromBytes(width: sketch.width, height: sketch.height, bytes: sketch.pixels!.buffer); final timeInHundredths = (_gifFrameRateFps.inMilliseconds / 10).round(); _gifEncoder.addFrame(gifFrame, duration: timeInHundredths); _addedFrameCount += 1; @@ -68,7 +68,7 @@ class GifGenerator { } final frameBytes = await frame.toByteData(); - final gifFrame = gif.Image.fromBytes(frame.width, frame.height, frameBytes!.buffer.asUint8List()); + final gifFrame = gif.Image.fromBytes(width: frame.width, height: frame.height, bytes: frameBytes!.buffer); _frames.add(gifFrame); // final timeInHundredths = (_gifFrameRateFps.inMilliseconds / 10).round(); // _gifEncoder.addFrame(gifFrame, duration: timeInHundredths); diff --git a/example/pubspec.lock b/example/pubspec.lock index dfee334..5a33ca3 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: archive - sha256: ae3e2b5dcfd7262920f3a36df8f04a9f798bafe395d7dc6cf2a7178ae8aba792 + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.4.10" async: dependency: transitive description: @@ -57,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" cross_file: dependency: transitive description: @@ -69,10 +77,10 @@ packages: dependency: transitive description: name: crypto - sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.3" fake_async: dependency: transitive description: @@ -197,15 +205,23 @@ packages: dependency: "direct main" description: name: image - sha256: "3e5c9ef82c0af7823be4cb5294a829a6e0548a6f6b4e261e6386509a9e03bcab" + sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "4.1.7" integration_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf + url: "https://pub.dev" + source: hosted + version: "0.7.1" lints: dependency: transitive description: @@ -266,10 +282,10 @@ packages: dependency: transitive description: name: petitparser - sha256: "85e8f8b118afcccf948a9844d199e56260117400bd9b9982d87bf1d62ebc1690" + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "6.0.2" platform: dependency: transitive description: @@ -286,6 +302,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + url: "https://pub.dev" + source: hosted + version: "3.7.4" popover: dependency: "direct main" description: @@ -407,10 +431,10 @@ packages: dependency: transitive description: name: xml - sha256: "9d2cf96b38e3f523fb78f0102d1d4483f817f3c3a6d81f46bf1b7a430ae8d561" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "6.5.0" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" + dart: ">=3.2.0 <4.0.0" flutter: ">=2.0.0" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index eb8d5fc..72fa98f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -17,7 +17,7 @@ dependencies: file_selector: ^0.8.2 file_selector_macos: ^0.0.4 - image: ^3.0.2 + image: ^4.1.7 path: ^1.8.0 patterns_canvas: ^0.3.5 popover: ^0.2.6+2 diff --git a/lib/src/output/_image.dart b/lib/src/output/_image.dart index 3096036..e2bda60 100644 --- a/lib/src/output/_image.dart +++ b/lib/src/output/_image.dart @@ -120,19 +120,19 @@ Future saveBytesToFile({ switch (imageFormat) { case ImageFileFormat.png: formattedImageData = imageFormats.encodePng( - imageFormats.Image.fromBytes(width, height, imageData), + imageFormats.Image.fromBytes(width: width, height: height, bytes: imageData.buffer), ); break; case ImageFileFormat.jpeg: formattedImageData = imageFormats.encodeJpg( - imageFormats.Image.fromBytes(width, height, imageData), + imageFormats.Image.fromBytes(width: width, height: height, bytes: imageData.buffer), ); break; case ImageFileFormat.tiff: throw UnimplementedError('Tiff images are not supported in save()'); case ImageFileFormat.targa: formattedImageData = imageFormats.encodeTga( - imageFormats.Image.fromBytes(width, height, imageData), + imageFormats.Image.fromBytes(width: width, height: height, bytes: imageData.buffer), ); break; } diff --git a/pubspec.lock b/pubspec.lock index b4f5126..3e60d38 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,10 +5,10 @@ packages: dependency: transitive description: name: archive - sha256: a92e39b291073bb840a72cf43d96d2a63c74e9a485d227833e8ea0054d16ad16 + sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.4.10" async: dependency: transitive description: @@ -49,14 +49,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" crypto: dependency: transitive description: name: crypto - sha256: cf75650c66c0316274e21d7c43d3dea246273af5955bd94e8184837cd577575c + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.3" fake_async: dependency: transitive description: @@ -111,10 +119,18 @@ packages: dependency: "direct main" description: name: image - sha256: "3e5c9ef82c0af7823be4cb5294a829a6e0548a6f6b4e261e6386509a9e03bcab" + sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e" + url: "https://pub.dev" + source: hosted + version: "4.1.7" + js: + dependency: transitive + description: + name: js + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "0.7.1" lints: dependency: transitive description: @@ -159,10 +175,18 @@ packages: dependency: transitive description: name: petitparser - sha256: "85e8f8b118afcccf948a9844d199e56260117400bd9b9982d87bf1d62ebc1690" + sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 + url: "https://pub.dev" + source: hosted + version: "6.0.2" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" url: "https://pub.dev" source: hosted - version: "4.1.0" + version: "3.7.4" sky_engine: dependency: transitive description: flutter @@ -244,10 +268,10 @@ packages: dependency: transitive description: name: xml - sha256: "30498604ab00fc50286f8aaf7e077c496550b16ed2f325c14152244882314f03" + sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 url: "https://pub.dev" source: hosted - version: "5.1.2" + version: "6.5.0" sdks: - dart: ">=3.2.0-194.0.dev <4.0.0" + dart: ">=3.2.0 <4.0.0" flutter: ">=1.17.0" diff --git a/pubspec.yaml b/pubspec.yaml index 10574d6..63e7107 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,7 +12,7 @@ dependencies: sdk: flutter fast_noise: ^2.0.0 - image: ^3.0.2 + image: ^4.1.7 path: ^1.8.0 dev_dependencies: