Re: Inlining pixbufs



On 24 Jun 2000, Owen Taylor wrote:

> 
> Tim Janik <timj@gtk.org> writes:
> 
> > On 23 Jun 2000, Havoc Pennington wrote:
> > 
> > > 
> > > Hi,
> > > 
> > > We need an equivalent to 'convertrgb' in gnome-libs/tools in order to 
> > > inline our stock icons, and since convertrgb is crufty and this is a
> > > generally useful feature, I wrote a new program to handle it. The
> > > program gets installed, so other people can use it.
> > > 
> > > The idea is:
> > >  - we create a program image-to-inline that loads image files and 
> > >    can create a file full of C variable declarations
> > >  - we use this to create the inline variables for GTK
> > >  - gdk-pixbuf.h now contains gdk_pixbuf_new_from_inline() that 
> > >    reads the stuff image-to-inline outputs.
> > > 
> > > Patch appended.
> > 
> > 
> > uhm, look at the CSource plugin in gimp. i had to face this
> > problem earlier last year for beast, and CSource is what steamed
> > from it.
> > CSource can easily be extracted into a standalone saving routine
> > if you want that, and since i mostly use it for alpha icons, it
> > implements simple RLE to squeeze the obvious bloat out of the
> > executable (and is about as fast a memcpy() on extraction).
> > CSource saves a macro for RLE extraction on the way, but i have
> > a more sophisticated function that also does bounds checking
> > laying around in beast/bse/bseutils.c:bse_icon_from_pixdata()
> > already.
> 
> The thing that this misses is that if you don't compress the data,
> then you can use the data without a copy, and it can be shared
> between apps. If you have 20 apps up displaying stock icons, that's
> a lot more than a 50% saving.

CSource isn't "missing" that point, the RLE is optional.
sure it's a good idea to share stock icons between apps,
but not all icons are used in stocks and are always needed
during an apps runtime, so there's a good point in RLE
as well as it keeps the binary (and compile time) down
and even the runtime size as long as icons are not needed.

> 
> Regards,
>                                         Owen
> 

---
ciaoTJ





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