JPG and PNG decoder
callumenator at gmail.com
Thu Jun 21 11:51:56 PDT 2012
On Thursday, 21 June 2012 at 17:58:47 UTC, Stewart Gordon wrote:
> On 18/06/2012 00:49, cal wrote:
>> ubyte data = some data;
>> Image img = new Img!(Px.R8G8B8)(width, height, data);
> Image? Img?
Image is the interface, Img the templated class that does all the
work. It is parameterized by the pixel format. It may not be the
best strategy (or naming scheme!) but enumerating the formats and
templating based on that limited the number of cases I had to
> Does it always take in a ubyte, or does that depend on the
> bit depth?
It currently just takes a ubyte, and doesn't do any rearranging
of the array, so it will only work for 8-bit depths. If you had
4-bit greyscale tightly packed into your ubyte (two pixels per
byte) then it would not be correctly interpreted, nor would 16
bit. The reason was I didn't want to have the Image class 'own'
the passed-in array. If it did own it, then it would be free to
unpack the smaller bit depths the way it does when decoding. I
will fix this when I have time to think about it a bit more.
More information about the Digitalmars-d-announce