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
38
votes
5 answers

iPhone - Draw transparent rectangle on UIView to reveal view beneath

I currently have two UIViews: one of a red background and the other blue. The blue view is a subview of the red view. What I would like to do is be able to "cut" out rectangles on the blue view so that the red view can be visible. How do you go…
Dave
  • 435
  • 1
  • 6
  • 5
38
votes
6 answers

How to convert ASCII character to CGKeyCode?

I need a function that, given a character, returns the CGKeyCode associated with the position of that character on the current keyboard layout. E.g., given "b", it should return kVK_ANSI_B if using U.S. QWERTY, or kVK_ANSI_N if using Dvorak. The…
Michael
  • 11,612
  • 10
  • 41
  • 43
37
votes
4 answers

Retrieving a pixel alpha value for a UIImage

I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from [UIImageView image] and created a RGBA byte array from this. Alpha is premultiplied. CGImageRef image = uiImage.CGImage; NSUInteger width =…
teabot
  • 15,358
  • 11
  • 64
  • 79
36
votes
3 answers

Applying a Gradient to CAShapeLayer

Does anyone have any experience in applying a Gradient to a CAShapeLayer? CAShapeLayer is a fantastic layer class, but it appears to only support solid fill coloring, whereas I'd like it to have a gradient fill (actually an animatable gradient at…
34
votes
4 answers

Can't add a corner radius and a shadow

I'm trying to draw a shadow and a corner radius on an image. I can add them separately, but I've got no way to add both effects at the same time. I'm adding a shadow with: [layer setShadowOffset:CGSizeMake(0, 3)]; [layer…
32
votes
4 answers

Quartz 2D drawRect method (iPhone)

I've got 4 different iPhone/Cocoa/Core Animation/Objective-C books in front of me, along with numerous sample code from the web. Yet somehow I still feel like I'm missing some fundamental understanding of how drawing works in Quartz 2D. Is…
Limbic System
  • 6,820
  • 7
  • 29
  • 37
31
votes
3 answers

How to draw a triangle programmatically

I have a triangle solver, I want a way to use the values I get from the answer to draw a triangle to the screen that matches it.
user804306
  • 777
  • 1
  • 8
  • 15
30
votes
2 answers

What are some great Quartz 2D drawing tutorials?

I'm searching for some great Quartz 2D drawing tutorials aimed at the iPhone. I'm new to Quartz and want to start off with something easy and then progress to more difficult stuff. Does anyone know of any Quartz 2D drawing tutorials that they would…
JJgendarme
  • 1,411
  • 2
  • 16
  • 30
29
votes
1 answer

drawRect circle and animate size/color

I am drawing a circle in the -drawRect: method of my UIView using the standard CGContextFillEllipseInRect() code. However, I would like to slightly pulse (make larger and smaller) and change the intensity of the color fill with an animation. For…
Skoota
  • 5,280
  • 9
  • 52
  • 75
27
votes
2 answers

How do I release this CGPath when I need to return it

I have a method that returns a CGMutablePathRef, something like this: - (CGMutablePathRef)somePath; { CGMutablePathRef theLine = CGPathCreateMutable(); CGPathMoveToPoint(theLine, NULL, 50, 50); CGPathAddLineToPoint(theLine, NULL,…
willc2
  • 38,991
  • 25
  • 88
  • 99
23
votes
3 answers

Mac OS X: Can one process render to another process's window?

Greetings! I'm currently porting a web browser plugin from Win32 to MacOSX. One of the features of the plugin is that when the plugin is loaded, it spawns a separate process that serves as the "engine" of the plugin and executes drawing operations…
fixermark
  • 1,261
  • 1
  • 14
  • 19
22
votes
4 answers

What are the alternatives to Core-Plot for drawing graphs in iPhone SDK

Are there any alternatives to Core-Plot for drawing graphs in iPhone SDK? I am having hard time integrating core-plot in my app. Lot of issues. Can you please suggest some alternatives to core-plot?
meetpd
  • 9,150
  • 21
  • 71
  • 119
22
votes
6 answers

How to generate thumbnails from a PDF document with iPhone SDK?

I have read the Apple PDF documentation with Quartz. But I do not know how to generate the thumbnails from a PDF document... Any idea/sample code ?
fvisticot
  • 7,936
  • 14
  • 49
  • 79
21
votes
4 answers

Detect if CGPoint within polygon

I have a set of CGPoints which make up a polygon shape, how can I detect if a single CGPoint is inside or outside of the polygon? Say, the shape was a triangle and the CGPoint was moving hoizontally, how could I detect when it crossed the triangle…
JWood
  • 2,804
  • 2
  • 39
  • 64
21
votes
3 answers

CATransform3D rotate causes half of image to disappear

I'm using the following code to rotate an image, but half the image (down the y-axis) that has been rotated "out of" the page, disappears. How to fix? heading is in radians. CALayer *layer = myUIImageView.layer; CATransform3D…
iPadDeveloper2011
  • 4,560
  • 1
  • 25
  • 36
1
2
3
80 81