erase then draw image?
erase then draw image?
- Subject: erase then draw image?
- From: matt neuburg <email@hidden>
- Date: Wed, 23 Oct 2002 18:23:42 -0700
On Wed, 16 Oct 2002 11:30:29 -0700, I <email@hidden> said:
>
I'm trying to do something very simple - draw a watermark
>
(some transparent text, slightly rotated) into an NSView.
>
>
My approach is to set up the text beforehand by drawing it
>
into an NSImage. My NSView's coordinate system is slightly
>
rotated. In my NSView's drawRect I then say simply:
>
>
[image drawInRect: dest fromRect: wholeThing operation:
>
NSCompositeSourceOver fraction:0.2];
>
>
This works great except that every time drawInRect is
>
called, my watermark gets darker and darker until finally
>
it is opaque. It seems what I need to do is somehow flush
>
or clear my NSView each time before I draw. But I can't
>
find a command to do this: NSEraseRect fills it with
>
white; drawing with clearColor fills it with black! How do
>
I do it?
I never got an answer to this. I ended up doing it a completely different way - using NSGraphicsContext, NSAffineTransform (to do the rotation), and a transparent text color. But this does not explain, and I do not understand, why my first way cannot be made to work. m.
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.