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



Thanks for your response.

As you may have guessed, the HIViewRef/CGContextRef confusion was just
a mistake in summarizing my own code for my previous email; also the
CGContextBeginPage/CGContextEndPage was a vestigial artifact of the
random things I was trying.  I also said my bitmap bits were
untouched; I meant to say that I was getting just an all-white bitmap.
Such is the peril of writing a technical email at 1:30 AM.

Unfortunately, I still have the same problem when I replace my code
with the two functions provided in link: an all-white bitmap (255 255
255 ...) instead of the window's contents.

I might suspect the window needs to be marked as dirty right before
the blit, but as I mentioned earlier I've tried calling various
updating/dirtying functions as well as sending update/draw events, all
without effect.

-jeff

--- David Duncan <email@hidden> wrote:

> 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
> 
> 



 
____________________________________________________________________________________
TV dinner still cooling? 
Check out "Tonight's Picks" on Yahoo! TV.
http://tv.yahoo.com/
 _______________________________________________
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: 
 >Re: Bilt HIView to Offscreen bitmap (From: David Duncan <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.