This is my first usage of aiss images, and it's almost working as expected. I have a horizonital layout group of five Buttons. Before now they used GA_Text labels and looked normal. To add images I replaced each GA_Text tag with the following:
Of course, slightly changing the filenames as needed. You may assume that BitMapClass is properly opened and screen is a valid pointer to struct Screen. It works, in that I get all the graphics, but the weird part is that the first button displays the BitMaps properly, and the next four display the images over a black background instead of the usual grey scaled background. I tried combinations, looked for differences, apparently I'm just missing it. I have reviewed the code others have posted for loading AISS images, did not see a significant difference. I have viewed the images in Multiview and they are all properly grey there. I'm just hoping someone has seen this and can suggest a fix. I have an image available, but it's not hosted.. :( Thanks! LyleHaze
- BUTTON_RenderImage, IIntuition->NewObject(BitMapClass, NULL,
- BITMAP_Screen, screen,
- BITMAP_Masking, TRUE,
- BITMAP_SourceFile, "tbimages:tapepause",
- BITMAP_SelectSourceFile, "tbimages:tapepause_s",
- BITMAP_DisabledSourceFile, "tbimages:tapepause_g",
Has this issue with BITMAP_Masking been solved/confirmed? I seem to have an issue consisting in, that the exact same image loaded from different locations yield differences in masking abilities. It would be wonderful if these could somehow resolve.
Sadly, I cannot remember.
I'm sure my original issue was for Score, and the gadget graphics there are all good now, but the details of then vs now are forgotten.
Getting old sucks, but NOT getting old sucks even more.
Sure, staying healthy is the only option ;).
The issue I'm pressing, is the fact that
string imagePath = "tbimages:" + iconName;
yields an icon with masking, whereas
string imagePath = "Icons/" + iconName;
(refering in this instance to the exact same file just placed differently) yields an icon without.
The entire code snippet:
Are you 100% sure the file is the same? Load it inot MultiView(er) and test if both locatsions have an alpha channel.
As secondary comment, why are you doing strdup(somestring.c_str()) all over the place? Surely the result string.c_str() is not going out of scope so need to dup it. Using strdup() without saving the result and free()ing it will be leeking memory?
The files are 100% identical. I confirm this by running
diff tbimages:file Icons/file
The reason I am running strdup is, that apparently there are problems with CopyText attributes in some classes. I know it is probably unnecessary in some cases, but for generic purposes it has just been added all over the place. To remedy the memory loss, I am going to add some kind of garbage collection to avoid having to keep track of the excess strings.
I think only ListBrowser has that CopyText issue, in the case above the text does not need to persist and is not copied.
I would think if where you do need text to persist beyond the function scope you would be better altering the scope of your string object? Would seem more C++ in style.
WRT to the original point of images rendering without alpha, may be run Snoopy whilst starting the app with the tbimages: and the local paths and see if any obvious anomalies show up. The path shouldn't make any difference and doesn't in any of my own apps, so something odd is going on.
I think, that there is definitely a better way to handle string transfers in this context. I just haven't gotten to the point, where I want the perfection of that aspect to guide my transactions in coding space.
I am not too much of a fan of Snoopy. It doesn't strike me as the good solution to snoop around in system calls to solve coding issues. My theory is, that to solve a coding issue, you need to think conceptually rather than try and keep track of the procedures. It has actually helped me get past some real issues, so I think I am gonna stick to that theory for the time being.
Best of all.