An old MUI bug for ImageObject

A forum for general AmigaOS 4.x support questions that are not platform-specific
Post Reply
User avatar
ChrisH
Beta Tester
Beta Tester
Posts: 920
Joined: Mon Dec 20, 2010 9:09 pm
Contact:

An old MUI bug for ImageObject

Post by ChrisH »

I'm reporting a MUI bug I found present in AmigaOS4.1 Update 2 (I will try to report back after upgrading to Update 3, but I will be surprised if it has been fixed).

I wanted to create a MUI gui with a picture inside a button. The following code does not work as expected:

Code: Select all

Child,GroupObject, 
    MUIA_Group_Horiz,TRUE,
    MUIA_Background,MUII_ButtonBack, MUIA_Frame,MUIV_Frame_Button, MUIA_InputMode,MUIV_InputMode_RelVerify, 
    Child, ImageObject, MUIA_Image_Spec,"5:tbimages:quit", End, 
    Child, FreeLabel("this is a button!"), 
    Child, RectangleObject, MUIA_InnerLeft,0, MUIA_InnerRight,0, MUIA_InnerTop,0, MUIA_InnerBottom,0, End,
End
Specifically, ImageObject just results in a tiny empty image, when it is told to use mode 5 (i.e. load a picture using datatypes). Forcing the image object to be larger does not help.

On the other hand, the following code basically works:

Code: Select all

Child, SimpleButton("\33I[5:tbimages:quit] this is a button!\n"),
The reason why I don't use this is that MUI seems to ignore the height of the inserted image (and so I need a spurious "\n" to make it look roughly right on my set-up).

In the end I solved my problem with Dtpic/BitmapObject instead of an ImageObject, but that doesn't stop ImageObject from being buggy:
http://www.amigans.net/modules/xforum/v ... t_id=64544
User avatar
tboeckel
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 68
Joined: Mon Jun 20, 2011 8:56 am
Contact:

Re: An old MUI bug for ImageObject

Post by tboeckel »

The current MUI release still requires file names to follow a certain pattern to be used as you intend it. That means names without any extension will of course be loaded, but they are flexible in size, with zero size being the minimum. And exactly this is what you are observing right now: the image is not drawn, because MUI has decided that it will have a width of zero.

As a workaround you can rename the file as "tbimages:quit.mi1". This will enforce fixed sized alien (i.e. loaded via datatypes.library) images. The extension ".mim" on the other hand will enforce dual images within one image file using half the total image width for the single images. For example the image MUI:Images/list_Sort.mim is such an image. It consists of two arrow images in one picture, but internally MUI will convert this into two images.

The next major release of MUI will extend all this and you be able to tell MUI that arbitrary images may be tiled or not-tiled, color balancing and lots of other fancy graphical stuff will be possible, and all this without any restrictions on the actual file name. You will just have to add some parameters to the image spec.
User avatar
ChrisH
Beta Tester
Beta Tester
Posts: 920
Joined: Mon Dec 20, 2010 9:09 pm
Contact:

Re: An old MUI bug for ImageObject

Post by ChrisH »

OK, thanks. Hopefully all of that will be documented!

I was amazed to see that Dtpic is not documented at all, and in fact is missing vital definitions in it's #include which prevent it from being used (without declaring them yourself).
User avatar
tboeckel
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 68
Joined: Mon Jun 20, 2011 8:56 am
Contact:

Re: An old MUI bug for ImageObject

Post by tboeckel »

I will add Autodocs for Dtpic for the next release.
Post Reply