Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Scaling an NSImage Smaller???

Scaling an NSImage Smaller???
Thread Tools
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Mar 21, 2002, 09:11 AM
 
Hello,

I've been using Rickster's recently-posted code to scale an NSImage. Everything works great as long as the new image is larger than the original image. But when I try to create a new image that's smaller, I get a seg-fault. Does anyone know why or have a work-around?

By the way, this occurs even if I init the new image at the same size as the old image. When I call the drawInRect method with destRect smaller than srcRect, it seg-faults.
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Mac Elite
Join Date: Feb 2001
Location: Vancouver, WA
Status: Offline
Reply With Quote
Mar 21, 2002, 02:38 PM
 
If you want to scale the whole image, you should be passing in NSZeroRect as the source rect, not calculating a rect with the source image's size. Perhaps that's the problem?

[ 03-21-2002: Message edited by: Rickster ]
Rick Roe
icons.cx | weblog
     
smeger  (op)
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Mar 21, 2002, 07:43 PM
 
Whoops, never mind. My problem was that I was initializing the original image using [NSBitmapImageRep initWithBitmapDataPlanes] and telling it to use my own pointer for the bitmap data. Then, I deallocated that pointer. Whoopsie...
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
   
Thread Tools
Forum Links
Forum 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
Top
Privacy Policy
All times are GMT -5. The time now is 12:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2