Help, ugly compositing...
Help, ugly compositing...
- Subject: Help, ugly compositing...
- From: Alexander Griekspoor <email@hidden>
- Date: Tue, 3 Feb 2004 01:31:24 +0100
Hi guys,
As always I turn to this list endless experience and knowledge ;-)
Two questions. First, I have a problem after rewriting my drawrect
method in my custom view. Instead of drawing 3 components again and
again, I decided to split them up and cache each individual component
in the form of an NSImage. In my drawrect method, I then simply draw
the 3 images on top of each other. This got me to a 450% speed
increase, not bad ;-). The problem is that it all doesn't look so
pretty anymore, it looks ok, but good be better. I have put an
screenshot on our site:
http://www.mekentosj.com/compositingproblem.jpg
In the upper half you see how it was before, in the lower half how it
looks now. Especially, the gray letters have turned thinner. I suspect
some antialiasing or compositing problem/setting, but it's not clear to
me.
Briefly, what I do is create the cachedImage by locking focus on a new
nsimage instance and simply call the drawroutine to draw on it, next in
drawrect, these are the methods to composite the whole:
[graphCache compositeToPoint: rect.origin fromRect: rect operation:
NSCompositeCopy];
[topCache compositeToPoint: rect.origin fromRect: rect operation:
NSCompositeSourceOver];
I guess something is lost in the NSCompositeSourceOver, so if someone
knows why, or a better way, I'll be happy to hear how. (BTW if I use
NSCompositeCopy in the second line, it seems fine, but of course I
don't see the first image).
Secondly, does anyone what would be the fastest, compositeToPoint, or
drawAtPoint, to draw an NSImage in my custom view? Both methods seem
very alike, but what's the difference behind the scenes?
Many thanks in advance!
Alex
*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
E-mail: email@hidden
Web:
http://www.mekentosj.com
LabAssistant - Get your life organized!
http://www.mekentosj.com/labassistant
*********************************************************
*********************************************************
** Alexander Griekspoor **
*********************************************************
The Netherlands Cancer Institute
Department of Tumorbiology (H4)
Plesmanlaan 121, 1066 CX, Amsterdam
Tel: + 31 20 - 512 2023
Fax: + 31 20 - 512 2029
E-mail: email@hidden
Web:
http://www.mekentosj.com
Claiming that the Macintosh is inferior to Windows
because most people use Windows, is like saying
that all other restaurants serve food that is
inferior to McDonalds
*********************************************************
_______________________________________________
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.