Questions tagged [quartz-graphics]

Quartz is graphic framework used on Mac OS X. It forms a graphic layer. Term Quartz is used to represent Quartz 2D and Quartz Compositor. Quartz graphic is a 2D renderer in Core Graphics.

1214 questions
121
votes
6 answers

How to create a colored 1x1 UIImage on the iPhone dynamically?

I would like to create a 1x1 UIImage dynamically based on a UIColor. I suspect this can quickly be done with Quartz2d, and I'm poring over the documentation trying to get a grasp of the fundamentals. However, it looks like there are a lot of…
Ian Terrell
  • 10,667
  • 11
  • 45
  • 66
100
votes
8 answers

Where can I find a list of Mac virtual key codes?

I'm using CGEventCreateKeyboardEvent and need to know what CGKeyCode values to use. Specifically, I am after the key code for the Command key. The docs give examples for other keys: z is 6, shift is 56. There must be a list of Mac virtual keycodes…
Nick Moore
  • 15,547
  • 6
  • 61
  • 83
78
votes
3 answers

What's the difference between Quartz Core, Core Graphics and Quartz 2D?

I wonder if someone can distinguish precisely between these? For my understanding, Core Graphics is just a "Framework Package" which contains Quartz Core and Quartz 2D. But I'm not sure about if Quartz 2D actually is Quartz Core? Maybe someone can…
openfrog
  • 40,201
  • 65
  • 225
  • 373
75
votes
4 answers

NSAttributedString background color and rounded corners

I have a question regarding rounded corners and text background color for a custom UIView. Basically, I need to achieve an effect like this (image attached - notice the rounded corners on one side) in a custom UIView: I'm thinking the approach to…
codeBearer
  • 5,114
  • 4
  • 25
  • 29
67
votes
2 answers

Detecting CGAssociateMouseAndMouseCursorPosition

We're making a user-space device driver for OS X that moves the cursor using Quartz Events, and we ran into a problem when games — especially ones that run in a windowed mode — can't properly capture the mouse pointer (= contain/keep it within the…
Dae
  • 2,345
  • 2
  • 22
  • 34
66
votes
9 answers

How to draw a rounded rectangle in Core Graphics / Quartz 2D?

I need to draw an outline for a rounded rectangle. I know I can make lines and arcs, but maybe there is also a function for rounded rects?
dontWatchMyProfile
  • 45,440
  • 50
  • 177
  • 260
64
votes
6 answers

iPhone smooth sketch drawing algorithm

I am working on a sketching app on the iPhone. I got it working but not pretty as seen here And I am looking for any suggestion to smooth the drawing Basically, what I did is when user places a finger on the screen I called -…
Suwitcha Sugthana
  • 1,301
  • 2
  • 11
  • 18
55
votes
3 answers

Get PDF hyperlinks on iOS with Quartz

I've spent all day trying to get hyperlinks metadata from PDFs in my iPad application. The CGPDF* APIs are a true nightmare, and the only piece of information I've found on the net about all this is that I have to look for an "Annots" dictionary,…
ySgPjx
  • 10,165
  • 7
  • 61
  • 78
55
votes
12 answers

Curve text on existing circle

For an application I am building I have drawn 2 circles. One a bit bigger than the other. I want to curve text between those lines, for a circular menu I am building. I read most stuff about curving a text that you have to split up your text in…
Wim Haanstra
  • 5,918
  • 5
  • 41
  • 57
53
votes
1 answer

Weak performance of CGEventPost under GPU load

We've stumbled upon a performance problem with Quartz Events, more specifically CGEventPost: during heavy GPU load CGEventPost can block. We've created a small benchmark application to demonstrate the issue. This application is just a loop that…
Dae
  • 2,345
  • 2
  • 22
  • 34
53
votes
4 answers

How do I create a CGRect from a CGPoint and CGSize?

I need to create a frame for a UIImageView from a varying collection of CGSize and CGPoint, both values will always be different depending on user's choices. So how can I make a CGRect form a CGPoint and a CGSize? Thank you in advance.
inorganik
  • 24,255
  • 17
  • 90
  • 114
48
votes
4 answers

How to animate layer shadowOpacity?

I have a view on which I've set the layerOpacity to 1. theView.layer.shadowOpacity = 1.0; This looks fine when the view is farther down the screen. When I move this view up to be flush with another view that has a shadow, they don't look good.…
sudo rm -rf
  • 29,408
  • 19
  • 102
  • 161
43
votes
2 answers

How do I draw a line on the iPhone?

I am a beginner at iPhone programming, and would like to draw a line to the phone screen for the purpose of study using Quartz and UIKit. How do I start drawing?
anish
43
votes
1 answer

Can't compile code when working with CALayer

For some reason I get linker errors when I try and use CALayer: "_OBJC_CLASS_$_CALayer", referenced from: I have imported the following headers: #import #import #import…
Sheehan Alam
  • 60,111
  • 124
  • 355
  • 556
42
votes
1 answer

How to fill a path with gradient in drawRect:?

filling a path with a solid color is easy enough: CGPoint aPoint; for (id pointValue in points) { aPoint = [pointValue CGPointValue]; CGContextAddLineToPoint(context, aPoint.x, aPoint.y); } [[UIColor redColor] setFill]; [[UIColor blackColor]…
Derrick
  • 2,356
  • 5
  • 32
  • 43
1
2 3
80 81