image-class and transparency

Discuss GUI programming with the MUI Royale plugin here
Post Reply
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

image-class and transparency

Post by evil »

Hello!
I have a problem using transparencies in image-class

Here some code-snippets:

First the xml-file:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="MAIN" base="TEST">
	<window open="1" id="DATA" MUIID="DATA" notify="closerequest">
		<vgroup>
			<image id="h_preview" source="BRUSH: 10004"/>
			<slider min="0" notify="level" max="255" level="0" id="trans"/>
		</vgroup>
	</window>
</application>
Next the Hollywood-code:

Code: Select all

@REQUIRE "MUIRoyale"
@APPTITLE "ArtBase"
@APPVERSION "$VER: Artbase 0.5 (30.03.13)"
@APPCOPYRIGHT "©2014, Jörg Renkert"
@APPAUTHOR "Jörg Renkert"
@APPDESCRIPTION "ArtBase"

;Create Brush
Function p_display(tt)
	CreateBrush (10004,300,100)
	SelectBrush(10004) Displaybgpicpart (1,170,190,300,100,0,0) EndSelect()
	CreateBrush (2,200,50,$ff00ff)
	SelectAlphaChannel(10004) SetAlphaIntensity(tt) DisplayBrush(2,0,0) EndSelect
	SelectBrush(10004) DisplayBrush(2,0,0) EndSelect
	SelectAlphaChannel(10004) SetAlphaIntensity(255) Textout(0,0,tt) EndSelect
	SelectBrush(10004) Textout(0,0,tt) EndSelect
EndFunction

;Chnge transparency
Function p_change()
	p_display(mui.get("trans","level"))
	mui.set("h_preview","BRUSH",10004)
	cls() Displaybrush (10004,0,0)
EndFunction


SetFontColor ($00ffff) SetFont(#SANS,40) SetFontStyle (#AntiAlias)
p_display()

mui.CreateGui(FileToString("XML"))
Installeventhandler ({MUIRoyale=p_change})

repeat
	waitevent()
forever
On AmigaOS 3 everything works fine. The brushes shown in the mui-window and hollywood-window always look the same.

On OS4 the brush in the mui-window-image-class looks strange.
If the slider is 0, the brush is simply white. No Transparency here.
If the slider is moved to the right, the brush fades from white to pink. But no transparency here...

Is this a bug??

Best regards

George
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: image-class and transparency

Post by airsoftsoftwair »

What is in BGPic 1? Is it just black or does it contain graphics?
evil
Posts: 177
Joined: Mon Jun 14, 2010 1:38 pm

Re: image-class and transparency

Post by evil »

It is just black!
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: image-class and transparency

Post by airsoftsoftwair »

This is not a bug. Brush 10004 contains alpha channel transparency. Hence, it is mixed with the underlying background image. In your Hollywood window, the underlying background is pitch black whereas in the MUI window the background is not black but could contain whatever the user has configured to be his group background (it could be a gradient, a pattern, static color, whatever...) By default, it's probably some sort of greyish gradient. If you want the appearance in the MUI window to be the same as the appearance in the Hollywood window, you'll have to force the MUI window to use a black background for your <image> object. This could be done like this, for instance:

Code: Select all

<?xml version="1.0" encoding="iso-8859-1"?>
<application id="MAIN" base="TEST">
   <window open="1" id="DATA" MUIID="DATA" notify="closerequest">
      <vgroup>
         <hgroup backgroundrgb="#000000">
             <image id="h_preview" source="BRUSH: 10004"/>
         </hgroup>
         <slider min="0" notify="level" max="255" level="0" id="trans"/>
      </vgroup>
   </window>
</application>
Maybe it looks correctly on OS3 because your MUI config on OS3 uses darker background colors or something... it's definitely not a bug.
Post Reply