Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color Palette Error #62

Open
dafep opened this issue Mar 24, 2023 · 8 comments
Open

Color Palette Error #62

dafep opened this issue Mar 24, 2023 · 8 comments

Comments

@dafep
Copy link

dafep commented Mar 24, 2023

Future<ByteData?> getImageBytes(GDisplayObject object) async {
var texture = await object.createImageTexture(); <--------- Here
return texture.root?.toByteData();
// texture?.dispose();
// texture = null;
}

[ +95 ms] [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Exception: Invalid image dimensions.
[ ] #0 Picture.toImage (dart:ui/painting.dart:5791:7)
[ ] #1 GDisplayObject.createImage (package:graphx/src/display/display_object.dart:1132:34)
[ ] #2 GDisplayObject.createImageTexture (package:graphx/src/display/display_object.dart:1099:23)
[ ] #3 getImageBytes (package:neuron/widgets/studio/components/right_menu/atomic_ui/color_palette_utils.dart:35:30)
[ ] #4 HueScene.addedToStage (package:neuron/widgets/studio/components/right_menu/atomic_ui/color_palette_hue_scene.dart:108:5)
[ ] #5 GDisplayObjectContainer.addChildAt (package:graphx/src/display/display_object_container.dart:152:15)

@roipeker
Copy link
Owner

This is a port of the ColorPicker example?

Could you try the graphx version on Github? Follow this guide.

Are you testing on desktop/web/mobile ?

@dafep
Copy link
Author

dafep commented Mar 24, 2023

Yes I'm talking about ColorPicker, I'm currently using it on the Desktop with Graphx version 1.0.9

@roipeker
Copy link
Owner

I just tried it on macos, and seems to be working on the master channel, which flutter version are you using?

@roipeker
Copy link
Owner

Is kinda late for me now. To get more prompt and interactive support, I encourage you to join us on our Telegram or Discord channels, you can get the links in the readme.

I will be available tomorrow to provide further assistance if needed. Looking forward to seeing you there and helping you resolve your issue.

@dafep
Copy link
Author

dafep commented Mar 24, 2023

I'm on version 3.9.0-16.0.pre.37 on the channel master I copied the ColorPicker project exactly as it is on GitHub without any difference, and I have the error I showed you

Flutter 3.9.0-16.0.pre.37 • channel master • https://github.com/flutter/flutter.git
Framework • revision f80a7a24db (15 hours ago) • 2023-03-23 20:09:44 -0400
Engine • revision 1da070c57c
Tools • Dart 3.0.0 (build 3.0.0-362.0.dev) • DevTools 2.22.2

@roipeker
Copy link
Owner

I'm on macOS, can't test on Windows/Linux
Using latest master channel now (3.9.0-16.0.pre.42)

in pubspec.yaml

environment:
#  sdk: ">=2.19.0 <3.0.0"
  sdk: ">=3.0.0-362.0.dev <=4.0.0"

I can run the example without exceptions.
Maybe something was wrong on the master channel in a previous release or I modified the code of the sample...
Try to run the latest example from the repo please, and let me know if it works.

The exception you shown seems like a dimension issues to rasterize the Picture to Image, so maybe the boundries are not detected... something like width or height <=0 or nan or infinite.

As a quick test, run this code as your scene, and see if it renders a magenta circle (this uses the same API as the color picker demo to rasterize an Image):

class SampleTexture extends GSprite {
  @override
  Future<void> addedToStage() async {
    stage!.addChild(
      GBitmap(await GTextureUtils.createCircle()),
    );
  }
}

@dafep
Copy link
Author

dafep commented Mar 24, 2023

I have well the round of magenta color which is displayed with the piece of code that you write

@roipeker
Copy link
Owner

Then most likely is an issue with dimensions. Probably the widget is not being expanded and the stage size is 0.

Test the latest code from the repo and tell me if the issue persist.

Also, as suggested before, you can join us in our server for further help, as I can't replicate this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants