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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:44:44+00:00 2026-05-27T00:44:44+00:00

I am using quartz 2d to draw a pie chart. I use layer to

  • 0

I am using quartz 2d to draw a pie chart.

I use layer to draw a reflection of the pie chart on the bottom.

I would like to add a transparent alpha gradient to the reflection to make the it more and more transparent until it gets invisible.

Someone has an idea ?

@EDIT : more details
My pie chart is in a CGLayerRef.

I first draw this layer to the CGContextRef.
Then I do a

CGContextTranslateCTM(context, 0, rect.size.height);
CGContextScaleCTM(context, 1.0, -1.0);

To be upside down.

Then i draw my layer a new time

Thanks in advance,

Loic

  • 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-27T00:44:44+00:00Added an answer on May 27, 2026 at 12:44 am

    You need to use an image mask. You can make the mask by drawing a gradient into a bitmap context:

    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray();
    CGContextRef gc = CGBitmapContextCreate(NULL, rect.size.width, rect.size.height, 8, rect.size.width, colorSpace, kCGImageAlphaNone);
    CGGradientRef gradient = CGGradientCreateWithColors(colorSpace, (__bridge CFArrayRef)[NSArray arrayWithObjects:(__bridge id)[UIColor whiteColor].CGColor, (__bridge id)[UIColor blackColor].CGColor, nil], NULL);
    CGColorSpaceRelease(colorSpace);
    CGContextDrawLinearGradient(gc, gradient, CGPointMake(0, 0), CGPointMake(0, rect.size.height), 0);
    CGGradientRelease(gradient);
    CGImageRef mask = CGBitmapContextCreateImage(gc);
    CGContextRelease(gc);
    

    (Remove __bridge if you’re not using ARC.)

    Then you can use the mask before drawing the image:

    CGContextTranslateCTM(context, 0, rect.size.height);
    CGContextScaleCTM(context, 1.0, -1.0);
    CGContextClipToMask(context, rect, mask);
    

    Don’t forget to release the mask after you’re done.

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

Sidebar

Related Questions

I have been trying to write an image on a layer using Quartz but
I am trying to draw a string using quartz 2d. What i am doing
I have to draw a line between two points using quartz. At some point
I would like to animate a radial gradient to shrink and grow the inner
I want to draw some texts using Quartz. Now the app draws , but
i want to draw a line in core graphics in iphone.I am using Quartz
My end goal is to draw a report that looks like MS Word using
Using Quartz.NET it seems like I need to name every job I create. Is
I am using Quartz.NET, and my scheduler relies heavily on the use of cron
I am using quartz.net to schedule regular events within asp.net mvc application. The scheduled

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.