I have a UIView subclass that I'm drawing a PDF onto (using a CATiledLayer). I also need to draw on a specific region of that PDF, however the coordinate plane of the CATiledLayer when using CG to draw is way screwy.
See image:
I have a point (200,200), that I need to convert to the CATiledLayer's coordinate system, which is the 2nd ...
I am currently using the following code to write a CGContext to a PNG on disk:
CGImageRef image = CGBitmapContextCreateImage(context);
UIImage *myImage = [UIImage imageWithCGImage:image];
NSData *data = UIImagePNGRepresentation(myImage);
[data writeToFile:path atomically:YES];
I found that the orientation of the resultant file is flip...
Ok this is a little tricky. I'm detecting when an application goes into fullscreen mode (captures the display) and then i need to draw occasionally some stuff into the captured displays context for notification purposes (like Growl notifications, but has to work in fullscreen mode too).
Is there any way to modify another apps GL/CG cont...
My app crashes when my ViewController gets deallocated while my CATiledLayer is retrieving the image to draw in a background thread. I get a message
-[MyViewController respondsToSelector:]: message sent to deallocated instance 0x8f58e00
and the debugger shows
0 ___forwarding___
1 __forwarding_prep_0__
2 -[CATiledLayer(CATiledLayerPri...
I am attempting to take an image captured from the rear camera, apply a scaling transformation to it and then output a new image with the same size of the original but scaled up.
What I have below works ... BUT it is slow (especially the code in between the UIGraphicsBeginImageContext(size); and UIGraphicsEndImageContext();)
Is there a...
I am a bit confused about what the best approach is to resize a JPEG file on disk and save the resized JPEG as a new file to disk (on Mac OS X with Cocoa). There are a number of threads about resizing, but I am wondering what approach to use. Do I need to use Core Graphics for this or is this framework "too much" for a simple operation a...
I'm trying to draw some lines onto a MKMapView like in this example. But somehow the lines are not being drawn in my iPad app though it's pretty much the same as in the example. Are there some kind of common pitfalls I should think about? It's been driving me nuts for the last two days.
Thanks
–f
...
Hello,
I would like to draw a nice looking fonts in Cocoa Touch (by "nice looking" I mean white font with blurred black border that looks like shadow)
The question is either:
Is it possible to display bitmap fonts in coca touch
Is it possible to render a border for a font (for each character)
...
Hey people,
i got a real performance issue on my app after adding a new class. this class extends UIButton. In the initWithFrame: method im setting some parameters like:
[self.layer setBorderColor:[[UIColor lightGrayColor] CGColor]];
[self.layer setCornerRadius:5.0];
[self.layer setBorderWidth:1.0];
After that i add some gradient ...
I've been trying to get any given window from another Application to become front most and focused.
Here are the two methods I have tried:
AppleScript
tell application "Safari"
set index of window "Downloads" to 1
activate
end tell
Why it doesn't work: While it seems to change the z-Order, it doesn't change the focus! The prev...
I would like to add 3D or glossy look to some iPhone UIButtons, but do so without the use of PNGs or stretchable images. I have a lot of buttons of varying shapes and sizes with lots of colors which are generated on the fly, so prerendered images are not feasible in my case.
How would you go about drawing the gloss on these buttons pro...
I'd like to multiply r, g, b and a values of two CGImages, to use a single image as both a mask (in its alpha channel) and tint (in the rgb channels). I first tried simply:
CGContextDrawImage(context, CGRectMake(0, 0, _w, _h), handle());
CGContextSetBlendMode(context, kCGBlendModeMultiply);
CGContextDrawImage(context, CGRectMake(0, 0, o...
I am using CGContextRef.
UIGraphicsBeginImageContext(self.drawImage.frame.size);
CGContextRef context=UIGraphicsGetCurrentContext();
CGContextSetRGBStrokeColor(context,0.0f,0.0f,0.0f,1.0f);
UIGraphicsEndImageContext();
CGContextRelease(context);
Do I need to call CGContextRelease(Context); in the above one.
...
Hi all,
I'm currently scoping out a project for the iPad which is rather text and font heavy. There are many pages of styled text, which also need custom fonts. I have toyed with the idea of simply rendering PDF or PNG files on-screen, but I think we need to be able to dynamically repaginate the text.
We've used UIWebView in a previous...
I know that you can use CGContextSetShadow to draw a drop shadow, but is there any way to draw an inner shadow?
...
I've got a UIView that is set to opaque = NO and it all works nicely. In the drawRect I'm doing custom drawing, and this works
CGContextSetFillColor(context, CGColorGetComponents([UIColor blueColor].CGColor));
CGContextFillRect(context, labelOutside);
CGContextAddRect(context, labelOutside);
but this
CGContextSetFillColor(context, C...
Before the retina display came to iOS, I've developed some controls which are drawn using stretchable images and lots of core graphics code.
Now I tested it on a retina display device, and the graphics are misplaced and distorted. Everything else that's loaded with @2x suffix and UIImage imageNamed works fine.
I assume there must be so...
Since the retina display, suddenly this piece of drawing code seems to not work anymore. The drawn image is slightly offset than it was before and appears somewhat stretched.
I am drawing something in the -drawRect: method of an UIControl subclass. I figured out that the current scale inside that UIControl indeed is 2.0. This code obtai...
I'm putting an image into a CALayer that could be irregularly transparent:
theCardLayer.front = [CALayer layer];
theCardLayer.front.contents = (id)[cardDrawing CGImage];
In other words, it might be a square filling the layer or it might be an octagon that leaves the corners see-through.
I want to sometimes darken this layer, but wi...
I've got a function that returns a std::string object. I'm working with Cocoa/CoreGraphics and I need a way to get the data from that string into a CFData object so that I can feed that into a CGDataProviderCreateWithCFData object to make a CGImage.
The CreateCFData function wants a const UInt8* object (UInt8 being a typedef for unsign...