quartz-graphics

3D Carousel effect on the iPad

ⅰ亾dé卋堺 提交于 2019-11-29 19:28:25
I am trying to implement a 3D Carousel on the iPad, consisting of UIViews, an effect like what is shown over here . I have gone through many similar questions on SO, but didn't find any staisfactory answers or no answers at all. I am trying to achieve the effect through modifying the coverflow animation but it just doesn't give that slick effect. Has anyone implemented this?(open for suggestions through quartz and openGL both) No need to dive into Quartz or OpenGL, assuming you don't mind foregoing the blur. The page you link to gets the perspective wrong (that's why the images in the

Saving and restoring CGContext

与世无争的帅哥 提交于 2019-11-29 18:34:20
问题 I'm trying to save and restore a CGContext to avoid doing heavy drawing computations for a second time and I'm getting the error <Error>: CGGStackRestore: gstack underflow . What am I doing wrong? What is the correct way to do this? - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); if (initialized) { CGContextRestoreGState(context); //scale context return; } initialized = YES; //heavy drawing computation and drawing CGContextSaveGState(context); } 回答1: I

layer.zPosition does not work with non-sibling UIViews

我与影子孤独终老i 提交于 2019-11-29 17:38:28
I have a reasonably complex hierarchy of UIImageView s. Originally, I was carefully swapping the sibling order when one UIImageView moved in front of another. Then I found out about myUIImageView.layer.zPosition and switched to using this instead. Worked out much simpler. It even works almost all the time. I found out from this SO question that zPosition only works amongst sibling layers. Great! So I have two questions really: Is there any actual documentation about this? and, is there some kind of fudge I can use to get this to work? (like adding all my UIImageViews to a UIView that is never

drawInRect: losing Quality of Image resolution

与世无争的帅哥 提交于 2019-11-29 16:49:39
问题 I am trying to erase image using following code CGColorRef strokeColor = [UIColor whiteColor].CGColor; UIGraphicsBeginImageContext(imgForeground.frame.size); CGContextRef context = UIGraphicsGetCurrentContext(); [imgForeground.image drawInRect:CGRectMake(0, 0, imgForeground.frame.size.width, imgForeground.frame.size.height)]; CGContextSetLineCap(context, kCGLineCapRound); CGContextSetLineWidth(context, 10); CGContextSetStrokeColorWithColor(context, strokeColor); CGContextSetBlendMode(context,

iPhone iOS Generate star, sunburst or polygon UIBezierPath programmatically

守給你的承諾、 提交于 2019-11-29 14:42:28
问题 I'm looking for a way to programmatically create stars, sunburst, and other "spiky" effects using UIBezierPath. UIBezierPath *sunbeamsPath = [UIBezierPath bezierPath]; [sunbeamsPath moveToPoint: CGPointMake(x, y)]; Are there any algorithms that can generate points for sunburst like shapes programmatically, without paths overlapping? I'm also interested in an irregular shape sunburst like the one below: I would imagine that such algorithm would take a certain number of rays, then roughly

Why there is an invalid context error?

一世执手 提交于 2019-11-29 13:59:22
Here is the code I use to draw: - (void) drawSomething { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetRGBStrokeColor(context, 1, 0, 0, 1); CGContextSetLineWidth(context, 6.0); CGContextMoveToPoint(context, 100.0f, 100.0f); CGContextAddLineToPoint(context, 200.0f, 200.0f); CGContextStrokePath(context); NSLog(@"draw"); } But I got the error like this: [Session started at 2010-04-03 17:51:07 +0800.] Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextSetRGBStrokeColor: invalid context Sat Apr 3 17:51:09 MacBook.local MyApp[12869] <Error>: CGContextSetLineWidth:

How can I get screenshot from all displays on MAC?

南笙酒味 提交于 2019-11-29 13:08:38
I try to get the screenshot from all monitors connected with my MAC to one picture. I know, how I can do this if every monitor's screenshot will saved to different pictures, but it is not what I want. I found function CGGetDisplaysWithRect , but my solution don't work, because output picture is empty. I expect, that problem with function CGDisplayCreateImageForRect (*displays, rect), because first parameter must be CGDirectDisplayID type, but not CGDirectDisplayID*. But I can't find function, which can create one picture with some CGDirectDisplayID objects. Help me please!!! #include <stdio.h>

How do I draw lines with alpha < 1 in quartz 2d

眉间皱痕 提交于 2019-11-29 12:38:57
No doubt this might be a duplicate question but I am not able to get proper solution from any post here. So I am posting this as new post with a hope that I get some solution. I my drawing app I want to give a feature of opacity for lines to be drawn. But when I assign alpha to color, I am getting overlapped points in between the line. Some where I found that drawing in two views solves this issue, but I was not able to understand the logic behind that. I am using normal quartz 2d code to draw line on touch events. Kris Van Bael Duplicate of In CoreGraphics drawing how can I keep the point of

How to rotate text drawn by Quartz on iPhone

陌路散爱 提交于 2019-11-29 10:26:15
问题 I want to draw some texts using Quartz. Now the app draws , but I want it to show as "0123456789". Is there any way to show its normal orientation? Here is my code: //set image view drawImage = [[UIImageView alloc] initWithImage:nil]; drawImage.frame = self.view.frame; [self.view addSubview:drawImage]; UIGraphicsBeginImageContext(self.view.frame.size); // begin // current context CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSelectFont(context, "Courier", 40,

Where can I find examples of Quartz 2D drawing on the iPhone?

本小妞迷上赌 提交于 2019-11-29 10:09:06
问题 I am going to develope the 2D game in Iphone using Quartz. what is the main Difference between Quartz and QuartzCore? I have searched a lot over the internet, but only able to find out the MAC OS with Quartz Examples. If any body has any Link/URL for Examples of Quartz(2D) using Iphone Developement,which would be run in the Real Iphone Device? Also if possible than give the Link for Bunch of examples/repository for Quartz Iphone. Thanks, Mishal Shah 回答1: There are a number of very nice