Questions tagged [quartz-2d]

Quartz 2D is the primary two-dimensional graphics rendering API for Mac OS X, part of the Core Graphics framework.

Quartz 2D is the primary two-dimensional graphics rendering API for Mac OS X, part of the Core Graphics framework.

From apple official document:

Quartz 2D provides low-level, lightweight 2D rendering with unmatched output fidelity regardless of display or printing device. Quartz 2D is resolution- and device-independent; you don’t need to think about the final destination when you use the Quartz 2D application programming interface (API) for drawing.

The Quartz 2D API is easy to use and provides access to powerful features such as transparency layers, path-based drawing, offscreen rendering, advanced color management, anti-aliased rendering, and PDF document creation, display, and parsing.

The Quartz 2D API is part of the Core Graphics framework, so you may see Quartz referred to as Core Graphics or, simply, CG.

Quartz 2D uses the painter’s model for its imaging. In the painter’s model, each successive drawing operation applies a layer of “paint” to an output “canvas,” often called a page.

For more information:

Related tags:

667 questions
16
votes
1 answer

Better to use CGRectGetHeight(view.bounds) or view.bounds.size.height directly in Objective-C

I can't find where I read it, but I remember coming across something that suggested it is better to access height of CGRects using CGRectGetHeight(rect) instead of accessing the variable via rect.size.height CGFloat height =…
Logan
  • 52,262
  • 20
  • 99
  • 128
16
votes
2 answers

3d text effect in iOS

I want to render some text on one of my screens that has a 3dish look to it. I am using UIKit and standard views controllers etc. The effect will look something like this: Can this be done somehow with UIKit & iOS? Ordinarily I would just use a…
Imran
  • 1,488
  • 1
  • 15
  • 36
15
votes
4 answers

Perspective correction of UIImage from Points

I'm working on a app where I'll let the user take a picture e.g of a business card or photograph. The user will then mark the four corners of the object (which they took a picture off) - Like it is seen in a lot of document/image/business card…
Jakob Halskov
  • 428
  • 6
  • 22
15
votes
4 answers

How to implement alpha gradient on a image?

I want to implement alpha gradient on an image. From 0.5 alfa on top of the image to 0.0 on bottom. Any advice, tutorial, link is welcome.
Alex Terente
  • 12,006
  • 5
  • 51
  • 71
15
votes
2 answers

Create PDF Annotations in iOS

I've been working on a pdf viewer with support for annotations and I need to be able to save new annotations that the user has created. I've seen tons of examples on how to draw text/lines/images, but that's only flattened content, I need to create…
Ismael
  • 3,927
  • 3
  • 15
  • 23
14
votes
2 answers

How do I get UIImage from a CGContextRef?

I have a CGContextRef and I did my drawing stuff with the bitmap context. Now, I would like to have a function call to get a UIImage for the CGContextRef. How do I do that?
samwize
  • 25,675
  • 15
  • 141
  • 186
14
votes
4 answers

What's the right memory management pattern for buffer->CGImageRef->UIImage?

I have a function that takes some bitmap data and returns a UIImage * from it. It looks something like so: UIImage * makeAnImage() { unsigned char * pixels = malloc(...); // ... CGDataProviderRef provider =…
Ben Zotto
  • 70,108
  • 23
  • 141
  • 204
13
votes
4 answers

Drawing triangle/arrow on a line with CGContext

I am using the framework of route-me for working with locations. In this code the path between two markers(points) will be drawn as a line. My Question: "What code should I add if I want to add an arrow in the middle(or top) of the line, so that it…
Pete
  • 173
  • 1
  • 1
  • 9
12
votes
2 answers

Copy Table of Contents from one PDF to another

You might find it as duplicate of Create a table of contents from a pdf file, but I didn't get any solution there. My scenario is like I am creating a PDF from existing PDF with some edits. That all works fine. My question is I want to add metadata,…
DivineDesert
  • 6,924
  • 1
  • 29
  • 61
12
votes
4 answers

CGContext line drawing: CGContextFillPath not working?

Anyone have any idea why CGContextFillPath won't work in the code snippet below? I'm using the following code to draw to a UIImageView. It's stroking the path correctly, but ignoring…
RyJ
  • 3,995
  • 6
  • 34
  • 54
11
votes
3 answers

What exactly is a Graphic Context?

What exactly is encapsulated by a Graphic Context (or Device Context in Windows)? The various definitions across the net agree that a context encapsulates the parameters for the various graphics operations. See: X11, Mac OS, Windows What is not…
Dimitrios Menounos
  • 545
  • 1
  • 6
  • 17
11
votes
1 answer

Polygon overlays interfering with each other when filling a MKPolygon with a CGPattern (using Quartz 2D)

Background In iOS6, I used to add several MKPolygon (overlays) on the MKMapView and to provide a specific MKOverlayView to the mapView:viewForOverlay: callback (see MKMapViewDelegate Class Reference). This specific view's job was to fill the…
Thibault D.
  • 10,041
  • 3
  • 25
  • 56
10
votes
1 answer

CGContextClipToMask returning blank image

I'm new to Quartz. I have 2 images, a background, and a mask with cutout shape that I want to lay over the background in order to cut out a section. The resulting image should be the shape of the cutout. This is my mask (the shape in the middle is 0…
Smikey
  • 8,106
  • 3
  • 46
  • 74
10
votes
5 answers

Mac OS X: Drawing into an offscreen NSGraphicsContext using CGContextRef C functions has no effect. Why?

Mac OS X 10.7.4 I am drawing into an offscreen graphics context created via +[NSGraphicsContext graphicsContextWithBitmapImageRep:]. When I draw into this graphics context using the NSBezierPath class, everything works as expected. However, when I…
Todd Ditchendorf
  • 11,217
  • 14
  • 69
  • 123
9
votes
3 answers

Recreate Siri Button Glow Animation

Is there any way of duplication the siri button glow animation? It looks absolutely gorgeous, but I have no idea at the moment how to start... are there online preformatted pngs that are rotated? or is it done with CoreAnimation?
konturgestaltung
  • 467
  • 6
  • 19
1
2
3
44 45