quartz-graphics

openGL ES textures from PNGs with transparency are being rendered with weird artifacts and driving me nuts!

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 09:26:59
问题 I am beginning to work on my first OpenGL iPhone app, but I've hit an early snag. I have a VERY SIMPLE little texture that I want to use as a sprite in a 2D game, but it renders with weird 'randomly' colored pixels up top. http://i40.tinypic.com/2s7c9ro.png <-- Screenshot here I sort of get the feeling that this is Photoshop's fault, so if anybody something about that please let me know. If it's not photoshop then it's gotta be my code... So here is the code in question... - (void)loadTexture

How to draw on two separate layers iOS, coregraphics

无人久伴 提交于 2019-12-08 12:48:51
问题 I need help with drawing something like this: I have been told that the gray background bar and the purple bar should be drawn on separate layers. And then the dots there that signifies the chapters of a book (which this slider is about) will be on a layer on top of those two. I have accomplished the task of creating the gradient on the active bar and drawing it like so: - (void)drawRect:(CGRect)rect{ self.opaque=NO; CGRect viewRect = self.bounds; //NSLog(@"innerRect width is: %f", innerRect

How to draw on a non-transformed context while zoomed in a CATiledLayer?

自作多情 提交于 2019-12-08 09:00:01
问题 I'm using a CATiledLayer for the visualisation of data. By default the drawLayer function gets a transposed and scaled context, which allow the drawing code to be agnostic of the zoom-level and the tile that's being requested. However, I would like to use the zoom functionality to change the horizontal range of the data, without actual zooming occuring. So far, I got this code: (void)drawLayer:(CALayer*)layer inContext:(CGContextRef)context { /* retrieve the transformation matrix from the

CGContext Optimization

主宰稳场 提交于 2019-12-08 06:31:54
问题 I have a small run speed problem. On load, I generate a CGMutablePath containing at least 1000 points. I want to scroll this path on the screen, so I use this kind of code : -(void) drawRect:(CGRect)rect { /* Here, I have a timer calling drawRect 60 times per second. There's also code for the scale and currentTime, based on an MP3 playback (AVAudioPlayer); */ CGContextRef ref = UIGraphicsGetCurrentContext(); CGContextClearRect(ref, [self frame]); CGContextSaveGState(ref);

UIView infinite loop Animation to call a method after every repeat cycle

流过昼夜 提交于 2019-12-08 06:27:56
问题 I am at my wits end trying to come up with a design pattern for this paradigm. I haven't had much luck on this site but at this stage I'll try anything. I am trying to implement a radar type animation and hence I am rotating a view 360 degrees to represent the radius rotating around the circle. I have placed points around this circle and am able to calculate the angle from the center of the circle using standard trig. As the radius sweeps around the circle, if it intersects with a point (eg

Set UITableViewCell background color using a CALayer

拈花ヽ惹草 提交于 2019-12-08 06:09:35
问题 On iOS, I am adding a CALayer to a UITableViewCell's layer. This is my first time using CALayer, and it is simply supposed to change the background color of the table cell. My goal is (1) to learn how to use CALayer, and (2) to test using Instruments whether the drawing is faster than my current implementation, which slows down on CGContextFillRect. (Technical Q&A QA1708 was the catalyst for all this.) Current Implementation (works) - (void)drawRect:(CGRect)r { UIColor *myColor = [self

Draw over screen with Quartz

大憨熊 提交于 2019-12-08 03:29:48
问题 I'm trying to work out what the best way to draw over the top of all other items on the screen on OS X. I don't want to impede the user's ability to interact with their applications, but want to 'annotate' them. I want to be able to draw up to 20 different annotations. The top half of this screenshot from Gizmodo happens to nicely show the kind of thing I want to do. http://gizmodo.com/assets/resources/2006/07/04%20Safari.jpg (sorry, I'm too new to post it as an image) The questions I think I

Drawing the blue “unread dot” on the iPhone Mail app

▼魔方 西西 提交于 2019-12-08 03:02:34
问题 Does anyone have an example of how to draw the blue "unread dot" used in Apple's Mail App? This one in specific: Drawing an ellipse is straight forward with Quartz2d, but the subtle use of shadows+gradients make this look really 3d. 回答1: I think the blue dot in mail is actually an image; I would imagine that blitting an image would be faster than drawing a gradient. 回答2: If you decide to go with a resource there is an app called UIKit-Artwork-Extractor that allows you to rip all the resources

Rendering UIImage/CGImage into CGPDFContext results in… blankness!

不想你离开。 提交于 2019-12-07 19:28:19
问题 I'm trying to take an image that I have in a image object and render into a Core Graphics PDF context-- happens to be on an iPhone but this question surely applies equally to desktop Quartz. This UIImage is a simple color-on-white image at about 600x800 resolution. If I (say) turn it into a PNG file, that file looks exactly as expected-- so the data is OK. Here's what I'm doing to generate the PDF: NSMutableData * outputData = [[NSMutableData alloc] init]; CGDataConsumerRef dataConsumer =

Event taps: Varying results with CGEventPost, kCGSessionEventTap, kCGAnnotatedSessionEventTap, CGEventTapPostEvent

安稳与你 提交于 2019-12-07 10:47:06
问题 I'm running into a thorny problem with posting an event from an event tap. I'm tapping for NSSystemDefined at kCGHIDEventTap, then replacing the event with a new one. The problem I'm running in to is that depending on how I post the event, it's being seen only by some applications. My test applications are Opera, Firefox, Quicksilver, and Xcode. Here are the different techniques I've tried within my event tap callback, with results. I'm expecting an action (the "correct response") from each