radio button contrast
radio button contrast
- Subject: radio button contrast
- From: "J.E. Schotsman" <email@hidden>
- Date: Mon, 05 Dec 2016 17:23:33 +0100
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 (email@hidden)
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:
This email sent to email@hidden