Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > Mac OS X Development Forums > Mac OS X Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-04-2011, 06:24 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Location: Texas
Posts: 20
daltonclaybrook is on a distinguished road
Post NSImage and NSImageView problem

I have a PNG image file that I would like to display inside an NSImageView that is literally 3px x 3px. It's tiny. I would like for the NSImageView to scale the image to fit inside the whole view, but it seems that either the NSImage or the NSImageView attempts to improve the resolution of my image, and I would prefer to display it using the image's native resolution.

This is how I would like the image to appear:


and this is how it displays the image currently:
daltonclaybrook is offline   Reply With Quote
Old 06-05-2011, 07:41 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

NSImageView has a setImageScaling method:

The possible values for this parameter are:

NSScaleProportionally. If the image is too large, it shrinks to fit inside the frame. The proportions of the image are preserved. The image is never scaled up to fit a larger frame.

NSScaleToFit. The image shrinks or expands, and its proportions distort, until it exactly fits the frame.

NSScaleNone. The size and proportions of the image don’t change. If the frame is too small to display the whole image, the edges of the image are trimmed off.
harrytheshark is offline   Reply With Quote
Old 06-12-2011, 04:28 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2011
Location: Texas
Posts: 20
daltonclaybrook is on a distinguished road
Default

Quote:
Originally Posted by harrytheshark View Post
NSImageView has a setImageScaling method:

The possible values for this parameter are:

NSScaleProportionally. If the image is too large, it shrinks to fit inside the frame. The proportions of the image are preserved. The image is never scaled up to fit a larger frame.

NSScaleToFit. The image shrinks or expands, and its proportions distort, until it exactly fits the frame.

NSScaleNone. The size and proportions of the image don’t change. If the frame is too small to display the whole image, the edges of the image are trimmed off.
None of those fix my issue.
daltonclaybrook is offline   Reply With Quote
Old 06-12-2011, 04:32 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2008
Location: UK
Posts: 1,896
harrytheshark is on a distinguished road
Default

You could have a go at resizing the image itself, then, before adding it to the NSImageView.
harrytheshark is offline   Reply With Quote
Reply

Bookmarks

Tags
nsimage, nsimageview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 375
9 members and 366 guests
Creativ, Emy, husthlj, illogical, LegionMD, LunarMoon, Murphy, padsoftware, stanny
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,677
Threads: 94,127
Posts: 402,916
Top Poster: BrianSlick (7,990)
Welcome to our newest member, husthlj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:15 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0