How can I read binary image file using Core Graphics?
I created an image in Matlab and changed it into binary image file. I want to read in the file using Core Graphics APIs. Thanks ...
I created an image in Matlab and changed it into binary image file. I want to read in the file using Core Graphics APIs. Thanks ...
i am getting this error "_CGRectZero", referenced from: _CGRectZero$non_lazy_ptr in RootViewController.o _CGRectZero$non_lazy_ptr in SecondViewController.o ld: symbol(s) not found collect2: ld returned 1 exit status Build failed (1 error) could someone tell me a solution to solve this? ...
Seen this asked before but my example does not seem to work. const CGFloat *toCol = CGColorGetComponents([[UIColor greenColor] CGColor]); The array is empty from looking at it with GDB. Any hints? ...
My core graphics fills are acting strange when the get close together, touching or overlapping. This issue is on the iPhone Simulator and iPhone OS 2.2. Here we have two labels and a custom view with two CGContextFillRect(): overlap problem When the blue and red are brought together they develop this irritating .5px merging line. I c...
Hi, I have made a quad curve path using the method CGPathAddQuadCurveToPoint. I got the path perfectly. But, I want to know all the coordinate points which are participated in the path. Is there a way to retrieve all the coordinate points in a path? If not do u have any other solution for retrieving all the points in a curve mathemat...
In a code-snippet I have seen this: size_t w = CGImageGetWidth(inImage); The docs don't give me any useful info about "size_t". Does anyone know what this is? ...
The doc is mentioning an CGBitmapContextGetBitsPerPixel(). I am almost sure that I would just have to divide this by 8. But since I didnt study computer science, I am confused about the detail. Would it make a difference if it's an 8 bit PNG or 24 bit PNG? Or some other PNG? So to get securely the bytes per pixel of an CGContextRef, wo...
I have created an context like this (simplified): CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef context = CGBitmapContextCreate (bitmapData, pixWide, pixHeigh, 8, // bits per component bitmapBytesPerRow, colorSpace, kCGImageAlphaPremultipliedFirst); Now, when I try to extract the data for the fi...
CGBitmapContextCreate takes an parameter that's not very obvious to me: For example, for a 32-bit pixel format and an RGB color space, you would specify a value of 8 bits per component. I have created 24-bit PNG files with alphatransparency, and added them to Xcode. At compile time, Xcode optimizes those PNG tiles with pngcru...
I assume that the origin is on the bottom left, and the y-axis expands up, starting from 0. The x-axis expands to the right, starting from 0. I just ask because I get very weird results from my drawing code... want to make sure that I didn't get this part wrong. ...
Actually, I thought that there would be an easy way to achieve that. What I need is pure alpha value information. For testing, I have a 50 x 55 px PNG, where on every edge a 5x5 pixel rectangle is fully transparent. In these areas alpha has to be 0.Everywhere else it has to be 255. I made very sure that my PNG is created correctly, and i...
I have a beautiful CGImageRef context, which I created the whole day to get alpha values ;) It's defined like that: CGContextRef context = CGBitmapContextCreate (bitmapData, pixWidth, pixHeiht 8, pixWidth, NULL, kCGImageAlphaOnly); So for my understanding, that context represents somehow my image. But "virtually", non-visible somewhe...
I'm experimenting with drawing on the iPhone by manually creating parts of the UI for my application (In this case a graph). Essentially, I want to draw a rectangle with rounded corners, a drop-shadow, and a semi-transparent gradient as the fill of the rectangle. Here is a screen shot of my photoshop mockup: I've gotten has far as crea...
I'm trying to extract the rgb components of a UIColor in order to hand-build the pixels in a CGBitmapContext. The following sample code works fine for most of the UIColor constants but, confusingly, not all. To wit: CGColorRef color = [[UIColor yellowColor] CGColor]; const float* rgba = CGColorGetComponents(color); float r = rgba[0]; f...
How would you go about animating the drawing of a line in a UIView on the iPhone? Is this possible? It can be drawn but can it easily be animated so it appears to be hand drawn? ...
Hi! I'm trying to create a custom UIButton that should look like a UIButtonTypeRoundedRect. In my drawRect:, I'm creating a path with first one call to CGContextMoveToPoint() and then four calls to CGContextAddArc(). I then stroke the path. However, in the resulting image the four rounded corners are clearly thicker than the rest of the...
I am new to iphone development. I used NSTimer scheduledTimerWithTimeInterval 0.01 seconds for game loop. The game consists drawscreen function inwhich I use CGContextClipToRect to clip the large images for animation. But the speed 0.01 seconds is working in simulator only not in the iphone(device). How can i overcome this problem? I res...
When changing the center point of an 10 degrees rotated view, the specified coordinates for the center point will not match the coordinate system of the superview. As an example, when you want to go straight up by y - 50, and no horizontal movement (i.e. x = theRotatedView.center.x), the shift in y-direction will be rotated. The view wi...
How to create bubbble message box similar to iPhone buildin SMS app? I'm trying to create a table cells with a bubble message box, similar to the iPhone SMS app or iChat. Anybody have example code I can refer to? ...
If I have a UIImageView and want to know if a user has tapped the image. In touchesBegan, I do the following but always end up in the first conditional. The window is in portrait mode and the image is at the bottom. I can tap in the upper right of the window and still go into the first condition, which seems very incorrect. - (void)t...