Hi, I've 2 questions about MUI and the use of picture inside a program. If somebody could answer me, it will be very nice.
1) I'm trying to use a Glow icon as source of a DTPic picture in a program but it fails to show.
For example, in the program SysMon (on OS4depot) I'm trying to replace the png info file source of the main panel (at the top left) by a glow icon info file. With PNG it works well like this
As zzd10h already stated, the About-MUI.class is able to load the 32Bit-GlowIcon without any help of a datatype! I *assume* the author of that MUI class uses icon. or workbench.library functions to load the icon imagery...
As zzd10h already stated, the About-MUI.class is able to load the 32Bit-GlowIcon without any help of a datatype! I *assume* the author of that MUI class uses icon. or workbench.library functions to load the icon imagery...
Yes I saw that and make sense, but unless I misunderstood, it's not the about window that has a problem (I think he said that works) but another image he is trying to replace?
The image didn't load (the about window still worked)
Then I installed the icon datatype.
After that the image loaded fine.
Therefore MUI does use datatypes.library to load images (which I think was ano brainer but you never know)
I don't think the solution is to install the info datatype though, as it;s not currently a standard datatype and I'm sure most people don't have it. rather you should tobtain he 32bit image data via icon library, and pass that to the MUI image class. I don't how to do that (pass the image data to MUI), but as most NUI fans claimm MUI is easier to use than ReAction it must be trivial
Yeah i think you should use the info.datatype for that, i just remember a few programs from kas1e when we had exactly the same issue on the various aboutbox (no image at all) so the image was not showed.
Only problem, this datatype isn't availible on OS4 by default
w = h = 0; m_IIcon->LayoutIcon(m_pointer_icons[i],m_screen,TAG_DONE); m_IIcon->IconControl(m_pointer_icons[i],ICONCTRLA_GetImageData1,&image, ICONCTRLA_GetWidth,&w, ICONCTRLA_GetHeight,&h, TAG_DONE);
Thank you broadblues, I take several hours to try it with your advices. it doesn't work but with your code I can see if the icon is PNG or Amiga type... But it doesn't load some pictures on my MUI interfaces.
With the below code, for PNG icon , I obtain GetIconTags OK LayoutIcon OK IconControl OK PNG
for Glow Icon, GetIconTags OK LayoutIcon OK IconControl OK Amiga
Therefore, I think that the icons are well loaded but not displayed. it must be my call to the MUI ImageObject who must be wrong (at least, certainly many others wrong things in my code...)
Broadblues, if you have times, could you look at this ? But again, thanks to have send me this code.
Here is my code, :
struct DiskObject *ApplIcone;
struct Screen *monEcran ; if ((monEcran = LockPubScreen(NULL))) UnlockPubScreen(NULL,monEcran);
ApplIcone = GetIconTags("SysMon",ICONGETA_FailIfUnavailable,FALSE,TAG_DONE) ; /* or with SysMon.info */ //ApplIcone = GetIconTags(NULL,ICONGETA_GetDefaultName,"SysMon.info", ICONGETA_FailIfUnavailable,FALSE,TAG_DONE) ; /* GetIconTags failed like this or with "SysMon" */ if(ApplIcone) printf("GetIconTags OK\n"); else printf("GetIconTags KO\n");
w = h = 0; BOOL rc ; rc = LayoutIcon(ApplIcone,monEcran,TAG_DONE); //rc = LayoutIcon(ApplIcone,NULL,TAG_DONE); /* or with this */ if (rc) printf("LayoutIcon OK\n"); else printf("LayoutIcon KO\n");
STRPTR * iconFormat;
if (IconControl(ApplIcone,ICONCTRLA_GetImageData1,&image, ICONCTRLA_GetWidth,&w, ICONCTRLA_GetHeight,&h, ICONCTRLA_GetIconFileFormat,&iconFormat, TAG_DONE)) printf("IconControl OK %s\n",iconFormat); else printf("IconControl KO\n");
And finally to load picture in my MUI interface :
Child, DtpicObject, MUIA_Dtpic_Name, image, End, /* or with (struct Image *)image */ Child, ImageObject, MUIA_Image_OldImage, image,End, /* or with (struct Image *)image */
... And at end : if (ApplIcone) { FreeDiskObject(ApplIcone); printf("FreeDiskObject final de l'icone\n") ; }