Am Wed, 14 Sep 2016 11:36:12 +1000 schrieb Manu via Digitalmars-d <[email protected]>:
> On 14 September 2016 at 04:34, Marco Leise via Digitalmars-d > <[email protected]> wrote: > > JavaScript's canvas works that way for > > example. I.e. the only pixel format is RGBA for simplicity's > > sake and I'm not surprised it actually draws something if I > > load it with a 24-bit graphic. ;) > > Given this example, isn't it the job of the image loader to populate > the image with data?2 > […] I admit is was a constructed example. You can't load an image directly into a HTML5 canvas. Shame on me. > You'll notice I didn't add arithmetic operators to the HSx type ;) > If you have HSx colors, and want to do arithmetic, cast it to RGB first. Now that you say it, yes I was wondering how the arithmetics work since I couldn't find any opBinary. > I went through a brief phase where I thought about adding an angle > type (beside normint), but I felt it was overkill. > I still wonder if it's the right thing to do though... some type that > understands a circle, and making angle arithmetic work as expected. I see. I'm also wondering what equality means for a color with floating point hue 10° and another with hue 730°. I guess it is ok the way it is now, because wrapping the values doesn't guarantee they map to the same value either. Floating point equality is flawed either way. -- Marco
