Hello, I intend to increase contrast of inactive radio buttons a little because they are hardly legible. The idea is to draw to a bitmap, increase contrast, draw to screen. To my surprise this already increases contrast without any manipulation of the bitmap. What is going on here?
class MyRadioButton:NSButton { override init( frame frameRect: NSRect ) { super.init( frame:frameRect ) setButtonType(.RadioButton) } required init?( coder:NSCoder ) { super.init( coder:coder ) } override var flipped:Bool { return false } var bitmapContext:NSGraphicsContext! var bitmap:NSBitmapImageRep! override func drawRect( dirtyRect: NSRect ) { if bitmapContext == nil {/*create bitmap and bitmapContext*/} let savedContext = NSGraphicsContext.currentContext() NSGraphicsContext.setCurrentContext( bitmapContext ) super.drawRect( dirtyRect ) // increase contrast in bitmap let dirtyRectImage = CGImageCreateWithImageInRect( bitmap.CGImage, dirtyRect ) NSGraphicsContext.setCurrentContext( savedContext! ) CGContextDrawImage( savedContext!.CGContext, dirtyRect, dirtyRectImage ) } } _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com