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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:43:30+00:00 2026-06-10T08:43:30+00:00

I am building a drawing type tool into my app. It takes a touch

  • 0

I am building a drawing type tool into my app.

It takes a touch points from the user and draws lines between the points. If the user creates 3 touch points or greater, it joins the last point to the first point.

An extract of the code is :

startPoint = [[secondDotsArray objectAtIndex:i] CGPointValue];
    endPoint = [[secondDotsArray objectAtIndex:(i + 1)] CGPointValue];
    CGContextAddEllipseInRect(context,(CGRectMake ((endPoint.x - 5.7), (endPoint.y - 5.7)
                                                   , 9.0, 9.0)));
    CGContextDrawPath(context, kCGPathFill);
    CGContextMoveToPoint(context, startPoint.x, startPoint.y);
    CGContextAddLineToPoint(context, endPoint.x, endPoint.y);
    CGContextStrokePath(context);

I wish to “color in ” the area contained within these paths.
What should I look at?

  • 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-10T08:43:32+00:00Added an answer on June 10, 2026 at 8:43 am

    You need to use the CGContextFillPath API. You should be careful of how you define the path, though:

    • Start by calling CGContextMoveToPoint on the initial point
    • Proceed by drawing all segments except the closing one with CGContextAddLineToPoint
    • Close the path with CGContextClosePath. Do not add line to point on the final segment.

    The call of CGContextFillPath will produce a path colored with the fill color that you have previously set.

    Here is an example:

    CGPoint pt0 = startPoint = [[secondDotsArray objectAtIndex:0] CGPointValue];
    CGContextMoveToPoint(context, pt0.x, pt0.y);
    for (int i = 1 ; i < noOfDots ; i++) {
        CGPoint next = [[secondDotsArray objectAtIndex:i] CGPointValue];
        CGContextAddLineToPoint(context, next.x, next.y);
    }
    CGContextClosePath(context);
    CGContextFillPath(context);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an augmented reality app that takes frames from the camera, filters
I am building a C# app that creates many bitmaps (System.Drawing.Image). Having the bitmaps
I'm building a simple drawing app using the new Meteor.js app platform and paper.js.
I'm curious if that's possible? I'm interested in building a vector drawing app within
I'm building a System.Drawing.Bitmap in code from a byte array, and i'm not sure
I'm building an Android app that takes advantage of OpenGL. As it stands, the
i building a drawing app that uses openGl. i am new to openGL but
I am building a web-app that will users mark-up images by drawing on it
I'm building an application that is drawing an anaglyph (stereoimage) on 200 Hz screen
Building a Django app on a VPS. I am not very experienced with setting

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.