Hey guys,
I hope you guys, got what am trying to do from that long subject!
I'm drawing an image (NSImage) in a rectangle. This rectangle is the Window or the View size.
Now the background image scales up based on the rectangle (which is based on the size of the view)
Now i need to scale the image on the view, based on the settings - 'Fill Screen', 'Fit to Screen', 'Stretch to Fill Screen', 'Center' and 'Tile'
Any ideas on how to go about this?
I did research and find that we can use the NSWorkspaceDesktopImageScalingKey scaling options. Here's the possible values from Apple documentation
NSImageScaleProportionallyDown
NSImageScaleAxesIndependently
NSImageScaleNone
NSImageScaleProportionallyUpOrDown
But i dont see how an NSimage can be drawn using these Scaling parameters? Any ideas?
I hope you guys, got what am trying to do from that long subject!
I'm drawing an image (NSImage) in a rectangle. This rectangle is the Window or the View size.
Code:
[backgroundImage drawInRect:rect
fromRect:NSMakeRect(0, 0, backgroundImage.size.width, backgroundImage.size.height)
operation:NSCompositeCopy
fraction:1.0f];
Now the background image scales up based on the rectangle (which is based on the size of the view)
Now i need to scale the image on the view, based on the settings - 'Fill Screen', 'Fit to Screen', 'Stretch to Fill Screen', 'Center' and 'Tile'
Any ideas on how to go about this?
I did research and find that we can use the NSWorkspaceDesktopImageScalingKey scaling options. Here's the possible values from Apple documentation
NSImageScaleProportionallyDown
NSImageScaleAxesIndependently
NSImageScaleNone
NSImageScaleProportionallyUpOrDown
But i dont see how an NSimage can be drawn using these Scaling parameters? Any ideas?
Last edited: