Boost logo

Boost :

Subject: Re: [boost] [GIL] Pixel Layout Padding?
From: Christian Henning (chhenning_at_[hidden])
Date: 2013-12-28 11:43:42


On Fri, Dec 27, 2013 at 1:05 PM, TONGARI J <tongari95_at_[hidden]> wrote:

> 2013/12/28 Christian Henning <chhenning_at_[hidden]>
>
> > >
> > > > Could you describe a use case?
> > > >
> > >
> > > I have to work with something like RGBQUAD which's layout is BGRX:
> > >
> > >
> >
> http://msdn.microsoft.com/en-us/library/windows/desktop/dd162938(v=vs.85).aspx
> >
> >
> > QQ, the rgbReserved represents the alignment?
> >
>
> At least it requires 4 bytes by that structure.
> Also note that Quartz 2D also has padded RGB: http://tinyurl.com/kdawwkl
> So I think GIL being a generic library is reasonable to fill such a
> requirement.
>
> Now I have my pixel defined as:
>
> template<class T, class Layout, int padding = 0>
> class pixel;
>
> So RGBX becomes pixel<uint8_t, rgb_layout_t, 1>.
>
>
So, pixel<uint8_t, rgb_layout, 1 > in memory looks like ( a letter
representing a byte ):

rgbxrgbxrgbx...

pixel<uint8_t,rgb_layout, 2 > would be

rgbxxrgbxxrgbxx...

Is that correct?

Do you already have some code which could be added to GIL? I would be
willing to incorporate it and write tests and update documentation.

I have added your proposal to my gil todo list but I'm afraid I don't have
time right now.

Christian


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk