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 sp...
I am using CoreGraphics to draw a quadratic bezier but want to computer the min/max value of the curve. I am not from a mathematical background so this has become a bit troublesome. Does anyone have any articles or ideas about how to solve this?
...
Hello,
I'm writing a game that displays 56 hexagon pieces filling the screen in the shape of a board. I'm currently drawing each piece using a singleton rendering class that when called to draw a piece, creates a path from 6 points based of the coordinate passed in. This path is filled with a solid color and then a 59x59 png with an alp...
Hi all,
Is there a way to find out whether two CGPathRefs are intersected or not. In my case all the CGPaths are having closePath.
For example, I am having two paths. One path is the rectangle which is rotated with some angle and the other path is curved path. Two paths origin will be changing frequently. At some point they may inters...
I am trying to apply some transformations on images using a CGContextRef. I am using CGContextTranslateCTM, CGContextScaleCTM and CGContextRotateCTM functions, but to keep things simple lets focus on just the first. I was wondering why the following code produces exactly the original image?! Am I missing something?
CGColorSpaceRef color...
You can probably see where I am going with this - but is there any easy way to generate a CGAffineTransform from two lines - each represented by a pair of CGPoints:
A[(a1x,a1y), (a2x,a2y)],
B[(b1x,b1y), (b2x,b2y)]
The resultant CGAffineTransform when applied to line A would of course produce line B. It potentially could involve a tran...
I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from [UIImageView image] and created a RGBA byte array from this. Alpha is premultiplied.
CGImageRef image = uiImage.CGImage;
NSUInteger width = CGImageGetWidth(image);
NSUInteger height = CGImageGetHeight(image);
CGColorSpaceRef col...
I rotate/scale a UIVIew using [UIView transform:] and this works well. However, as soon as I change the view's frame origin the contents of the view begins to scale 'weirdly' even though I am not performing any further CGAffineTransforms.
Why does this occur? How can I prevent it?
Update 1:
The docs suggest that the frame is invalid a...
I have several different color block images that are reused in my game many times (its a simple rectangle for a puzzle game). I would like to apply a transparent overlay to each one of these images on the fly (a symbol for the puzzle block) which can be one of several different images. Is there a "best" way to get this done? Creating a s...
I've been scouring the Internet for a while now for information on how one can alter the letter-spacing/kerning of a font within UIKit.
My fear is, that like using your own custom fonts, you simply can't. Which would be terrible news.
I know Apple is protecting us from bad design with these constraints, but they're also preventing us f...
Heads starting to hurt. I think I dropped into this too fast... Perhaps someone could help me visualize how these (excluding OpenGL ES) high level drawing libraries fit together - or point me to some high level docs. For example I see "context" and "view" used interchangeably in some cases but a view has one (only one?) context while a c...
I want to create an iPhone/iPod game. I want it to be 3d, but I want to use sprites instead of OpenGL to do this (I assume this would be easier since I don't know OpenGL).
I was thinking of simply layering sprites over top of each other and changing their size to give an illusion of 3d. It doesn't need to be too convincing since the gam...
There are two images. image1 and image2. I have added image2 on image1. Overall the output image must be image1 only but, the portion of the image2 must become transparent. I mean the alpha values on the intersection area must be in reverse order( i.e, if alpha value of one pixel( say 120, 100) on image2 is 1.0 then the same pixel's alph...
hi
i am getting pixalated circle when zooming the view. i did draw a circle using the below code
CGContextSetAllowsAntialiasing(theContext, true);
CGContextSetShouldAntialias(theContext, true); +
CGGradientRef myGradient;
CGColorSpaceRef myColorspace;
size_t num_locations = 2;
CGFloat locations[2] = { 0.0, 0.0 };
CGFloat ...
I want to program a board game (similar to checkers) for the iPhone. Would OpenGL ES or CoreGraphics be a better option? What do most games of this type on the App Store use?
...
Hi all,
I'm trying to figure out how best to accomplish drawing a scene in an iphone app. Here is the situation:
I have a single view that I would like to draw to
I would like to have a background image
I would like to draw several different images on top of the background each which have separate transforms applied to them (rotation,...
After countless tries I got my animation animating right (Why oh why is the layer's coordinate system Y flipped from the view's coordinate system, I will never guess) but it seems that it degrades the image quality for some reason:
(green circled are examples of the original good quality images, the red circled is to emphasize the dif...
I'm trying to get an RGB value of a pixel from a CGImageRef object. I know that I need to create a context or something but, how do I do this?
...
I'm getting a "snapshot" of an UITextView as CGImage, but the problem is that the content of the UITextView is very long ( about ~110k contentSize.height ) and when I render the UITextView layer in to the context the memory usage becomes ~130MB which causes the application to crash when run on a device.
Here is the code. viewref is an i...
Is there a Cocoa Touch way to convert colors from one color space to another?
At the end of this code:
UIColor *grey = [UIColor colorWithWhite: 0.5 alpha: 1.0];
CGColorRef greyRef = [grey CGColor];
int x = CGColorGetNumberOfComponents(greyRef);
...x is 2.
The reason I need this is I'm trying to copy colors to a list of color compon...