I’ve wondering how this can be archived and started looking in the internet for cocoa sources. The way to go was a bit
different for the cocoa code but I’ve also found a simple answer in the realforum to use a picture with mask and so I’ve
developed a sample around showing the usage of a rounded box filled with a gradient and I thought I should share.
Maybe it’s a BOF for the professional among us but for some beginners it could be of help. You can remove the Cocoa
NSGradient/NSContextPort stuff and have REALBasic do the calculations to make it cross plattform.
Please share your thoughts re the code or approach leave post kudos for me
As you’re digging into declares, look into creating a path on a CGContext, then clipping the context to that path, then drawing your CGGradient . As you’re working with CGContexts already, it’s quicker than a NSGradient.
Core Graphics is a wonderful toolkit, very vast, but wonderful.
I don’t have any sample code to hand at the moment for doing this, it would take me a wee while to generate it specifically for you. Instead as you’re already playing with declares take a look at this document and do some searching on using CoreGraphics with Xojo.