New topic: Drawing disabled icon
<http://forums.realsoftware.com/viewtopic.php?t=44836> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message shaosean Post subject: Drawing disabled iconPosted: Thu Jul 26, 2012 1:12 am Joined: Mon Aug 15, 2011 10:25 pm Posts: 144 I know there is code kicking around for drawing an icon in a disabled state using the old mask part of a picture object, but here is what I am using with the new alpha channel feature.. this code is taken from the "2011r4 Alpha Channel Support.txt" file included with the IDE and will convert an old picture object to a new picture object with alpha channel Function ModernizePicture(input as Picture) as Picture if input.hasAlphaChannel then return input dim result as new Picture( input.width, input.height ) result.graphics.drawPicture( input, 0, 0 ) return result End Function this code will draw the picture with 50% transparency giving it a disabled (dimmed) look.. Function GetDisabledImage(pImage As Picture) As Picture if (pImage <> NIL) then DIM tPicture As NEW Picture(pImage.Width, pImage.Height) tPicture.Graphics.Transparency = 50.0 tPicture.Graphics.DrawPicture ModernizePicture(pImage), 0, 0, pImage.Width, pImage.Height Return tPicture end if End Function I am sure many others have already figured this out, but I was unable to find any sample code with the new alpha channel feature, so thought I would share and hopefully save someone a few minutes (or hours) Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
