Re: Inlining pixbufs



On 24 Jun 2000, Havoc Pennington wrote:

> Tim Janik <timj@gtk.org> writes: 
> > 1) what's that magic steaming from?
> 
> rand()

hm, we can do a tiny bit better ;)

> > 2) why do we need a rowstride here? we don't have a length field and
> >    are talking about transporting one frame, so i don't see a need for
> >    that (and it defeats things like RLE)
> 
> It's just to simplify the code. I don't know how RLE works so I don't
> know how they interact; this is perhaps one reason that I shouldn't
> implement RLE. ;-)

you don't need to, the implementation is already there, and i can
put it into the required pixbufs functions once we established the
API.

> > 3) why have has_alpha, colorspace and n_channels? that's better encoded
> >    in one 4 byte type field with an open flag convention (i.e. with something
> >    like the enum BsePixdataType i use)
> 
> It's just a raw dump of Pixbuf; this is what Pixbuf has. 

yeah, and pixbuf has those fields because ArtPixbuf has them.
there it actually makes sense, if you keep e.g. a font's RGBA
bitmap image in memory, you can use offsets and rowstride to
access the individual letters, but that's not the case with
selection data or saved images where you have to care about
offsets and rowstride yourself.

> > 4) how are bit sizes other than 8 handled, especially wrg to packing non
> >    powers of two?
> > 
> 
> Pixbuf doesn't support these, when it does we could come up with some
> convention.

so GdkPixdataType is sufficient here as well.

> > i think it's be better to define a 4 byte type field that also leaves
> > room for enhancements like RLE:
> > 
> ...  
> >   /* generate Pixbuf from C source saved structure */
> >   GdkPixbuf* gdk_pixbuf_new_from_pixdata (const GdkPixdata *pixdata);
> >   
> >   /* generate Pixbuf from byte stream, ignores GDK_PIXDATA_MEMTYPE_STATIC */
> >   GdkPixbuf* gdk_pixbuf_new_from_stream  (const guint8 *pixdata_stream);
> > 
> > (the functions would share the same decoder backend of course)
> > 
> 
> I have no objection to that - if Owen agrees I'll do this, otherwise
> you and Owen discuss and tell me what to implement.

fine.

> 
> Havoc
> 

---
ciaoTJ





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]