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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:58:12+00:00 2026-06-14T20:58:12+00:00

How does one serialize a CGContext that contains a modified CGMutablePathRef? I currently save

  • 0

How does one serialize a CGContext that contains a modified CGMutablePathRef?

I currently save the context into png representation and serialize this, but it is causing issues with retina display.

I would like to avoid serializing a retina version and resizing it at runtime as this would be inefficient.

  • 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-14T20:58:14+00:00Added an answer on June 14, 2026 at 8:58 pm

    If you are just stroking or filling a single path, you can wrap it in a UIBezierPath, which conforms to the NSCoding protocol, and then you can serialize the UIBezierPath:

    UIBezierPath *uiPath = [UIBezierPath bezierPathWithCGPath:cgPath];
    NSData *data = [NSKeyedArchiver archivedDataWithRootObject:uiPath];
    

    Then you can write data to a file or your database or whatever. Later you can convert data back to a UIBezierPath and then a CGPath:

    UIBezierPath *uiPath = [NSKeyedUnarchiver unarchiveObjectWithData:data];
    CGPathRef cgPath = uiPath.CGPath;
    

    If you are drawing something more complex than a single path, the easiest way to serialize your drawing in a scalable (vector) format is to draw to a CGPDFContext instead of a CGBitmapContext. A CGPDFContext records your drawing commands to a PDF. Later, you can create a CGPDFDocument for the PDF, and use that to draw the PDF to your bitmap context. Read the PDF Document Creation, Viewing, and Transforming chapter of the * Quartz 2D Programming Guide* for details.

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

Sidebar

Related Questions

How does one write a (Intel) F90 function that converts a string into lowercase
How does one alternate row colors in a table in django that's generated using
I have written a program which will serialize and de-serialize, it does this fine
Basically, I have a class with 2 methods: one to serialize an object into
I'm getting this error: The service class myclass does not comply to one or
I have a timer function that serialize an object into a xml file once
In .NET 2.0 (in this case VB), is there a standard API that'll serialize
does one perform better over the other in terms of indexing/quering etc ? e.g.
How does one wait until all of the Javascript is loaded before curling a
How does one implement a multithreaded single process model in linux fedora under c

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.