Am 30.05.2013 um 12:37 schrieb Beatrix Willius <[email protected]>:
> Hi,
>
> how do I draw an icon with a mask using the following code directly from the
> documentation:
I will add a CopyPictureWithMask method, so this nice method will work with
next prerelease:
Function GetIcon(f as folderitem, w as integer, h as integer, WantAlphaPicture
as Boolean = false) As picture
const DrawNormal=0
const DrawNoImage=2
const DrawNoMask=4
const DrawSelected=&h8000
// get icon
dim i as new iconmbs(f)
if i.Valid then
if TargetCocoa and WantAlphaPicture then
// Cocoa only: Make Picture with alpha channel
dim p as new Picture(w, h)
dim c as CGBitmapContextMBS = CGBitmapContextMBS.CreateWithPicture(p)
c.ClearRect CGMakeRectMBS(0,0,w,h)
// draw icon
i.DrawIconCGContext(c.Handle, 0,0,w,h,0,0,DrawNormal,&c000000)
c.Flush
Return p
end if
// Cocoa or Carbon: Make Picture with mask
// make bitmap context
dim c as new CGPictureContextMBS(w,h)
c.ClearRect CGMakeRectMBS(0,0,w,h)
// draw icon
i.DrawIconCGContext(c.Handle, 0,0,w,h,0,0,DrawNormal,&c000000)
c.Flush
// and copy to picture
Return c.CopyPictureWithMask
end if
End Function
Greetings
Christian
--
MBS Xojo Developer Conference 2013
More details and registration here:
http://www.monkeybreadsoftware.de/realbasic/events/
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info