Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9163843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:32:26+00:00 2026-06-17T14:32:26+00:00

I am currently working on a remote desktop type project, in particular I am

  • 0

I am currently working on a remote desktop type project, in particular I am trying to provide replacement code for the old depreceated methods that were used previously. I have managed this quite successfully, for the most part, but I seem to have reached a stumbling block.

As of OSX 10.7 the method call CGDisplayBaseAddress has been depreceated (1). Previously this gave me the base address of the framebuffer in memory, which was used elsewhere in order to see which parts of the screen had changed and to determine what needed to be sent to the remote display. Now it returns NULL.

My current solution has been to use CGDisplayCreateImage (2), which gives me an CGImageRef that I can then use to get a pointer to the raw data ( via a CFDataRef object – for code see below) for the image.

Is this the best way to do it? Surely their must be a better way of doing it!

To summarise : I dont want to do any drawing to the screen or anything I’m just trying to get a pointer to the first byte in memory that contains either the desktop framebuffer or ( as I’m currently doing) the image data.

Thanks for any help you can give! 🙂

Current solution code :

CFDataRef copy_image_pixels(CGImageRef inImage) {
    return CGDataProviderCopyData(CGImageGetDataProvider(inImage)); 
}

/**
 ret_byte_buffer is the byte buffer containing the pixel data for the image **/
void *getPixelDataForImage (CGImageRef image) 
{
    //Check image ref is not null
    if (!image){
        NSLog(@"Error - image was null");
        return -1;
    }

    //Gets a CFData reference for the specified image reference
    CFDataRef pixelData = copy_image_pixels(image);
    //Gets a readonly pointer to the image data
    const UInt8 *pointerToData = CFDataGetBytePtr(pixelData); //This returns a read only version
    //Casting to a void pointer to return, expected to be cast to a byte_t *
    CFIndex length_of_buffer = CFDataGetLength(pixelData);
    printf("Size of buffer is %zu\n",length_of_buffer);
    return (void *)pointerToData;

}

code snippet for getting the CGImageRef –

osx_disp= main_screen_details->main_screenid; //Returns CGDirectDisplayID
CGImageRef screenShot = CGDisplayCreateImage(osx_disp);
byte_t *image_byte_data = getPixelDataForImage(screenShot);

byte_t is typedef’d to be a unsigned char

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T14:32:27+00:00Added an answer on June 17, 2026 at 2:32 pm

    From my research it seems that you do no need access to the framebuffer anymore.

    They way I have done it above may not be the best way but it certainly works for what I need it to do 🙂

    Previously you would have to lock the display do what you wanted to do with it then release it, which could sometimes lead to screen flicker as you released the screen.

    The new way, via creating the image, means you do not have to deal with any of that just create the image and your golden 🙂

    One thing I would add to my existing code is that you must remember to free the CGImageRef or its a MAJOR memory leak.

    In order to do this just call :

    CFRelease(screenShot);
    

    We also need to release the pixelData object in the same way.

    CFRelease(pixelData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on my first rails project. I am trying to make a
I am currently working on a project where remote users will have their own
I am currently working on code that serializes in one app (C++) and needs
I am currently working on a WordPress project on a remote IIS server. I
I am currently working on a project that contains a WCF service, a Windows
I currently have a django project that I am working on. The project is
Currently working with converting SQLException error messages into messages that are more useful for
Currently working with NSURLConnection. Found a great website showing important delegate methods coming with
Im currently working on a game that uses multi touch to apply zoom to
Am currently working on an application that requires users to submit posts and comments

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.