On Oct 30, 2007, at 3:02 PM, Thom McGrath wrote:
> I just tried using the RB toolbar for the first time on Windows, and
> the icons it creates are horrible. I supply it with a proper alpha-
> channel picture, and the result gives me just the opposite: no alpha
> channel. Just transparent.
That's a Windows toolbar for you.
> Is there a workaround besides guessing the background color and
> drawing it in myself?
Here's the relevant bit from the notes I've been collecting on a
"Best Practices" book for RB... though work has kept me so busy
lately, I don't know if or when I'll get around to actually writing
it...
Windows supports only 1-bit masking on a toolbar icon, so a
beautifully antialiased icon for Mac or Linux will look horrible on
Windows... UNLESS the icon is drawn onto a neutral background color.
Use &cDEDED0 as the background color of the icon, and it'll look good
on all platforms.
If your icons were made against another background color (most
artists will use black), you can convert them with code like this
(assuming the mask has the same file name but ending in "-Mask.bmp"):
Dim srcp As Picture = f.OpenAsPicture
if srcp is nil then
Print "Unable to open " + f.Name
return
end if
Dim maskName As String = Left( f.Name, f.Name.Len - 4 ) + "-Mask.bmp"
Dim mask As Picture = f.Parent.Child( maskName ).OpenAsPicture
if mask is nil then
Print "Unable to open " + maskName
return
end if
srcp.Mask.Graphics.DrawPicture mask, 0, 0
Dim outp As New Picture( srcp.Width, srcp.Height, 32 )
outp.Graphics.ForeColor = &cDEDED0
outp.Graphics.FillRect 0, 0, srcp.Width, srcp.Height
outp.Graphics.DrawPicture srcp, 0, 0
Dim qtex As QTGraphicsExporter = GetQTGraphicsExporter( "BMPf" )
qtex.OutputFileCreator = "GKON"
if qtex.SavePicture( f, outp ) then
Print "Saved picture to " + f.Name + "."
else
Print "Export failed."
end if
--
Joe Strout
Inspiring Applications, Inc.
http://www.InspiringApps.com
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|