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,...
Hi All,
I have a UIImage (generated by a user drawing) that has a white background. I'd like to make the white portions of this image transparent. I'd also like to save this to a PNG file.
I've looked around on forums but can't figure out how to mask the image correctly. Has anyone tried this before?
Thanks.
...
I'd like to create a UIImage object from the current graphics context. More specifically, my use case is a view that the user can draw lines on. They may draw incrementally. After they are done, I'd like to create a UIImage to represent their drawing.
Here is what drawRect: looks like for me now:
- (void)drawRect:(CGRect)rect
{
CGCo...
I've included:
#import "QuartzCore/QuartzCore.h"
but when I try to build, I get the error mentioned in the title. Is there something else I need to do to tell XCode to include the framework?
The code where I use it is:
CALayer *layer = paperView.layer;
CATransform3D rotation = CATransform3DMakeRotation(1, 0, 0, 1);
...
Hi all,
I'm writing an application that uses your finger to draw simple diagrams. I have it working for the most part but now I'm trying to optimize its performance. When the user swipes their finger fast, I can't capture enough touch events to draw a smooth path.
Here's my current approach:
1) I subclassed a UIView and added a porop...
I know its possible with boundary fill, but have tried everything in Objective C and I'm still not successful. Any help with code will be highly appreciated.
This code returns the color of the touched pixel:
unsigned char* data = CGBitmapContextGetData (cgctx);
if (data != NULL) {
offset = 4*((w*round(point.y))+round(point.x));
...
Scenario:
I have a set of CGPaths. 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()...
Is there a way to simulate handwriting using quartz?
I mean there is a path between points A, B and C.
I want path to come out of point A and go animated to point B and then C.
What comes to mind is two options to do it:
Ugly- Create path then mask it and move mask around to reveal a path.
Takes a lot of time to create and unrelia...
Looking at the QuartzDemo sample application, I love the speed of the PDF rending using quartz alone (that is, without using uiwebview). However, when I'm zooming in the PDF it doesn't seem to become more clear like it does in PDF view.
Is there something that I can change to have the same effect when zooming in and out using multito...
Alright, I have a UIView which displays a CGPath which is rather wide. It can be scrolled within a UIScrollView horizontally. Right now, I have the view using a CATiledLayer, because it's more than 1024 pixels wide.
So my question is: is this efficient?
- (void) drawRect:(CGRect)rect {
CGContextRef g = UIGraphicsGetCurrentContext(...
I'm developing on the iPhone and the majority of our game is using OpenGL ES, but there are also menus that use CGImage and Quartz in order to be displayed. In OpenGL ES, I know that no matter what image compression goes in (JPG, PNG, etc.), the data stored in memory as a texture is an 8-bit texture, unless I use PVRTC in which case I ca...
I've got a UIView subclass (TraceView) which is 200 wide by 100 tall, and I'm attempting to draw on it pixel by pixel. In this case, I'm trying to draw a horizontal blue line that goes 75% of the way across. Instead, I get two vertical blue lines (one at the edge, one in the middle), that go 75% of the way up. It seems like the CGLaye...
I am using bottom left corner instead of top left to draw on iPhone using the following:
CGContextTranslateCTM(context, 0.0, 200.0);
CGContextScaleCTM(context, 1.0, -1.0);
While this works fine for changing my origin to draw a chart but labeling appears upside down.
How do use my coordinate system but also get normal straight text to ...
Hi everyone
I have a small run speed problem. On load, I generate a CGMutablePath containing at least 1000 points. I want to scroll this path on the screen, so I use this kind of code :
-(void) drawRect:(CGRect)rect {
/*
Here, I have a timer calling drawRect 60 times per second.
There's also code for the scale and currentT...
To quote from the CGLayer doc:
Quartz caches any objects that are reused, including CGLayer objects.
I am having problems with memory on large pages and am trying to implement a simple mechanism where views are released and recreated based on whether they are on/off screen.
Say for the sake of simplicity that I have a bunch of UI...
My object a sub class of NSObject has CALayer instance variable. I use it for drawing and caching content with its delegate set to my object.
But for some reason drawLayer:inContext: method NEVER gets called. Whereas actionForLayer:forKey: delegate method does get called implying the delegate is getting set properly with the [layer.de...
Is it wise to create views in Cocoa that have dimensions around 15000 pixels? (of course only small part of this view will be visible at a time in a NSScrollView)
Interface Builder has limit of 10000 pixels in size. Is this an artificial limitation or is there a good reason behind it?
Should I just create huge view and let NSScrollView...
How do I work out how much large an area drawing an NSString will occupy, i.e. by using:
[string drawAtPoint:p withAttributes:nil];
I ideally need to work this out before its drawn so I can space out the "areas" in which the strings are drawn appropriately.
...
Hi. I have a cocoa interface that uses core plot. When I press a button in the interface, a plot is drawn. I wanted to create a sequence of graphs by calling the plotting method multiple times along with calls to sleep() in between. But it seems that even though the call to reload data is made that nothing happens until the function ex...
Hello! 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", "SAMSU...