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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T14:49:54+00:00 2026-05-30T14:49:54+00:00

No doubt this might be a duplicate question but I am not able to

  • 0

No doubt this might be a duplicate question but I am not able to get proper solution from any post here. So I am posting this as new post with a hope that I get some solution.

I my drawing app I want to give a feature of opacity for lines to be drawn.
But when I assign alpha to color, I am getting overlapped points in between the line.

Some where I found that drawing in two views solves this issue, but I was not able to understand the logic behind that.

enter image description here

I am using normal quartz 2d code to draw line on touch events.

  • 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-30T14:49:55+00:00Added an answer on May 30, 2026 at 2:49 pm

    Hie..

    This is my final solution..
    I am now drawing lines on drawRect event and drawing the entire line at a time as a path..
    This creates opacity to retain and now no line caps drawn in between..

    No doubt this is the trick that is working since I am drawing on every touch and this works..

    - (void)drawRect:(CGRect)rect {
    for (int j=0; j<[pathArray count]; j++) 
    {
        context = UIGraphicsGetCurrentContext();
        NSMutableDictionary *tmp=[pathArray objectAtIndex:j];
        NSMutableArray *currentPath=[tmp objectForKey:@"path"];
        for (int i=0; i<[currentPath count]; i++) 
        {
            CGPoint mid1 = [[self midPoint:[currentPath objectAtIndex:i+1]  :[currentPath objectAtIndex:i]] CGPointValue]; 
            CGPoint mid2 = [[self midPoint:[currentPath objectAtIndex:i+2] :[currentPath objectAtIndex:i+1]] CGPointValue];
            CGContextMoveToPoint(context, mid1.x, mid1.y);
            CGContextAddQuadCurveToPoint(context, [[currentPath objectAtIndex:i+1] CGPointValue].x, [[currentPath objectAtIndex:i+1] CGPointValue].y, mid2.x, mid2.y); 
            CGContextSetShadow(context, CGSizeMake(-2, -2), 3);
            CGContextSetAlpha(context, [[tmp objectForKey: @"opacity"] floatValue]);    
            CGContextSetLineCap(context, kCGLineCapRound);
            CGContextSetStrokeColorWithColor(context,[[tmp objectForKey: @"Color"] CGColor]);               
            CGContextSetLineWidth(context, [[tmp objectForKey: @"width"] floatValue]);              
            i+=2;
        }   
        CGContextStrokePath(context);
    
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No doubt elements of this question have been asked before, but I'm having trouble
This is no doubt another noobish question, but I'll ask it anyways: I have
I am new to c++ so this doubt might look basic but I am
So this will no doubt come as a stupid question from an ignorant person,
I doubt I am the only one who has come up with this solution,
Using AppEngine datastore, but this might be agnostic, no idea. Assume a database entity
I know this might be a no-brainer, but please read on. I also know
Upon pre-submission review, I realize this question might be incredibly silly. if (this.gameOver(gpos) >
I doubt this is possible but what I would like to do is have
This might be simple for seasoned java developers but I just cant seem to

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.