Index: [thread] [date] [subject] [author]
  From: Jim Meier <fatjim@home.com>
  To  : ggi-develop@eskimo.com
  Date: Thu, 13 May 1999 11:23:04 -0600

Re: Semi-Snag in PyGGI...

Andreas Beck wrote:

> >   "Get/put buffers use chunky pixels, unpacked, even if their
> > representation in the
> >   framebuffer is packed (i.e. pixel size not multiple of 8 bits) or
> > non-linear. Thus, the
> >   application does not need to know how to use planar or packed pixels
> > for non-direct
> >   acccess. "
>
> > ...Is this to say that not all pixels are actually of size
> > (sizeof(ggi_pixel)) ?? I had thought the pixels buffers not being packed
> > meant that this didn't matter... if not, could someone please show me
> > the proper way to fill my buffers?
>
> Maybe that sentence is a little ambiguous.
>
> Get/Put buffers are packed to the pixel-size bytewise, but not bitwise.
> The pixel-size is usually smaller than sizeof(ggi_pixel), as the latter
> has to take care for any possible mode, while this would waste space in
> putbuffers for all modes except 32 bit ones.
>
> ggiMapColors (mind the plural) might help you.
>

and Marcus Sundberg wrote:
> Ehum, I believe you mean ggiPackColors. ;-)


Ah, I see. Makes sense once I pull my head out of the toilet.

Would it be a reasonable course of action to do something like the following:
int block_size=(number_of_pixels*actual_pixel_size_in_bytes);
ggi_pixel p=ggiMapColor(vis, &color);
ggi_pixel *pixel_buffer=(ggi_pixel*)malloc(block_size);
ggi_pixel *p=pixel_buffer
for(i=0;i<number_of_pixels;i++){
    *pixel_buffer=p;
    p+=actual_pixel_size_in_bytes;
}

I'm thinking there's something wrong with my pointer arithmetic there.. but that's
a small detail to iron out.

--
-Jim.

"No, the C code is buggy and all guarantees are off."
                                   --Guido van Rossum


Index: [thread] [date] [subject] [author]