Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solved - Re: A Tail of Two Bitmaps



Okay. I'm embarrassed.

I found MY bug.

The structure I was using to initialize the dataProvider had a bug where the size of the allocated block was never set. Yes, embarrassed am I.

With the dataProvider properly created, the image works perfectly.

Mark



On 31-May-05, at 15:04, Scott Thompson wrote:


On May 31, 2005, at 3:03 PM, Mark Morrill wrote:

Hi,

I'm wanting to create a CGImageRef from a CGBitmapContextRef - which is pretty straight forward. However, I'm having a bit of a problem...

I want to use an alpha channel but I'm only getting good results by not using an alpha channel.

Basically I'm doing this:

CGContextRef context = ::CGBitmapContextCreate( ... basic info..., theAlphaInfo );
CGImageRef image = ::CGImageCreate( ... basic info from context ...,
dataProvider, null, true,
kCGRenderingIntentDefault );


The "basic info" is block of data that assumes 32 bits per pixel. The colorspace is CGColorSpaceCreateDeviceRGB


The "basic info from context" are the CGBitmapContextGet... calls. The dataProvider is created with the block of data used to create the context.


Have you verified that the values returned by CGBitmapContextGet... are returning the same values you used to create the context? (seems they should be... but maybe there is a bug there?)


It might help if you went ahead and expanded ...basic info... and ...basic info from context... to actual code.

When theAlphaInfo is kCGImageAlphaPremultipliedFirst (or last), drawing the image into a context with a size other than the image's size will sometimes produce garbage on the screen, sometimes it will produce results that suggest that the row bytes is wrong.

When theAlphaInfo is kCGImageAlphaNoneSkipLast (32bits per pixel), the drawing lacks the alpha channel but it always draws right.

Where is the image buffer comming from? Is it a buffer you have created yourself (e.g. with malloc) or is it potentially a QuickDraw GWorld.



_______________________________________________ Do not post admin requests to the list. They will be ignored. Quartz-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartz-dev/email@hidden

This email sent to email@hidden
References: 
 >A Tail of Two Bitmaps (From: Mark Morrill <email@hidden>)
 >Re: A Tail of Two Bitmaps (From: Scott Thompson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.