quartz-graphics

How to write a web-based music visualizer?

折月煮酒 提交于 2019-11-27 01:48:09
I'm trying to find the best approach to build a music visualizer to run in a browser over the web. Unity is an option, but I'll need to build a custom audio import/analysis plugin to get the end user's sound output. Quartz does what I need but only runs on Mac/Safari. WebGL seems not ready. Raphael is mainly 2D, and there's still the issue of getting the user's sound... any ideas? Has anyone done this before? Brian McKenna By WebGL being "not ready", I'm assuming that you're referring to the penetration (it's only supported in WebKit and Firefox at the moment). Other than that, equalisers are

Drawing rotated text with NSString drawInRect

喜欢而已 提交于 2019-11-27 01:03:18
I found this answer on how to draw rotated text with NSString drawInRect:, but I'm not sure how it works since it only sort of works for me: https://discussions.apple.com/thread/1779814?start=0&tstart=0 My code looks like: CGContextSaveGState(context); CGContextDrawLinearGradient(context, gradient, CGPointMake(0, centY - halfWidth), CGPointMake(0, centY + halfWidth), 0); // Add text CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); NSString *str = @"some test string"; CGAffineTransform transform1 = CGAffineTransformMakeRotation(M_PI/4); CGContextConcatCTM(context,

Adding glow effect to UIButton - iOS

限于喜欢 提交于 2019-11-27 00:45:47
问题 I have an UIButton which is a logo. This logo button will glow on forever but will stop glowing on touch.It is like a glowing animation. Is there any suggestions? Undefined symbols for architecture i386: "_OBJC_CLASS_$_CABasicAnimation", referenced from: objc-class-ref in UIView+Glow.o "_OBJC_CLASS_$_CAMediaTimingFunction", referenced from: objc-class-ref in UIView+Glow.o "_kCAMediaTimingFunctionEaseInEaseOut", referenced from: -[UIView(Glow) startGlowing] in UIView+Glow.o ld: symbol(s) not

drawRect circle and animate size/color

旧巷老猫 提交于 2019-11-26 23:53:46
问题 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 example, if the circle is filled with red I would like to pulse the circle and make the red slightly lighter and darker in-time with the pulsing action. Not having much experience with Core Animation I am a bit lost about how to do this, so any help

Cannot create PDF document with 400+ pages on iOS

和自甴很熟 提交于 2019-11-26 23:13:50
问题 I am using the following pseudocode to generate a PDF document: CGContextRef context = CGPDFContextCreateWithURL(url, &rect, NULL); for (int i = 1; i <= N; i++) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; CGContextBeginPage(context, &mediaBox); // drawing code CGContextEndPage(context); [pool release]; } CGContextRelease(context); It works very well with small documents ( N < 100 pages), but it uses too much memory and crashes if the document has more than about 400 pages

Drawing path by Bezier curves

限于喜欢 提交于 2019-11-26 22:59:49
问题 I have a task - draw smooth curve input: set of points (they added in realtime) current solution: I use each 4 points to draw qubic Bezier curve (1 - strart, 2 and 3rd - control points, 4- end). End point of each curve is start point for the next one. problem: at the curves connection I often have "fracture" (angle) Can you tell me, how to connect my points more smooth? Thanks! 回答1: Here is few references which can help you: Draw a Smooth Curve through a Set of 2D Points with Bezier

How to Get the Display Name with the Display ID in Mac OS X?

坚强是说给别人听的谎言 提交于 2019-11-26 22:48:31
问题 I was wondering if you could help me figure out how to progmatically get the Display Name for a monitor by using its Display ID number in Mac OS X (10.5)? A requirement is if I give a function the Display ID, it'll provide the Display Name in return (or vice versa). Display Name looks something like this: "Color LCD", "SAMSUNG" Display ID looks something like this: "69671872", "893830283" NSScreen in Cocoa (Obj-C), or CGGetActiveDisplayList in Quartz (C), allow you to get the Display ID

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

只愿长相守 提交于 2019-11-26 21:18:29
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 potential pitfalls: not identifying the numbers of bits and bytes per things correctly, not specifying the right flags, not releasing unused data, etc. How can this be safely done with Quartz 2d (or another simpler way)? Matt Stevens You can use CGContextSetFillColorWithColor and CGContextFillRect for this: Swift extension UIImage { class func image(with

How can I check if a user tapped near a CGPath?

余生长醉 提交于 2019-11-26 20:03:39
问题 Scenario: I have a set of CGPath s. They are mostly just lines (i.e. not closed shapes). They are drawn on the screen in a UIView 's draw method. How can I check if the user tapped near one of the paths? Here's what I had working: UIGraphincsBeginImageContext(CGPathGetBoundingBox(path)); CGContextRef g = UIGraphicsGetCurrentContext(); CGContextAddPath(g,path); CGContextSetLineWidth(g,15); CGContextReplacePathWithStrokedPath(g); CGPath clickArea = CGContextCopyPath(g); //Not documented

CGContextDrawAngleGradient?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 19:39:01
问题 Dipping my feet into some more Core Graphics drawing, I'm attempting to recreate a wicked looking metallic knob, and I've landed on what is probably a show-stopping issue. There doesn't seem to be any way to draw angle gradients in Core Graphics. I see there's CGContextDrawRadialGradient() and CGContextDrawLinearGradient() , but there's nothing that I see that would allow me to draw an angle gradient. Does anyone know of a workaround, or a bit of framework hidden away somewhere to accomplish