core-graphics

How to add animation on image change while create video using images

本秂侑毒 提交于 2019-12-05 17:43:02
问题 I have an array of images from which I want to create a video by playing these images one after the other in a sequence.I want to add a different types of animation when image get change. Suggest me some method or any solution to achieve this functionality in Objective-C with the Cocoa framework. Here is working code for making video of images, But please suggest that how we animate images while making video: -(void)createVideoFromImages:(NSString *) path withSize:(CGSize) size { NSError

Static background for CGContext

青春壹個敷衍的年華 提交于 2019-12-05 17:30:40
this is my first question here, so hello everyone. I have spent some time now wrapping my mind around the following problem and could not come up with a solution. I'd be happy if someone could point me in the right direction. I'm using CGContext to draw various layers of graphical representations of live data which should be refreshed at a reasonable framerate of at least 50fps. I want to use a static image as a background. Re-drawing this image using the context for every cycle significantly slows down the frame-rate. I thought about just using UIImageView to display the image once. The

In CoreGraphics drawing how can I keep the point of overlap from being darker than the rest of the line?

本秂侑毒 提交于 2019-12-05 16:56:39
My app uses core graphics for custom finger paint drawing. I allow the user to change the alpha of the line and a new line is continuously drawn on touches moved. When I make the alpha lower than 1.0 the point of overlap is darker than the rest of the line. I know why this occurs but how can I stop this? Kris Van Bael I suppose you want a single stroke not to darken itself, but still to darken previous strokes (that's how most painting apps work). For this to work, you need two views/buffers, one for the 'current background' and one for the current stroke. Merge the latter with the background

Gradient ALONG a CGPath

我只是一个虾纸丫 提交于 2019-12-05 16:09:45
I am drawing an arc that is an almost complete circle: CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, NULL, centerPoint.x, centerPoint.y); CGPathAddArc(path, NULL, centerPoint.x, centerPoint.y, radius, (float)(3.0f * M_PI_2), radians, !clockwise); CGPathCloseSubpath(path); CGContextAddPath(context, path); CGContextFillPath(context); CGPathRelease(path); I have an arc like path that is an almost complete circle. In this code it is all one color, however, I want one end to be a solid white color and

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

送分小仙女□ 提交于 2019-12-05 15:23:20
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 app; "system beep" means the nothing-is-bound-to-that-key system sound. Create a new event, and return

How can I mirror a UIBezierPath?

…衆ロ難τιáo~ 提交于 2019-12-05 15:12:27
问题 I have a UIBezierPath and I would like to get its mirror image. How can I accomplish this? // Method for generating a path UIBezierPath *myPath = [self generateAPathInBounds:boundingRect]; // ? now I would like to mirror myPath ? 回答1: // Method for generating a path UIBezierPath *myPath = [self generateAPathInBounds:boundingRect]; // Create two transforms, one to mirror across the x axis, and one to // to translate the resulting path back into the desired boundingRect CGAffineTransform

CAShapeLayer path disappears after animation - need it to stay in the same place

拈花ヽ惹草 提交于 2019-12-05 14:11:54
Thanks to some help on StackOverflow, I am currently animating a path in CAShapeLayer to make a triangle that points from a moving sprite to another moving point on the screen. Once the animation completes, the triangle disappears from the screen. I am using very short durations because this code is being fired every .1 of second for each of the sprites. The result is the red triangle tracks correctly, but it rapidly flashes or isn't there entirely. When I crank up the the duration, I can the see the triangle stay longer. What can I do to get the triangle to stay on the screen, with it's

Create gradient image programmatically in iOS

最后都变了- 提交于 2019-12-05 13:58:29
I'm trying to process some imagedata which comes directly from the device camera. In order to understand the CGImage structure, I'm using a buffer to create an image which doesn't work right for me (I know that I shouldn't use C code within Obj-C Code, it's just for understanding). The code is as follows: int *outBuf = malloc(sizeof(int) * width * height); for (int i = 0; i < width * height;i ++) { outBuf[i] = (((float)i) / ((float) width * height)) * 255.f; } CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGContextRef ctx = CGBitmapContextCreate(outBuf, width, height, 8, width *

CGContextShowText is rendering upside down text (mirror image)

时间秒杀一切 提交于 2019-12-05 13:23:28
Without my doing anything to request upside down text, CGContextShowText is drawing it in that fashion. It is a mirror image vertically of what it should be. float font_size = 19.; CGContextSelectFont (context, "Helvetica", font_size, kCGEncodingMacRoman); CGContextSetTextDrawingMode (context, kCGTextFill); CGContextSetRGBStrokeColor (context, 255, 0, 0, 0); CGContextSetRGBFillColor (context, 255, 0, 0, 0); CGContextSetTextPosition (context, x, y); CGContextShowText (context, cstring, strlen(cstring)); How can I fix this? Also why is this the default drawing mode? Thanks. This "upsidedownness"

How to get window list from core-grapics API with swift

主宰稳场 提交于 2019-12-05 12:31:56
I´m trying to get a list of windows on OSX from the core-graphics API with Swift (to capture an image of them later on). After some research I found the CGWindowListCopyWindowInfo Objective-C API call with the following signature: CFArrayRef CGWindowListCopyWindowInfo( CGWindowListOption option, CGWindowID relativeToWindow ); Parameters option: The options describing which window dictionaries to return. Typical options let you return dictionaries for all windows or for windows above or below the window specified in the relativeToWindow parameter. For more information, see Window List Option