Fwd: Fw: NSBitmapImageRep bitmapData and 16 bits per sample
Fwd: Fw: NSBitmapImageRep bitmapData and 16 bits per sample
- Subject: Fwd: Fw: NSBitmapImageRep bitmapData and 16 bits per sample
- From: Marco Binder <email@hidden>
- Date: Sun, 8 Jun 2003 18:31:14 +0200
>
Hello Cocoa gurus,
may I still answer?
>
My app needs to read a 16-bits image, process it and create a 16-bits
>
image from the
>
processed data.
There is no problem in using 16-bit images with an NSBitmapImageRep. I
do not really understand your problem, could you provide some more
detail? How do you read the 16-bit original images? Do I get it right:
you read in the image, then you get the pointer to the bitmapData and
then you see that every other byte is unused? This would be really
strange and in fact, i never experienced that. I guess you have to show
us your code then...
>
Is there a way to access pixel values without using the
>
[NSBitmapImageRep
>
bitmapData] method? If not, what should I do to be able to access
>
pixel values in
>
16bits format? Or should I rather use Quick Time API for 16-bits
>
images?
Dont think so. But it all that u need anyway: you get the address of
the place in memory where your bitmap resides! What you do with it
depends on you...
>
I guess that the problem is that I'm using the method
>
[NSBitmapImageRep bitmapData] to
>
get a pointer I can work with to set the pixel values. This method
>
returns a pointer in the
>
format unsigned char whereas I would need an unsigned short to create
>
16 bps values.
>
ahem... dont care about the type! You can simply access the two bytes
separatly: the first char*256 plus the second char is your total value
(I am not really good at bitwise operations, but something like
unsigned short red_value = ((unsigned short)char1<<8)|(unsigned
short)char2 should do the job).
You can probably also simply cast the pointer to (unsigned short*) if
you are sure, short will always be 16 bit.
Greetings,
Marco
--
|\ /| email@hidden
http://www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
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.