cgcontext

iPhone MapKit: Custom MKPolygonView with image draws upside down

北战南征 提交于 2019-12-11 13:56:46
问题 does anybody know what to do with this problem: my image in a custom MKPolygonView is flipped upside down? The idea (this is working OK already) is having an class "SnowmapsOverlayView" that extends "MKPolygonView", that displays a image. This image has a default location & size on the map (acts as a GroundOverlay in the Google Maps web API). This is all working fine, but the image is displayed upside down. I've tryed the following options, but with no result: CGContextDrawImage draws image

Can't Create PDF and PRINT more than 60 Pages ( memory Raises & crashes) [duplicate]

本秂侑毒 提交于 2019-12-11 12:46:02
问题 This question already has answers here : Cannot create PDF document with 400+ pages on iOS (4 answers) Closed 3 years ago . I need to generate PDF more than 60 pages and need to Print it, but in iPhone & iPad memory Ram raises to 350.50MB-500.00MB and Crashes . For Reducing memory->Running in dispatch queues also that doesn't help Can't find the solution for this . Plz help me in this ... and referred below link but doesn't help Cannot create PDF document with 400+ pages on iOS -(NSData*

UIImage sideway after converting it from CIImage

…衆ロ難τιáo~ 提交于 2019-12-11 10:17:22
问题 I'm applying filter on UIImage but after conversion, it appear as sideway. Below is my code. CIImage *ciImage = [[CIImage alloc] initWithImage:self.imgToProcess]; CIFilter *filter = [CIFilter filterWithName:@"CIPhotoEffectChrome" keysAndValues:kCIInputImageKey, ciImage, nil]; [filter setDefaults]; CIContext *context = [CIContext contextWithOptions:nil]; CIImage *outputImage = [filter outputImage]; CGImageRef cgImage = [context createCGImage:outputImage fromRect:[outputImage extent]]; UIImage

Draw one CGlayer into another CGlayer

房东的猫 提交于 2019-12-11 08:23:33
问题 I am using two CGlayers for drawing, Layer1 and Layer2, I draw into Layer1 and on touches end, I transfer the data into Layer2 and just clear Layer1, and in my drawRect, method, I draw both layers to context. On erase button clicked, I transfer the drawing from Layer2 to Layer1 and then I erase layer1, but on touches end, I dont transfer it to Layer2, because I only erase Layer1 On pen clicked If erase has happened, I transfer drawing from Layer1 to Layer2, otherwise previous drawing can

How do I stroke a CGContext path with multiple random images

≯℡__Kan透↙ 提交于 2019-12-11 08:16:57
问题 I want to stroke a CGContext path using three or four images, but randomly cycle through the images as I'm drawing the path. I want to draw the images INSTEAD!! of drawing the CGContext I am now. I have this code so far - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint currentPoint = [touch locationInView:self.view]; currentPoint.x = currentPoint.x; currentPoint.y = currentPoint.y; mouseSwiped = YES; UIGraphicsBeginImageContext

How can I improve CGContextFillRect and CGContextDrawImage performance

谁说我不能喝 提交于 2019-12-11 04:05:51
问题 Those two functions are currently my bottleneck. I am working with very large bitmaps. How can I improve their performance? 回答1: You could cache smaller versions of your bitmaps which you create before drawing the first time and then simply draw the downscaled samples instead of the full-blown 15 megapixel stuff. Then again make sure you are only drawing what is necessary i.e. in 'drawRect: (NSRect) rect' only draw inside the rect (unless absolutely necessary). And try not do perform drawings

How to draw string in other device orientations using CGContext iOS

此生再无相见时 提交于 2019-12-11 02:07:40
问题 I'm trying to draw some text on the iPhone, but in landscape mode, where the home button is on the left. So I need to somehow twist the numbers (I'm guessing I use a transform) ? Here's what I have now: CGContextSetRGBFillColor(context, 1.0, 0, 0, 1.0); CGContextSetRGBStrokeColor(context, 1.0, 0.0, 0.0, 1.0); CGContextSelectFont(context, "Helvetica", 20, kCGEncodingMacRoman); CGContextSetTextMatrix(context, CGAffineTransformMakeRotation(M_PI/2)); CGContextSetTextDrawingMode(context,

Copying the drawn contents of one UIView to another

梦想的初衷 提交于 2019-12-10 17:14:25
问题 I'd like to take a UITextView and allow the user to enter text into it and then trigger a copy of the contents onto a quartz bitmap context. Does anyone know how I can perform this copy action? Should I override the drawRect method and call [super drawRect] and then take the resulting context and copy it? If so, does anyone have any reference to sample code to copy from one context to another? Update: from reading the link in the answer below, I put together this much to attempt to copy my

How can I use Core Graphics to draw a circle at my touch location?

老子叫甜甜 提交于 2019-12-10 14:07:46
问题 New programmer here. I am having issues trying to use Core Graphics to draw a stroked arc around my touch location. I have the method to draw the circle working fine, and I have tested and am registering touches when I tap the screen, but when I try to call the method to draw the circle when I tap, I get the error "CGContextBlahBlah: invalid context 0x0" I think that this is because I'm not calling the method in drawRect:(). So how am I able to call this method on a touch? Furthermore, how

CGBitmapContextCreate : unsupported parameter combination

笑着哭i 提交于 2019-12-10 13:15:17
问题 I am trying to create a 8-bit grayscale context as follows : CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceGray(); CGContextRef context = CGBitmapContextCreate( data, m_width, m_height, 8, m_width, colorSpace, kCGBitmapByteOrder32Little|kCGImageAlphaNone); But I have the following error : CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 8 bits/pixel; 1-component color space; kCGImageAlphaNone; 1936 bytes/row. Why is this combination unsupported ? 回答1: