multiple icons from one bmp strip feature

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

multiple icons from one bmp strip feature

Jochen Riekhof
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


Reply | Threaded
Open this post in threaded view
|

Re: multiple icons from one bmp strip feature

Ian Bartholomew-18
Jochen,

> 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?

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


Reply | Threaded
Open this post in threaded view
|

Re: multiple icons from one bmp strip feature

Jochen Riekhof
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


Reply | Threaded
Open this post in threaded view
|

Re: multiple icons from one bmp strip feature

Jochen Riekhof
In reply to this post by Ian Bartholomew-18
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