Mailing Lists: Apple Mailing Lists

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

Bilt HIView to Offscreen bitmap



Hello,

After much googling and compiling, I've still not been able to blit
the contents of an HIView into a bitmap.  My code looks roughly like
this:

        // HIViewRef window is an 800x600 window

        HIViewRef content_view ;
        HIViewFindByID(
            HIViewGetRoot(window),
            kHIViewWindowContentID,
            &content_view) ;

        HIRect bounds ;
        bounds.origin.x = 0 ;
        bounds.origin.y = 0 ;
        bounds.size.width = 800 ;
        bounds.size.height = 600 ;

        CGImageRef image ;
        HIViewCreateOffscreenImage(
            content_view,
            0,
            &bounds,
            &image) ;
        
        //
        // my_surface is my own struct for offscreen bits
        //
        HIViewRef context = CGBitmapContextCreate(
            my_surface.bits,
            my_surface.width,
            my_surface.height,
            8,
            my_surface.pitch,
            CGImageGetColorSpace(image),
            CGImageGetBitmapInfo(image)) ;

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

Everything runs fine except that my_surface.bits is untouched.  My
test code is based on /Developer/Examples/WebKit/SimpleCarbonWeb; the
window is a simple web page.  The page loads fine, I see images, etc,
so I am sure that things are being initialized properly.  The above is
called well after everything has loaded.

Flailing around in the dark, I've tried calling various functions such
as HIViewSetNeedsDisplay(), sending kEventWindowUpdate,
kEventWindowDrawContent, kEventWindowDrawFrame events to the window's
event target, etc, all to no avail.

Any help would be appreciated.
-Jeff



 
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform=120121
 _______________________________________________
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



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.