Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Darken image



hmm... i cut/pasted from my nsview drawrect method... so it should work fine... let me cons up a more complete example... hang on.


On Thursday, July 19, 2001, at 03:18 PM, Andreas Monitzer wrote:

On Thursday, July 19, 2001, at 11:12 , Tom Waters wrote:

Here's how I do it in FileView (one of the many "everybody else" apps)

You need to make a copy of the image, using NSCompositeCopy, then do a rectFill over the top of it using semi-transparent black (or any other color if you want to tint it) using NSCompositeSourceAtop, then use that copy of the image just as you would the original.

Here's my code with some other stuff hacked out of it, but I think it should still compile. (note that I cache that image alloc/init in a singleton, but i just left it in here to make the example simpler)

Hm... using your example, the image looks pretty well when used for NSView'
s dragImage:at:offset:event:pasteboard:source:slideBack:, but draws a black background when used in NSView's drawRect:. Looks pretty strange to me, where's the difference?

andy
--
"He was addicted to life. But we cured him"


References: 
 >Re: Darken image (From: Andreas Monitzer <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.