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

  • Home
  • SEARCH
  • 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 9004771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:58:24+00:00 2026-06-16T00:58:24+00:00

Hi i’m developing a VNC client app for iPhone (it’s for a school project)

  • 0

Hi i’m developing a VNC client app for iPhone (it’s for a school project) and I’m using the RFB protocol.

I’m at the point where I receive the matrix of pixels (with 32 bit per pixel) and I need to display them, but I need it to be fast and as a VNC client I need to update the image quickly when changes occur.

I tried with CGBitmapContextCreate and I’m able to create the image and display it but every time I need to update it I have to create a new image so it’s not a great solution.

I was wondering if there is something more useful or a better way to display my matrix of pixels.

  • 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-16T00:58:25+00:00Added an answer on June 16, 2026 at 12:58 am

    I assume your server sends partial updates, and doesn’t send a full screen snapshot on every update.

    The simple technique is to create one CGBitmapContext and keep it around. Update its data directly (using CGContextFillRect would be much slower) when you get new pixels and then create an image from it using CGBitmapContextCreateImage and assign that image to view.layer.contents. (Don’t forget to release the image after storing it in that property!)

    As you have discovered, though, you have to create a new image every time. Why? A CGImage is immutable. To enforce immutability, Core Graphics copies the pixel data to private storage when it creates a CGImage. Then when you display the image in a layer, iOS has to copy the pixel data again to the window server (which is a separate process). Copying a whole screen’s worth of pixel data is slow: you’re copying anywhere from 614 KB (iPhone 3GS and earlier) to 12.6 MB (Retina iPad) depending on the device.

    One way you can speed this up while still staying in the world of UIKit and Core Animation is to tile the screen with a grid of layers. Let’s say you tile it with layers that are each 64×64 pixels. You create a CGBitmapContext for each layer. Then, when you receive pixel data from the server, you update the data of the appropriate CGBitmapContexts and then update the contents of just the layers that need it. When just a small area of the screen changes, you will only update one or a few tiles, so you will copy much less data. At 64×64 pixels, you’re copying 16 KiB per tile. You may want to try a few different sizes to figure out what works best.

    If this still isn’t fast enough, you will need to leave the world of UIKit and Core Animation and use OpenGL ES. On iOS, OpenGL ES provides the most direct access to the video card that you are allowed to have unless your email address ends with @apple.com. You can create a texture with your pixel data, and draw two triangles (arranged to form a rectangle) with that texture, covering a CAEAGLLayer. When you get new pixel data, you can write it into the texture using glTexSubImage2D and redraw the triangles. If you haven’t done much OpenGL programming, this will be a pretty big effort.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're building an app, our first using Rails 3, and we're having to build
I am using Paperclip to handle profile photo uploads in my app. They upload
I am writing an app for my school newspaper, which is run completely online
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I don't have much knowledge about the IPv6 protocol, so sorry if the question

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.