bored-hairdresser-46817
03/01/2022, 6:31 PMbored-hairdresser-46817
03/01/2022, 6:34 PMbored-hairdresser-46817
03/01/2022, 6:38 PMbright-gpu-74537
03/01/2022, 7:06 PMclever-yak-82528
03/02/2022, 12:07 AMclever-yak-82528
03/02/2022, 12:08 AMbright-gpu-74537
03/02/2022, 8:47 AMbright-gpu-74537
03/02/2022, 8:48 AMbright-gpu-74537
03/02/2022, 9:21 AMclever-yak-82528
03/02/2022, 10:11 AMbright-gpu-74537
03/02/2022, 11:20 AMImage::hasAlpha, Image::addAlphaChannel, Image::ImageData::copyRGB, Image::ImageData::copyRGBA, Image::ImageData::copyARGB. To use it in your app, you have to jump through quite alot of hoops (its the nature of wx) and you are basically sidestepping haxeui at this point:
haxe
public override function onReady() { // make sure to use in onReady since the native wxWindow might not have been created in constructor
super.onReady();
final argbdata = convertARGB(haxe.Resource.getBytes("data"));
var image = new hx.widgets.Image(200, 56, true); // last param creates alpha channel (false by default) - image.addAlphaChannel() would also work
image.imageData.copyARGB(argbdata); // copy raw bytes in wx bytes buffer
thumb.width = 200; // must set size now, since we are subverting haxeui so it has no concept of the size
thumb.height = 56;
var thumbWindow = cast(thumb.window, hx.widgets.StaticBitmap); // grab the static bitmap window (what wx uses to display bitmaps)
thumbWindow.bitmap = new hx.widgets.Bitmap(image); // use the created wxImage to set the wxStaticBitmaps bitmap property
}bright-gpu-74537
03/02/2022, 11:23 AMToolkitAssets.instance.imageFromRaw(someBytes, Format.RGBA, ...) - that would wrap up alot of that, but its pretty low priority at the momentbright-gpu-74537
03/02/2022, 12:19 PMtypedef ImageData = hx.widgets.Bitmap;, so with that in mind:
haxe
public override function onReady() { // make sure to use in onReady since the native wxWindow might not have been created in constructor
super.onReady();
final argbdata = convertARGB(haxe.Resource.getBytes("data"));
var image = new hx.widgets.Image(200, 56, true); // last param creates alpha channel (false by default) - image.addAlphaChannel() would also work
image.imageData.copyARGB(argbdata); // copy raw bytes in wx bytes buffer
thumb.resource = new hx.widgets.Bitmap(image);
}bright-gpu-74537
03/02/2022, 12:23 PM.window directly, so haxeui can control things like that correctly)clever-yak-82528
03/02/2022, 2:30 PMclever-yak-82528
03/02/2022, 2:31 PMclever-yak-82528
03/02/2022, 2:31 PMbright-gpu-74537
03/02/2022, 3:30 PMToolkitAssets (core) extends AssetsImpl (backend) extends AssetsBase (core) - so i could just add an empty / stub imageFromRaw in the base, then override it the impl that exists in haxeui-hxwidgets and simply ignore it in other backends (for now) and then take them on a case by case basisbright-gpu-74537
03/02/2022, 3:31 PMclever-yak-82528
03/02/2022, 4:49 PMclever-yak-82528
03/02/2022, 4:49 PMclever-yak-82528
03/02/2022, 4:49 PMbright-gpu-74537
03/02/2022, 5:01 PMbored-hairdresser-46817
03/02/2022, 5:06 PMbright-gpu-74537
03/02/2022, 5:07 PMlabel.percentWidth = 100bright-gpu-74537
03/02/2022, 5:07 PMbored-hairdresser-46817
03/02/2022, 5:08 PMclever-yak-82528
03/02/2022, 5:09 PMclever-yak-82528
03/02/2022, 5:09 PM