On Friday, September 16, 2016 at 4:29:33 PM UTC, Páll Haraldsson wrote:
> `ARGB32` uses a `UInt32` representation of color, > > [I didn't see RGBA, only alpha in upper bits.. so unless I overlooked, may > not work, since bits not in the same order:] > > > " reinterpret(type, A) > > Change the type-interpretation of a block of memory. [..]" > > > for the 32-bit pixel values? > > Maybe you can do just that without any wrapper, if that is only needed, to > get the new type-name (assuming you can and there are no name classes with > importing two packages that define say Color..)? > I guess, when alpha is in the low bits, you could do something like: reinterpret(UInt32, UInt32(rotate_left(pixel))) # given that function was available.. but I guess it would be slow.. ROL (I'm justed to from assembly) couldn't be optimized away, in most or even any cases.. I'm not sure why, there are just [arithmetic] shift left and right in Julia and languages I'm familiar with.. I guess because you can build from that from: reinterpret(UInt32, UInt32(pixel<<8)) and more. Not sure that version would be easier for the optimizer.. Best would be if there already is already also a RGBA32 type (or you could add it). -- Palli.