Welcome to Soft32 Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

NSBitMapImageRep gives error when copying existing image

 
   Soft32 Home -> Mac -> Programmer Help RSS
Next:  Prometric & Pearson VUE Exam Center - Cisco,M..  
Author Message
Simon Slavin

External


Since: May 16, 2004
Posts: 781



(Msg. 1) Posted: Fri Dec 26, 2008 9:20 am
Post subject: NSBitMapImageRep gives error when copying existing image
Archived from groups: comp>sys>mac>programmer>help (more info?)

[OS X 10.5.6. Xcode 3. All updates. No funny stuff.]

I'm getting the following error in my log

<Error>: CGBitmapContextCreate: unsupported parameter combination: 8
integer bits/component; 24 bits/pixel; 3-component colorspace;
kCGImageAlphaNone; 1536 bytes/row.

when I execute the last line of the following:

NSBitmapImageRep* showListRep = nil;
showListRep = [[[[leftImageView image] representations] objectAtIndex:0]
copy];

[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext
graphicsContextWithBitmapImageRep:showListRep]];


The 'leftImageView' in question is an NSView which has had an image
dragged into it from the Finder. I have tried it with two images
(generated by other people and working perfectly in all other situations)
and both give similar messages. In each case the maths makes sense.

I also tried making up my own image using 'initWithBitmapDataPlanes' and
got the same error when I used the same parameters. However, if I set it
to use 4 samples per pixel (even though I don't need Alpha for this) the
error went away.

If I understand this correctly, the complaint is that it can't use a 3-
component representation as a graphics context. If that's the case, how
come my programs can use these images for other image operations without
problems ?

My finished program doesn't need to work with and OS X < 10.4.

Simon.
--
http://www.hearsay.demon.co.uk
Back to top
Login to vote
Gregory Weston

External


Since: Mar 26, 2005
Posts: 3646



(Msg. 2) Posted: Sat Dec 27, 2008 1:58 pm
Post subject: Re: NSBitMapImageRep gives error when copying existing image [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Simon Slavin
wrote:

> [OS X 10.5.6. Xcode 3. All updates. No funny stuff.]
>
> I'm getting the following error in my log
>
> <Error>: CGBitmapContextCreate: unsupported parameter combination: 8
> integer bits/component; 24 bits/pixel; 3-component colorspace;
> kCGImageAlphaNone; 1536 bytes/row.


Only certain parameter combinations are supported.

<http://developer.apple.com/documentation/GraphicsImaging/Conceptual/draw
ingwithquartz2d/dq_context/chapter_3_section_4.html#//apple_ref/doc/uid/T
P30001066-CH203-BCIBHHBB>

> If I understand this correctly, the complaint is that it can't use a 3-
> component representation as a graphics context. If that's the case, how
> come my programs can use these images for other image operations without
> problems ?

Because those other operations aren't trying to create bitmap graphics
context from the same images along the way.

--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
- Harry Potter and the Odor of the Phoenix
Back to top
Login to vote
Simon Slavin

External


Since: Dec 28, 2008
Posts: 37



(Msg. 3) Posted: Mon Dec 29, 2008 1:20 am
Post subject: Re: NSBitMapImageRep gives error when copying existing image [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article
Gregory Weston
wrote:
> If that's the
>> case, how come my programs can use these images for other image
>> operations without problems ?

> Because those other operations aren't trying to create bitmap
> graphics  context from the same images along the way.

Okay, so some formats are supported for some operations and not
others.That hadn't occurred to me. Thanks.

Simon.

--
I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo
Back to top
Login to vote
Gregory Weston

External


Since: Mar 26, 2005
Posts: 3646



(Msg. 4) Posted: Mon Dec 29, 2008 2:17 am
Post subject: Re: NSBitMapImageRep gives error when copying existing image [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article ,
Simon Slavin wrote:

> In article
> Gregory Weston
> wrote:
> > If that's the
> >> case, how come my programs can use these images for other image
> >> operations without problems ?
>
> > Because those other operations aren't trying to create bitmap
> > graphics  context from the same images along the way.
>
> Okay, so some formats are supported for some operations and not
> others.That hadn't occurred to me. Thanks.
>
> Simon.

Well, to be fair the only operation you've discovered that supports some
pixel formats and not others is an explicit attempt to create a graphics
context mapped on top of the pixel buffer. Presumably anything else that
needs to do such a thing behind the scenes would create an interim
representation that conforms to the needs of CGBitmapContextCreate. Also
note that according to the link I provided the list of supported pixel
formats for this operation has approximately doubled in size over the
last two OS releases.

--
"Harry?" Ron's voice was a mere whisper. "Do you smell something ... burning?"
- Harry Potter and the Odor of the Phoenix
Back to top
Login to vote
Display posts from previous:   
Related Topics:
TIFF Image To Pre-Existing NSBitmapImageRep? - I have a TIFF image in my nib file's Images tab, and I can acquire that image and "composite" it into an NSIm...

NSBitmapImageRep and colour spaces - Assuming that I have an image, represented as an in-memory array of RGBA values, 16 bits per channel, in a known colour...

Obj-C/Cocoa: Capturing an NSWindow to an NSBitmapImageRep. - I've been going in circles with this one. I wonder if it's possible - of course it is! ;-) - to capture an..

adding existing files, greyed out ? - I want to add a ".h" file to my xcode project, but it is greyed out on the file selector dialog. FYI there i...

Attaching an NKE to Existing Sockets - I hope this is an appropriate place for this question; if not, if you have any good suggestions on where I might get an...

dlsym fails to find existing symbol - I am working with a program that loads libraries (*.dylib) dynamically via dlopen. When I ask the program to look for ...
       Soft32 Home -> Mac -> Programmer Help All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum

Categories:
 Windows
 Linux
  Mac
 PDA



[ Contact us | Terms of Service/Privacy Policy ]