32-bit Intuition Images

11 posts / 0 new
Last post
alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
32-bit Intuition Images

I'm trying to initialize a DiskObject structure by hand. I have called NewDiskObject to get an empty object, which is fine, and now I want to set up the Gadget structure with two images, for which data I have somewhere else in memory (that is the reason for doing it by hand: My Image data is in memory and not on disk).

Problem is, when I specify an Image Depth of more than 8, AmiDock just shows some random default image instead of my image in ram. I have tested with GetIconTags, and here the Depth values are all 8, but that doesn't make sense, since the icon shown is 32-bit (at least that's what I think it is).

Comments?

salass00
salass00's picture
Offline
Last seen: 7 months 2 weeks ago
Joined: 2011-02-03 11:27
@alfkil The Gadget structure

@alfkil

The Gadget structure and it's associated struct Image pointers is only for legacy planar icon gfx. For 8-bit CLUT or 32-bit ARGB icon gfx you should use IconControl():

  1. IIcon->IconControl(icon,
  2. ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
  3. ICONCTRLA_SetWidth, width,
  4. ICONCTRLA_SetHeight, height,
  5. ICONCTRLA_SetImageData1, argb_normal,
  6. ICONCTRLA_SetImageData2, argb_selected,
  7. TAG_END);
alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
@salass00 Thanks for the

@salass00

Thanks for the tip. I can't get it working, though. AmiDock still just shows some default image.
Here's ma code:

  1. void createAppIconInfo(QIcon &icon)
  2. {
  3. info = (struct ApplicationIconInfo *)IExec->AllocVecTags(sizeof(struct ApplicationIconInfo),
  4. AVT_ClearWithValue, 0,
  5. TAG_DONE);
  6. info->iconType = APPICONT_CustomIcon;
  7. struct DiskObject *obj = IIcon->NewDiskObject(WBTOOL);
  8. printf("obj: 0x%x\n", obj);
  9. info->info.customIcon = obj;
  10.  
  11. QImage imoff = QImage(icon.pixmap(64, 64));
  12. QImage imon = QImage(icon.pixmap(64, 64, QIcon::Normal, QIcon::On));
  13.  
  14. UWORD *data1 = (UWORD*)IExec->AllocVecTags(
  15. 64*4*64, TAG_DONE);
  16. memcpy(data1, imoff.bits(), 64*4*64);
  17. UWORD *data2 = (UWORD*)IExec->AllocVecTags(
  18. 64*4*64, TAG_DONE);
  19. memcpy(data2, imon.bits(), 64*4*64);
  20.  
  21. ULONG processed = IIcon->IconControl(obj,
  22. ICONCTRLA_SetImageDataFormat, IDFMT_DIRECTMAPPED,
  23. ICONCTRLA_SetWidth, 64,
  24. ICONCTRLA_SetHeight, 64,
  25. ICONCTRLA_SetImageData1, data1,
  26. ICONCTRLA_SetImageData2, data2,
  27. TAG_END);
  28. printf("processed: %d\n", processed);
  29. }

And this:

  1. sys->appID = IApplication->RegisterApplication(name,
  2. REGAPP_URLIdentifier, version,
  3. REGAPP_AppIconInfo, sys->info,
  4. //REGAPP_FileName, "Work:code/medium/screengrab-0.9.90/build/screengrab",
  5. REGAPP_AppNotifications, TRUE,
  6. REGAPP_Description, "Qt app has started...",
  7. TAG_DONE);

IconControl returns 5, so everything should be in order...

alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
Apparently one needs to call

Apparently one needs to call LayoutIcon to make the changes happen. Strange, because the autodoc says:

"Useful only for palette mapped icons"

...and I am using direct mapped icons. Well...

thomas
thomas's picture
Offline
Last seen: 1 week 5 days ago
Joined: 2011-05-16 14:23
"palette mapped" in this

"palette mapped" in this context refers to all images that are stored seperately to those in do_Gadget->GadgetRender and do_Gadget->SelectRender. In OS 3.5 (when this autodoc was written) there existed only normal images and palette mapped images.

alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
Ok, so far so good, icons are

Ok, so far so good, icons are working. But now I need to supply a struct Image to the AppDocky context menu. Do I really need to create a DiskObject for that, or is there some smart method to create a 32-bit struct Image??

hypex
hypex's picture
Offline
Last seen: 4 months 3 weeks ago
Joined: 2011-09-09 16:20
Well a struct Image stands

Well a struct Image stands alone in memory for display images so no is not part of a DiskObject. Even if a DiskObject makes use of an Image.

What funtion is it? Can the bitmap class help?

alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
Well, I have made the code,

Well, I have made the code, so that IconControl() creates the struct Image for me in full 32--bit. It works, but it is a hell of a detour for such a simple purpose...

I need the struct Image to supply to NewObject("popmenuitem.class"..... PMIA_Icon, ... TAG_DONE); There doesn't seem to be a tag for a bitmap class, and there doesn't seem to be any references to struct Image in the bitmap class.

trixie
trixie's picture
Offline
Last seen: 7 months 3 weeks ago
Joined: 2011-02-03 13:58
Re: 32-bit Intuition Images

@alfkil

I need the struct Image to supply to NewObject("popmenuitem.class"..... PMIA_Icon, ... TAG_DONE); There doesn't seem to be a tag for a bitmap class, and there doesn't seem to be any references to struct Image in the bitmap class

The BOOPSI/ReAction BitMap class is a sub-class of imageclass, so a bitmap object in fact points to a struct Image. If you create the bitmap image object

Object *bitMapImage = NewObject(...);

you'll then probably need to typecast

PMIA_Icon, (struct Image *)bitMapImage, ...

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

alfkil
alfkil's picture
Offline
Last seen: 4 months 1 week ago
Joined: 2011-05-10 22:02
@trixie An overdue thanks

@trixie

An overdue thanks for your explanation :)

trixie
trixie's picture
Offline
Last seen: 7 months 3 weeks ago
Joined: 2011-02-03 13:58
Re: 32-bit Intuition Images

Glad I could help.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

Log in or register to post comments