Mailing Lists: Apple Mailing Lists

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

Re: Bilt HIView to Offscreen bitmap



On Mar 12, 2007, at 10:35 PM, Jeff Sparks wrote:

        HIViewRef context = CGBitmapContextCreate(
            my_surface.bits,
            my_surface.width,
            my_surface.height,
            8,
            my_surface.pitch,
            CGImageGetColorSpace(image),
            CGImageGetBitmapInfo(image)) ;

Two things here
1) CGBitmapContextCreate returns a CGContextRef, not an HIViewRef.
2) You generally can't pass the results of CGImageGetBitmapInfo directly to CGBitmapContextCreate as images can have some bitmap info that is invalid for a CGContext, so you may want to check that CGBitmapContextCreate isn't returning NULL.


To see one way of dealing with this, check out Q&A 1509 Getting the pixel data from a CGImage object
<http://developer.apple.com/qa/qa2007/qa1509.html>


        CGContextBeginPage(context, &bounds) ;
        CGContextDrawImage(context, bounds, image) ;
        CGContextEndPage(context) ;

I'm not certain exactly why your using CGContextBegin/EndPage but it shouldn't be necessary here.
--
Reality is what, when you stop believing in it, doesn't go away.
Failure is not an option. It is a privilege reserved for those who try.


David Duncan

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

This email sent to email@hidden
References: 
 >Bilt HIView to Offscreen bitmap (From: Jeff Sparks <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.