Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

multiple icons from one bmp strip feature

1 view
Skip to first unread message

Jochen Riekhof

unread,
Sep 30, 2002, 1:58:21 PM9/30/02
to
Hi....

probably I am wrong, but somehow I remember I read something about a feature
that allows one bmp strip of images (e.g. 160x16 pixels gives 10 16x16
icons) to be loaded. Can't find the doc anymore; does someone know about
this feature?

Ciao

...Jochen


Ian Bartholomew

unread,
Sep 30, 2002, 4:09:57 PM9/30/02
to
Jochen,

In Dolphin this technique is often used for the images displayed on
ToolbarButtons. All the images are added to one large bitmap and when the
Toolbar is designed you specify the Bitmap and the offset (0 based) for the
image you want. The first image (0@0 to 15@15) is index 0, the second
(16@0 to 31@15) is index 1 etc.

It appears that you can also do this outside of the Toolbar (I assume
Toolbars use the same functionality) but it's not something I've ever used.
However, I tried the following test and it seems to work....

Create a bitmap containing n 16x16 bitmaps. Evaluate ...

x := WinImageList newExtent:16@16.
x addBitmap: (Bitmap fromFile: 'x.bmp').

The WinImageList breaks down the big bitmap into separate images.
Evaluating

x getImageCount

should answer the correct number of separate images. You can convert each
one to an Icon by specifying its (0 based) offset...

x getIcon: anImageOffset style: 0

I don't know what the style argument does but a search on MSDN online should
shed some light.

Regards
Ian


Jochen Riekhof

unread,
Oct 1, 2002, 12:41:57 PM10/1/02
to
Ian...

ah, thanks a lot!!! Was exactly what I searched for! I already though I only
dreamt this ;-).
Good to have you here :-). (still have no idea where I read about this).

Ciao

...Jochen


Jochen Riekhof

unread,
Oct 1, 2002, 1:05:57 PM10/1/02
to
now that you gave me the class name, I found out that even transparency is
supported. I used:

winImageList := WinImageList newExtent:16@16 masked: true.
winImageList addTransparentBitmap: (Bitmap fromFile: 'abitmap.bmp'). "uses
up-left pixel color as definition for transparency color"

winImageList getIcon: 0 style: 0.

gives transparent icons!

Ciao

...Jochen

0 new messages