https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    bright-gpu-74537

    02/16/2023, 2:45 PM
    well, it'll be very "hxwidgets specific" but you can do it i think... maybe "AssetsImpl" needs an imageFromRGBABytes... 🤔
  • c

    clever-yak-82528

    02/16/2023, 2:46 PM
    yeah, i know i can do it
  • c

    clever-yak-82528

    02/16/2023, 2:46 PM
    i just can't remember how
  • b

    bright-gpu-74537

    02/16/2023, 2:47 PM
    gotcha... so... Image (haxui component) will have a
    .window
    property in the case of Image that will be a StaticBitmap (hxWidgets)
  • b

    bright-gpu-74537

    02/16/2023, 2:48 PM
    on StaticBitmap there is a .bitmap property which accepts a hx.widgets.Bitmap
  • b

    bright-gpu-74537

    02/16/2023, 2:49 PM
    you can construct one of those from a hx.widgets.Image
  • b

    bright-gpu-74537

    02/16/2023, 2:49 PM
    and that class has helper functions to work with raw data
  • c

    clever-yak-82528

    02/16/2023, 2:49 PM
    hmm
  • c

    clever-yak-82528

    02/16/2023, 2:49 PM
    thanks
  • b

    bright-gpu-74537

    02/16/2023, 2:51 PM
    Copy code
    haxe
    var staticBitmap = cast(haxeiuImage.window, hx.widgets.StaticBitmap);
    var image = new hx.widgets.Image(100, 100);
    image.imageData.copyRGBA(someBytes);
    var bmp = new hx.widgets.Bitmap(image);
    staticBitmap.bitmap = bmp;
  • b

    bright-gpu-74537

    02/16/2023, 2:51 PM
    something like that (untested, written blind)
  • b

    bright-gpu-74537

    02/16/2023, 2:52 PM
    note: you'll probably also need to resize the haxeui image appropriately (100x100 in that example)
  • c

    clever-yak-82528

    02/16/2023, 2:58 PM
    Copy code
    /usr/src/debug/wxwidgets/wxWidgets-3.2.2.1/src/gtk/bitmap.cpp(595): assert ""image.IsOk()"" failed in InitFromImage(): invalid image
  • c

    clever-yak-82528

    02/16/2023, 2:58 PM
    hm
  • c

    clever-yak-82528

    02/16/2023, 3:02 PM
    Copy code
    haxe
    final img = new hx.widgets.Image(rgba, dims.width, dims.height);
    final bmp = new hx.widgets.Bitmap(img);
    
    final comp = new haxe.ui.components.Image();
    comp.resource = bmp;
    
    tplimages.addComponent(comp);
  • b

    bright-gpu-74537

    02/16/2023, 3:08 PM
    the bytes constructor param isnt an rgba array
  • b

    bright-gpu-74537

    02/16/2023, 3:08 PM
    its for like png / jpeg / etc bytes
  • b

    bright-gpu-74537

    02/16/2023, 3:08 PM
    you need to use .imageData
  • c

    clever-yak-82528

    02/16/2023, 3:09 PM
    ah
  • c

    clever-yak-82528

    02/16/2023, 3:09 PM
    right
  • b

    bumpy-engineer-49082

    02/16/2023, 3:25 PM
    How then do explorer components work?
  • b

    bright-gpu-74537

    02/16/2023, 3:28 PM
    im not sure what you mean, they work the same as anything, the difference with the explorer is there is a whole kinda "application framework" around the views
  • b

    bright-gpu-74537

    02/16/2023, 3:28 PM
    to populate the tabs, etc, etc
  • b

    bright-gpu-74537

    02/16/2023, 3:32 PM
    https://github.com/haxeui/component-explorer/blob/master/src/views/MainView.hx#L30-L93
  • c

    clever-yak-82528

    02/16/2023, 3:55 PM
    aw yes
  • b

    bright-gpu-74537

    02/16/2023, 4:00 PM
    noice... forgot that this would work:
    comp.resource = bmp;
    ... well remembered 🙂
  • c

    clever-yak-82528

    02/16/2023, 4:01 PM
    heh
  • e

    early-butcher-76809

    02/16/2023, 5:14 PM
    It seems module Fonts don't work with Heaps. The prefix set in the module.xml isn't resolved when loading the font, so the program tries to load a file with a non-existing path (since it uses the prefix).
  • b

    bright-gpu-74537

    02/16/2023, 5:17 PM
    yeah, i dont think fonts can be loaded from bytes in heaps... though ill have to check that, so you'll just have to use font resources like heaps expects, which probably makes more sense anyway
  • b

    bright-gpu-74537

    02/16/2023, 5:18 PM
    yeah, no "fontFromBytes" in haxeui-heaps AssetsImpl, just "getFontInternal"
1...151915201521...1687Latest