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 736125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:34:09+00:00 2026-05-14T07:34:09+00:00

im trying to combine two images into a single image. unfortunately this has to

  • 0

im trying to combine two images into a single image. unfortunately this has to be done very quickly in response to a user sliding a UISlider. i can combine the two images into a single image no problem. but the way I’m doing it is horribly slow. the sliders stick and jump rather frustratingly. i don’t think i can throw the code into a background thread because i would run out of threads to quickly. i haven’t actually tired that yet. below is my code. any ideas on how to speed it up would be helpful.

UIGraphicsBeginImageContext(CGSizeMake(bodyImage.theImage.image.size.width * 1.2, bodyImage.theImage.image.size.height * 1.2));

 [bodyImage.theImage.image drawInRect: 
  CGRectMake(-2 + ((bodyImage.theImage.image.size.width * 1.2) - bodyImage.theImage.image.size.width)/2, 
    kHeadAdjust, 
    bodyImage.theImage.image.size.width * bodyImage.currentScale, 
    bodyImage.theImage.image.size.height * bodyImage.currentScale)];

 if(isCustHead)
 {
  [Head.theImage.image drawInRect: CGRectMake((bodyImage.theImage.image.size.width * 1.2 - headWidth)/2 - 11,
             0, 
             headWidth * 0.92, 
             headWidth * (Head.theImage.image.size.height/Head.theImage.image.size.width) * 0.92)];
 }
 else 
 {
  [Head.theImage.image drawInRect: CGRectMake((bodyImage.theImage.image.size.width * 1.2 - (headWidth * defaultHeadAdjust))/2 - 10,
             0, 
             (headWidth * defaultHeadAdjust * 0.92), 
             (headWidth * defaultHeadAdjust) * (Head.theImage.image.size.height/Head.theImage.image.size.width) * 0.92)];
 }

 drawSurface.theImage.image = UIGraphicsGetImageFromCurrentImageContext();

 UIGraphicsEndImageContext();
  • 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-05-14T07:34:09+00:00Added an answer on May 14, 2026 at 7:34 am

    I don’t have a lot of time to answer, but one thing you’ll want to do is move your drawing to a NSOperation and use a performOnMainThread: to notify when done.

    Each time your slider moves, tell the NSOperationQueue to cancel it’s operations. That way if the user is sliding really fast, you’re not drawing only to immediately toss it away.

    When the perform is done, store the image in the NSOperation subclass you made, and pass that to the main thread, where you can apply the image to the layer contents.

    This will help your performance no matter how fast your code is, especially with spazztic users.

    For image rendering, you might want to consider making a custom offscreen bitmap and rendering into it. Also, try caching a lot of your math, especially if it is not changing much.

    The less you do, the faster it will go.

    Also remove any NSLog’s you might have, those really slow things down. I use a macro to NSLog only when a flag is set in a configuration (so I have a debug + log config)

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

Sidebar

Related Questions

I am trying to combine two images into one. This is the code I
I'm trying to combine info from two different logs into a single query, but
I am trying to combine the two into a single statment, I would even
I'm trying to combine two photos into one image (think a body with a
I'm trying to combine two .mp3s into a single .wav file using QTKit. It
Hello I am trying to combine two transparent png-24 images, both size 400width, 150height.
I have two PNGs that I am trying to combine into a PDF using
I've been trying to combine two XML documents like this: $def = new DOMDocument(
I am currently trying to combine two collections into one for binding to a
so i'm playing around with jquery isotope and trying to combine two options into

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.