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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:37:32+00:00 2026-06-06T21:37:32+00:00

I have been looking far and wide for the answer. I’m still coming up

  • 0

I have been looking far and wide for the answer. I’m still coming up to speed on iOS dev, so I can definitely accept that I may be clooless here. However, the complete and utter lack of answers out there makes me wonder if there actually is an answer.

Here’s the deal: I am using a CGLayer to generate a fairly basic vector polygon:

- (CGLayerRef)getASegment
{
    CGSize  layerSize = s_viewRects[kASegment].size;

    CGLayerRef  theLayer = CGLayerCreateWithContext ( UIGraphicsGetCurrentContext(),
        layerSize, nil );

    CGContextRef context = CGLayerGetContext ( theLayer );

    CGContextAddLines ( context, s_shapePoints, 7 );

    return theLayer;
}

s_viewRects is a static array that holds the container rects, as placed in the overall image, and s_shapePoints contains an array of CGPoint structs that maps out a distorted hexagon.

Now, I want to re-use this shape. It needs to be flipped and rotated in order to fit all the uses (for the record, these are “segments” in an “LED” display).

I get the shape fine. No problem.

The problem is in rotating it for re-use. There doesn’t seem to be any way to actually rotate a CGLayer. Lots of ways to rotate CALayers, but not CGLayers. I’d be happy to use a CALayer, except that CALayers seem to be all focused on raster graphics, and I need vector graphics.

I’m sure there must be an obvious way to address this. The only way that I have seen, so far, is to rotate the entire target graphics context, draw the shape, then un-rotate the context. The equivalent of turning the house to unscrew a lightbulb.

The only way that I can get it to work, is to actually transform the points before drawing each segment separately, which means no re-use. Doing a CGContextRotateCTM during the creation of the shape does not actually result in a rotated element when displayed.

Any clues?

  • 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-06T21:37:33+00:00Added an answer on June 6, 2026 at 9:37 pm

    The only way that I have seen, so far, is to rotate the entire target graphics context, draw the shape, then un-rotate the context. The equivalent of turning the house to unscrew a lightbulb.

    I’m pretty certain that is your solution. It’s how drawing with CGContextRef works.

    I’d be happy to use a CALayer, except that CALayers seem to be all focused on raster graphics, and I need vector graphics.

    Have you tried using a CAShapeLayer?

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

Sidebar

Related Questions

I have been looking everywhere for this answer. I can't find any solution. I
I have been looking at creating a circular menu and so far, I can
I have been looking for a SSO system. So far I have found CAS.
I have been looking into backbone.js and I can't seem to figure out how
I have been looking for an answer to this on Stack Overflow, but I
I have been looking at protobuf-net recently and protocol buffers and so far it
So I have been looking every where, and so far i haven't been able
I have been looking around to see what's available as far as helping users
I have been looking everywhere but can't seem to find a good solution for
I have been looking at CodeIgniter template systems and all so far, it allows

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.