saving ICOs



So, in order to make gdk_cursor_new_from_pixbuf() implementable on
Win32, I'm currently writing code to save ICOs. The problem I'm facing
is that I don't think it will be enough to save only a single image; I
think we will have to create an ICO (or CUR, rather) containing multiple
versions at different sizes and bitdepths, to let the Win32 cursor code
pick the preferred size/depth combination.What I have been working on so
far is to do the scaling/depth reduction internally, so that one can
write:

 gdk_pixbuf_save (pixbuf, "my.ico", "ico", &error, 
                  "size", "16x16x16",
                  "size", "32x32x16",
                  "size", "64x64x32",
		  NULL);

or

gdk_pixbuf_save (pixbuf, "my.cur", "ico", &error,
                 "x_hot", "8",
                 "y_hot", "10",
                 "size", "32x32x16",
                 "size", "48x48x24",
                 NULL);

to produce an ICO containing 3 bitmaps of size 16x16 with 16bpp, 32x32
with 16bpp and 64x64 with 32bpp. The issues with this approach are

a) In order to support depths <= 8 I need to produce a colormap. Would a
function like gdk_pixbuf_quantisize() be generally useful ? 

b) Doing scaling and quantization internally will probably produce
suboptimal results. It would be nice if multiple pixbufs could be
directly provided to the save function, but the only way to achieve that
would be via hacks like g_object_set_data () on the pixbuf or providing
the additional pixbufs as options via pointer->string.

I guess the questions I'd like to hear some opinions on are:

1) Do we need the ability to save multiple images in an ico to provide
an adaequate implementation of gdk_cursor_new_from_pixbuf() on Win32 ?

2) Is internal scaling/quantization acceptable or do we need to
find a way to save multiple pixbufs into one file ?

3) Would gdk_pixbuf_quantisize() be generally useful ? 

Matthias





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