haxeui / haxeui-hxwidgets

The hxWidgets backend of the HaxeUI framework -
http://haxeui.org
MIT License
23 stars 7 forks source link

make it work with canvas paths and fill colour #57

Closed Shallowmallow closed 1 month ago

Shallowmallow commented 1 month ago

I think one of my next updates would be trying to use only gc and not this weird mix of dc and gc

image

<canvas width="200" height="200" horizontalAlign="center">
            <data>
                <fill-style color="red" alpha="1" />
                <stroke-style color="#407ec9" thickness="3" />
                <move-to x="55" y="59"/>
                <begin-path/>
                    <fill-style color="green" alpha="1" />
                    <line-to x="52" y="88"/>
                    <line-to x="38" y="62"/>
                    <line-to x="11" y="74"/>
                    <line-to x="27" y="50"/>
                    <line-to x="3" y="32"/>
                    <line-to x="32" y="33"/>
                    <line-to x="35" y="4"/>
                    <line-to x="49" y="30"/>
                    <line-to x="76" y="18"/>
                    <line-to x="61" y="43"/>
                    <line-to x="85" y="60"/>
                <close-path/>

                <move-to x="77" y="15"/>
                <begin-path/>

                    <fill-style color="orange" alpha="1" />
                    <cubic-curve-to controlX="90" controlY="23" controlX2="49" controlY2="30" anchorX="49" anchorY="30"/>
                    <line-to x="156" y="19"/>
                    <cubic-curve-to controlX="156" controlY="19" controlX2="46" controlY2="5" anchorX="77" anchorY="15"/>

                    <close-path/>
                <move-to x="100" y="100"/>
                <rectangle x="50" y="70" width="100" height="10"/>
                <fill-style color="black" alpha="0" />
                <rectangle x="50" y="160" width="100" height="10"/> 
            </data>
        </canvas>
ianharrigan commented 1 month ago

I think one of my next updates would be trying to use only gc and not this weird mix of dc and gc

i think the issue there is that the apis are very different and offer quite different options, so i think you will end up with both because its the "best of both worlds"

Shallowmallow commented 1 month ago

Yeah maybe. But looking at it... It seems we could use gc for all. I think dc has clear and gc doesn't have it. But clear is kind of useless if you only clear dc and not gc. ( and there's surely another way to do it in gc) The other thing is that I need to add more externs to gc ( and one that is a little bit weird, but we'll see)