simulating drawing of the NSImageCell frame
simulating drawing of the NSImageCell frame
- Subject: simulating drawing of the NSImageCell frame
- From: Shaun Wexler <email@hidden>
- Date: Fri, 24 Jan 2003 01:06:54 -0800
Hello,
Does anyone have an efficient way to draw the gray bezeled theme frame
from an NSImageCell? I'm using CG, so it's not entirely feasible to
create a cell instance just to draw it's background into my offscreen
CGImage, which in itself becomes tricky. Here's how I am currently
doing it:
Create CGImage and CGBitmapContext to match window's context attributes
Fill background with ARGB { 1.0, 0.95, 0.95, 0.95 }
Fill four 6x6 rects with the window background pattern in each corner
Stroke a round-rect path for outer black border
Stroke a round-rect path for frame's white center
Set clip path to a round-rect path for inner border, and stroke it
Draw drop shadow using CG's private API
I tried to build the shadows with additional paths, but it was too
cumbersome and didn't look as good. It's triple buffered, since I'm
drawing this (plus lines, text and more) into the cache image and
blitting from it to update behind dynamic drawing that is outside of
the view hierarchy, all from a FIFO queued background drawing thread.
I'm just looking for better performance during live resize on models
with slower hardware.
Thanks!
--
Shaun Wexler
MacFOH
http://www.macfoh.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.