Re: invertrect, any cocoa versions suggested?
Re: invertrect, any cocoa versions suggested?
- Subject: Re: invertrect, any cocoa versions suggested?
- From: Robert Dell <email@hidden>
- Date: Tue, 24 Jan 2006 18:38:11 -0500
Ricky Sharp wrote:
On Monday, January 23, 2006, at 10:42PM, Robert Dell <email@hidden> wrote:
yes, i actually need to invert the color pixels within the rectangle.
if i had access to the actual pixels, i could invert them myself (although that wouldn't be the fastest way) one pixel at a time.
Just what kind of speed do you need? I use direct pixel access of an NSBitmapImageRep and perform convert-to-grayscale (NTSC weighted algorithm) of 1024x768 images. On a dual 2GHz G5, it's only a few microseconds.
i'd like to see the code you used for that.
i also need to read and set individual pixels the same way getcpixel and setcpixel did.
Those two routines were the slowest method of getting/setting pixel data. You could easily create your own wrappers that would involve direct pixel access.
Nothing i've searched on the web, apple's site, or the frameworks gives me any indication of what i'm trying to do. the closest thing i can come up with is coreimage but i'm unsure on how it works and it can't invert the color data.
Depending on your speed needs, CI may not be the best. I had thought of using CI to do my grayscale effect. However, since both my input and output needed to be an NSBitmapImageRep, I'd spend too much time copying image data around to convert to/from formats needed by CI. So, at a Tiger Tech talk, an Apple engineer proposed I stick with the direct pixel access approach.
implementing an apple2 hi-res graphics screen is the main thrust for this program segment. more specifically, the apple pascal's turtlegraphics routines in their entirety (other than textmode and grafmode procedures) for script programmers.
Hmm...how do you plan (if at all) to support anti-aliasing? If you're doing a simple drawing app, why not just draw with NSBezierPath?
everything i read about nsbezierpath says it's for drawing closed items such as rectnngles, squares, circles. etc... something that closes up. i'm drawing open things.
also for somebody to create graphics in a text only script and then have my drawblock routine convert the text to color pixels (if it's a space it's black, if it's a number then it's a user color, if it's anything else it's white... and all that gets mixed with the background with 16 modes)
mode: meaning:
0 ignore bit pattern (color = black)
1 logical NOR with screen
2 logical AND with screen complement
3 screen complement
4 logical AND complement with screen
5 complement
6 logical XOR with screen
7 logical NAND with screen
8 logical AND with screen
9 equivilance
10 direct copy
11 logical OR with screen complement
12 screen replacement
13 logical OR complement with screen
14 logical OR with screen
15 ignore bit pattern (color = white)
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden