Re: NSImage question
Re: NSImage question
- Subject: Re: NSImage question
- From: James Chen <email@hidden>
- Date: Thu, 29 Mar 2007 17:04:45 +0800
- Thread-topic: NSImage question
Hi,
Any consideration to have a custom NSView.
Override the drawRect:. Draw your images with whatever scale/location you
want.
By doing so, you don't need extra NSImage as off-screen buffer no more.
Best Regards,
James Chen
Presentation Product Division
TEL: +886 2 22263630 ext 8538
FAX: +886 2 22267241
Mailto: email@hidden
http://www.avermedia.com
AVerMedia Technologies, Inc.
簡報產品事業單位: 陳銘崧
圓剛科技(股)公司
This message contains information that may be confidential and privileged.
Unless you are the addressee (or authorized to receive messages for the
addressee), you cannot use, copy or disclose to any third party or any
information contained in the message. If you have received the message in
error, please advise the sender by reply e-mail and delete the message.
Nothing in this message should be interpreted as a digital or electronic
signature that can be used to authenticate a contract or to other legal
document. Thank you very much.
> From: Jeff Laing <email@hidden>
> Date: Thu, 29 Mar 2007 10:11:13 +1000
> To: "'email@hidden'" <email@hidden>
> Subject: NSImage question
>
> I'm currently trying to come to grips with NSImage.
>
> I have an NSImageView that I want to display an NSImage which may be bigger
> or smaller than the view area - the image is created from RGBA data and I'm
> confident that its built correctly because I've successfully export it to
> .png, .gif, .jpg, .tiff and in each case the transparency information came
> through as expected.
>
> Now, I need to be able to scale the large NSImage's down to display them in
> my NSImageView. I can't just use the setImageScaling: on the image view, I
> want to have more than one of my NSImages with different scales, displayed
> simultaneously in the same NSImageView - think "thumbnail display", or
> "combined graphic preview page". I expect to create a new NSImage, draw 2
> or more scaled NSImages into it, then get the NSImageView to display the
> composite image.
>
> When I used drawInRect:fromRect:operation: to scale the images down I found
> gritty gray spots happening round the edges and I believe that they are
> caused by the way the scaling handles the alpha mask.
>
> When I use compositeToPoint:operation: the resulting image displays
> correctly, but of course is not scaled down.
>
> My best guess at the moment is:
>
> - image 1 is my RGBA data
> - create image 2 with the same size as image 1
> - fill image 2 with white
> - compositePoint:operation image 1 into image 2
> - create image 3 with the target size
> - drawInRect:fromRect:operation: image 2 into image 3
>
> This seems ludicrously expensive - is there a better way? Preferably 10.3
> compatible if possible?
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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