Hi guys!
I have an array of 2D points which make an irregular polygon.
What I want to do is draw the borders of it and then fill it with a color.
I am using Cocos2d to code the game around, but I have not found a fill function in Cocos2d, only the
ccDrawLine
and such.
Is there a simple way to draw filled shapes in Cocos2?
I have ...
Hi,
I was wondering if it's possible to use Core Animation to work on images and not on the display. For instance I want to apply a CATransform3D (on the iPhone) and output the result of the image manipulation in another image and not on the screen.
Thanks!
...
At a high level (or low level if you'd like), what's a good way to implement a smudge affect for a drawing program on the iPad using Quartz2D (Core Graphics)? Has anyone tried this?
Thanks so much in advance for your wisdom!
UPDATE I found this great article for those interested, check it!
...
I'd like to create a fade out affect with one of my bitmap contexts that I use to draw a static image in one of my views. What's an easy way to adjust the overall opacity of the bitmap context on the fly before I render it to the view?
Thanks so much in advance for your help! I'm going to continue researching this right now.
...
I'm working on a bitmap editor app for the iPad/iPhone and I'd like to have a floating toolbar that the user can move around the drawing canvas so it doesn't get in the way of the drawing surface. I'd use a standard UIToolbar, but I'd like the toolbar to have a zoom navigation view, which wouldn't fit elegantly in a standard UIToolbar.
...
This question is similar to another question I just posted, but I'd also like to create a fade out affect with one of my CGImageRefs that I use to draw a static image in one of my bitmap contexts using CGContextDrawImage(mBitmapContext, imageRect, imageRef). What's an easy way to adjust the overall opacity of CGImageRef on the fly before...
I ran into this trying to throw together a simple Automator script to combine several one-page PDF files. I had 88 files to combine, each just about exactly 300KB, so I expected the final product to be about 30MB; the resulting PDF file, using the Combine PDFs Automator action, was 300+MB.
Poking around, the Automator action uses a Pyth...
Or I should ask why is it so difficult for me? The answer is probably that I'm new to iPhone development and I'm trying to ditch my old methods and step into the new platform of the future. From start to finish, I have a few questions about this process...
If I create a .png image, where does it go in my project's directory (i.e. my ...
I'm just learning the iPhone SDK and about drawing with CG and UIKit and whilst I can see the usefulness for building interfaces as a web developer I can't help but think it would be a hell of a lot easy if I could layout content (ie heading, paragraphs, lists, images) with html and css
presumably this is possible using the web view and...
Dedicated to all who likes low-level Window Server (CoreGraphicsPrivate.h, etc), X11 on Mac, SIMBL and other crazy stuff :)
There's a simple X11-emulated application on Mac (like xterm, xeyes and so on) with one window. While running, X11 somehow creates a native Quartz window to represent this emulated application, and this window is a...
I mean a window which will not be accessible via Cocoa, Carbon or other CoreGraphics API for obtaining NSWindow *, WindowRef and others.
Like X11 application on Mac does.
Such a window that if you pass its window ID to [NSApp windowWithWindowID] or HIWindowFromCGWindowID() they both return NULL.
Thanks!
...
I'm building an app to iOS 4.0 and it crashes upon launching when xcode installs it. It crashes when loading my root view controller. It crashes at:
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor blackColor];
UIButton *button1 = [UIButton buttonWithType:UIButtonTypeCustom];
When I step th...
I am trying to create an app that scales up nicely on the iPhone 4. Currently most of it scales up perfectly, except for one crucial piece: the text that I draw inside a CALayer, inside its drawInContext: method. Here is my code:
- (void)drawInContext:(CGContextRef)context {
UIGraphicsPushContext(context);
CGContextSetGrayFill...
This might be my lack of understanding of the call stack when using Core Animation, but something confuses me a little about who/what is calling drawInContext.
Lets say I have
@interface PlayerLayer : CALayer
{
int Foo;
}
and I initialize Foo in init to be something like
-(void) init
{
if( self = [super init] )
{
Foo =...
I'm trying to figure out if there is any way to mirror an image. For example, take a picture of someone's face and then cut it in half and show what their face looks like with each side mirrored. There doesn't seem to be any tricks like this in CGAffineTransform functions. Graphics experts please help!!!
...
I have a CGLayerRef with content on it. How can I store this so that the app can quickly retrieve it and display it again? I tried converting it to a PNG and storing using Core Data but it's pretty slow to display, so I was wondering if there was a better way.
...
I use the following code to getting images from the sprite. And it works fine everywhere except the iPhone 4 (HD version).
- (UIImage *)croppedImage:(CGRect)rect {
CGImageRef image = CGImageCreateWithImageInRect([self CGImage], rect);
UIImage *result = [UIImage imageWithCGImage:image];
CGImageRelease(image);
return resul...
This code leaks, if someone can tell me why?
UIGraphicsBeginImageContext(drawingImage.frame.size);
[drawingImage.image drawInRect:CGRectMake(0, 0, drawingImage.frame.size.width, drawingImage.frame.size.height)];
// Draw some vectorial data
// ...
// Apply an image mask
CGImageRef maskRef = mask.CGImage;
CG...
I need a line that changes color along the path (which could be approximated by a linear gradient in one direction, if that is easier).
Is it possible to draw the path of a CAShapeLayer so that it has a color gradient?
...
I am using the following code and it draws a triangle on the screen. But for some reason it displays the below triangle.
Here is the code:
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
CGMuta...