¡@

Home 

2014/10/15 ¤U¤È 10:05:00

iphone Programming Glossary: cgcontext

How can I check if a user tapped near a CGPath?

http://stackoverflow.com/questions/1143704/how-can-i-check-if-a-user-tapped-near-a-cgpath

the user tapped near one of the paths Here's what I had working UIGraphincsBeginImageContext CGPathGetBoundingBox path CGContextRef g UIGraphicsGetCurrentContext CGContextAddPath g path CGContextSetLineWidth g 15 CGContextReplacePathWithStrokedPath.. what I had working UIGraphincsBeginImageContext CGPathGetBoundingBox path CGContextRef g UIGraphicsGetCurrentContext CGContextAddPath g path CGContextSetLineWidth g 15 CGContextReplacePathWithStrokedPath g CGPath clickArea CGContextCopyPath g Not.. CGPathGetBoundingBox path CGContextRef g UIGraphicsGetCurrentContext CGContextAddPath g path CGContextSetLineWidth g 15 CGContextReplacePathWithStrokedPath g CGPath clickArea CGContextCopyPath g Not documented UIGraphicsEndImageContext..

Iphone CGContextShowTextAtPoint for Japanese characters

http://stackoverflow.com/questions/1237565/iphone-cgcontextshowtextatpoint-for-japanese-characters

CGContextShowTextAtPoint for Japanese characters I am working on an app where I am using CGContextShowTextAtPoint to display text.. CGContextShowTextAtPoint for Japanese characters I am working on an app where I am using CGContextShowTextAtPoint to display text to the screen. I want to also display Japanese characters but CGContextShowTextAtPoint takes.. I am using CGContextShowTextAtPoint to display text to the screen. I want to also display Japanese characters but CGContextShowTextAtPoint takes as its input a C string. So either A How do I change Japanese characters into a C string If this is..

Flipped NSString drawing in CGContext

http://stackoverflow.com/questions/1252343/flipped-nsstring-drawing-in-cgcontext

NSString drawing in CGContext I try to draw a string in this texture http picasaweb.google.it lh photo LkYWBv_S_9v2d6BAfbrhag feat directlink but the.. gltextures i .texCoords 0 size.width gltextures i .texCoords 1 size.height gltextures i .width gltextures i .height CGContextSetStrokeColorWithColor context UIColor redColor CGColor CGContextAddLines context points 4 CGContextClosePath context CGContextDrawPath.. size.height gltextures i .width gltextures i .height CGContextSetStrokeColorWithColor context UIColor redColor CGColor CGContextAddLines context points 4 CGContextClosePath context CGContextDrawPath context kCGPathStroke NSString s NSString stringWithFormat..

Add UIPickerView & a Button in Action sheet - How?

http://stackoverflow.com/questions/1262574/add-uipickerview-a-button-in-action-sheet-how

iPhone development: pointer being freed was not allocated

http://stackoverflow.com/questions/1424210/iphone-development-pointer-being-freed-was-not-allocated

commit_transaction CA Transaction CALayerDisplayIfNeeded CALayer _display CABackingStoreUpdate backing_callback CGContext void CALayer drawInContext UIView CALayerDelegate drawLayer inContext AvatarView drawRect AvatarView overlayPNG UIImageUtility.. 0 0 source.size.width source.size.height UIGraphicsBeginImageContext CGSizeMake source.size.width source.size.height CGContextRef context UIGraphicsGetCurrentContext CGContextTranslateCTM context 0 source.size.height CGContextScaleCTM context 1.0.. CGSizeMake source.size.width source.size.height CGContextRef context UIGraphicsGetCurrentContext CGContextTranslateCTM context 0 source.size.height CGContextScaleCTM context 1.0 1.0 UIImage original self createGrayCopy source CGContextRef..

Setting A CGContext Transparent Background

http://stackoverflow.com/questions/2125543/setting-a-cgcontext-transparent-background

A CGContext Transparent Background I am still struggling with drawing a line with CGContext. I have actually go to line to draw but.. A CGContext Transparent Background I am still struggling with drawing a line with CGContext. I have actually go to line to draw but now I need the background of the Rect to be transparent so the existing background.. of the Rect to be transparent so the existing background shows thru. Here's my test code void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor clearColor .CGColor CGContextSetAlpha..

Using CGContext to display a sprite sheet iPhone

http://stackoverflow.com/questions/2863626/using-cgcontext-to-display-a-sprite-sheet-iphone

CGContext to display a sprite sheet iPhone So I have a spritesheet in png format and have already worked out the coordinates for.. that will return a UIImage when passed the location information on the spritesheet. I'm just not sure how to use the CGContext stuff along with the the coordinates to return an UIImage. I was looking to CGContextClipToRect because I think that is.. I'm just not sure how to use the CGContext stuff along with the the coordinates to return an UIImage. I was looking to CGContextClipToRect because I think that is the way to do it but I just can't seem to get it to work. Something like this CGSize size..

Convert Image to B&W problem CGContext - iPhone Dev

http://stackoverflow.com/questions/3340564/convert-image-to-bw-problem-cgcontext-iphone-dev

Image to B W problem CGContext iPhone Dev I am using a method to convert images taken with the camera into black and white. The problem I'm running into.. colorSpace CGColorSpaceCreateDeviceGray Create bitmap content with current image size and grayscale colorspace CGContextRef context CGBitmapContextCreate nil image.size.width image.size.height 8 0 colorSpace kCGImageAlphaNone Draw image into.. Draw image into current context with specified rectangle using previously defined context with grayscale colorspace CGContextDrawImage context imageRect image CGImage Create bitmap image info from pixel data in current context CGImageRef imageRef..

What's the correct code to save a CGLayer as a PNG file?

http://stackoverflow.com/questions/4064470/whats-the-correct-code-to-save-a-cglayer-as-a-png-file

create the CGLayer called notepad... CGLayerRef notepad CGLayerCreateWithContext yourContext CGSizeMake 1500 1500 NULL CGContextRef notepadContext CGLayerGetContext notepad you can for example write an image in to notepad CGImageRef imageExamp UIImage.. imageExamp UIImage imageWithContentsOfFile NSBundle mainBundle pathForResource @ smallTestImage ofType @ png CGImage CGContextDrawImage notepadContext CGRectMake 100 100 50 50 imageExamp setting the colorspace may or may not be relevant to you CGContextSetFillColorSpace.. notepadContext CGRectMake 100 100 50 50 imageExamp setting the colorspace may or may not be relevant to you CGContextSetFillColorSpace notepadContext CGColorSpaceCreateDeviceRGB you can draw to notepad as much as you like in the normal way..

Create a UIImage by rendering UIWebView on a background thread - iPhone

http://stackoverflow.com/questions/4660999/create-a-uiimage-by-rendering-uiwebview-on-a-background-thread-iphone

from multiple UIWebViews every second and display it on screen iPhone's of course . Because rendering a layer to a CGContext is a CPU consuming job I wouldn't like to use the main thread so not to hang the UI. My attempts so far were I tried to..

What's the best approach to draw lines between views?

http://stackoverflow.com/questions/5847876/whats-the-best-approach-to-draw-lines-between-views

make it dynamically read in the values On the subview use CALayers and draw on there Create a draw line method using CGContext functions Something else Cheers for the help iphone cocoa touch core animation core graphics calayer share improve this..

How to implement alpha gradient on a image?

http://stackoverflow.com/questions/5908731/how-to-implement-alpha-gradient-on-a-image

it. You could generate an appropriate mask simply enough by drawing to a greyscale or alpha only CGBitmapContext with CGContextDrawLinearGradient . If it's being displayed as the content of a CALayer you could apply an appropriate masking layer to.. . Or draw the gradient first and draw the image over it using kCGBlendModeSourceIn . In both cases CGContextDrawLinearGradient is again your friend. Then of course get the image out of the CGContext using CGBitmapContextCreateImage.. . In both cases CGContextDrawLinearGradient is again your friend. Then of course get the image out of the CGContext using CGBitmapContextCreateImage or CGImageCreate on the underlying data buffer. Or of course if you control the original..

Why is UIBezierPath faster than Core Graphics path?

http://stackoverflow.com/questions/6327817/why-is-uibezierpath-faster-than-core-graphics-path

locations but stroking the CGPath takes roughly twice as long as stroking the UIBezierPath. void drawRect CGRect rect CGContextRef ctx UIGraphicsGetCurrentContext Create the two paths cgpath and uipath. CGMutablePathRef cgpath CGPathCreateMutable CGPathMoveToPoint.. controlPoint1 CGPointMake x1 uiBaseline 50 controlPoint2 CGPointMake x2 uiBaseline 50 UIColor blackColor setStroke CGContextAddPath ctx cgpath Stroke each path. self strokeContext ctx self strokeUIBezierPath uipath uipath release CGPathRelease cgpath.. path. self strokeContext ctx self strokeUIBezierPath uipath uipath release CGPathRelease cgpath void strokeContext CGContextRef context CGContextStrokePath context void strokeUIBezierPath UIBezierPath path path stroke Both paths use CGContextStrokePath..

Draw glow around inside edge of multiple CGPaths

http://stackoverflow.com/questions/8480401/draw-glow-around-inside-edge-of-multiple-cgpaths

You'll draw this to make CoreGraphics draw a shadow around the inner edge of the union. Finally set the mask as your CGContext mask set the shadow parameters and draw the inverted image. Ok that sounds complicated. But here's what it looks like Retina.. between them. I use a some UIKit functions and objects. Remember that you can always make UIKit draw to an arbitrary CGContext using UIGraphicsPushContext and UIGraphicsPopContext . First we need an mask image. It should be an alpha channel only image.. bounds.size.height scale Create the bitmap with just an alpha channel. When created it has value 0 at every pixel. CGContextRef gc CGBitmapContextCreate NULL scaledSize.width scaledSize.height 8 scaledSize.width NULL kCGImageAlphaOnly Adjust the..

How do I draw a line on the iPhone?

http://stackoverflow.com/questions/856354/how-do-i-draw-a-line-on-the-iphone

need to implement the drawRect method in MyView.m here's some example code that draws a line void drawRect CGRect rect CGContextRef c UIGraphicsGetCurrentContext CGFloat red 4 1.0f 0.0f 0.0f 1.0f CGContextSetStrokeColor c red CGContextBeginPath c CGContextMoveToPoint.. draws a line void drawRect CGRect rect CGContextRef c UIGraphicsGetCurrentContext CGFloat red 4 1.0f 0.0f 0.0f 1.0f CGContextSetStrokeColor c red CGContextBeginPath c CGContextMoveToPoint c 5.0f 5.0f CGContextAddLineToPoint c 50.0f 50.0f CGContextStrokePath.. CGRect rect CGContextRef c UIGraphicsGetCurrentContext CGFloat red 4 1.0f 0.0f 0.0f 1.0f CGContextSetStrokeColor c red CGContextBeginPath c CGContextMoveToPoint c 5.0f 5.0f CGContextAddLineToPoint c 50.0f 50.0f CGContextStrokePath c Save everything..

How to capture current view screenshot and reuse in code? (iPhone SDK)

http://stackoverflow.com/questions/879064/how-to-capture-current-view-screenshot-and-reuse-in-code-iphone-sdk

Walk the layer hierarchy recursively getting the contents from each layer. If it smells like an image use the CGContext methods to draw it into your context. While walking make sure to apply the transformations positions of each layer as you..

Drawing into OpenGL ES framebuffer and getting UIImage from it on iPhone

http://stackoverflow.com/questions/10936157/drawing-into-opengl-es-framebuffer-and-getting-uiimage-from-it-on-iphone

ref NULL true kCGRenderingIntentDefault UIGraphicsBeginImageContext CGSizeMake width height CGContextRef cgcontext UIGraphicsGetCurrentContext CGContextSetBlendMode cgcontext kCGBlendModeCopy CGContextDrawImage cgcontext CGRectMake 0.0.. CGSizeMake width height CGContextRef cgcontext UIGraphicsGetCurrentContext CGContextSetBlendMode cgcontext kCGBlendModeCopy CGContextDrawImage cgcontext CGRectMake 0.0 0.0 width height iref UIImage image UIGraphicsGetImageFromCurrentImageContext.. CGContextRef cgcontext UIGraphicsGetCurrentContext CGContextSetBlendMode cgcontext kCGBlendModeCopy CGContextDrawImage cgcontext CGRectMake 0.0 0.0 width height iref UIImage image UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext free..

How to erase finger paint on Custom UIView in iPhone

http://stackoverflow.com/questions/11132546/how-to-erase-finger-paint-on-custom-uiview-in-iphone

btnErase id sender IsErase YES @end I have set erase button with functionality but not working. iphone objective c cgcontext paint cgcontextref share improve this question The problem you have is that you are not supposed to call UIGraphicGetContext.. IsErase YES @end I have set erase button with functionality but not working. iphone objective c cgcontext paint cgcontextref share improve this question The problem you have is that you are not supposed to call UIGraphicGetContext outside..

Iphone CGContextShowTextAtPoint for Japanese characters

http://stackoverflow.com/questions/1237565/iphone-cgcontextshowtextatpoint-for-japanese-characters

I manually print Japanese characters to the screen within the drawRect method . Thanks in advance. iphone unicode cjk cgcontext share improve this question CoreText can help you CTFontGetGlyphsForCharacters iOS 3.2 onwards maps Unicode characters..

iphone MPMoviePlayerViewController CGContext Errors

http://stackoverflow.com/questions/13203336/iphone-mpmovieplayerviewcontroller-cgcontext-errors

do not have a value but I have no idea how to remedy this. Any help would be greatly appreciated. iphone xcode cgcontext share improve this question I was having the same issue. Merely saying this MPMoviePlayerViewController mpvc MPMoviePlayerViewController..

Setting A CGContext Transparent Background

http://stackoverflow.com/questions/2125543/setting-a-cgcontext-transparent-background

context 100.0 100.0 CGContextStrokePath context Any ideas iphone graphics background transparent cgcontext share improve this question After UIGraphicsGetCurrentContext call CGContextClearRect context rect Edit Alright got..

Using CGContext to display a sprite sheet iPhone

http://stackoverflow.com/questions/2863626/using-cgcontext-to-display-a-sprite-sheet-iphone

around the spritesheet if that makes sense. Any help would be appreciated. Thanks Mike iphone objective c sprite cgcontext share improve this question I think the call you want to use is CGImageCreateWithImageInRect newImage UIImage imageWithCGImage..

How to erase part of an image as the user touches it

http://stackoverflow.com/questions/2978382/how-to-erase-part-of-an-image-as-the-user-touches-it

any help you may have would be greatly appreciated. Thanks in advance Joel iphone objective c uiimageview uiimage cgcontext share improve this question I've been trying to do the same thing a lot of time ago using just Core Graphics and it..

iPhone CGContext: drawing two lines with two different colors

http://stackoverflow.com/questions/3041776/iphone-cgcontext-drawing-two-lines-with-two-different-colors

CGContextAddLineToPoint bluecontext 200 100 CGContextStrokePath bluecontext thanks for your help iphone line draw cgcontext share improve this question Insert this code just before you set the stroke color the second time CGContextStrokePath..

Convert Image to B&W problem CGContext - iPhone Dev

http://stackoverflow.com/questions/3340564/convert-image-to-bw-problem-cgcontext-iphone-dev

context CFRelease imageRef Return the new grayscale image return newImage @lessfame iphone objective c camera ios cgcontext share improve this question K I got it. What I ended up doing is finding this function that rotates images based off..

Drawing in CATiledLayer with CoreGraphics CGContextDrawImage

http://stackoverflow.com/questions/4067512/drawing-in-catiledlayer-with-coregraphics-cgcontextdrawimage

draw more pixels more CATiledLayers or sublayers are used to fill the screen. Thanks alot Thomas iphone core graphics cgcontext catiledlayer share improve this question Thomas I started by following the WWDC 2010 ScrollView talk and there is little..

Drawing into CGImageRef

http://stackoverflow.com/questions/4257043/drawing-into-cgimageref

If you can provide code to create an empty CGImageRef image and draw to it I would appreciate. iphone graphics cgcontext share improve this question #define HIRESDEVICE int rintf UIScreen mainScreen currentMode size .width UIScreen mainScreen..

Create a UIImage by rendering UIWebView on a background thread - iPhone

http://stackoverflow.com/questions/4660999/create-a-uiimage-by-rendering-uiwebview-on-a-background-thread-iphone

neither of them . I'm pretty close to giving up. Is there a savior among you people iphone ios uiwebview calayer cgcontext share improve this question UIWebView hates and I mean really hates having anything done to it on a background thread...

How to use NSString's sizeWithFont and drawInRect to workout how much of a string to draw

http://stackoverflow.com/questions/4965809/how-to-use-nsstrings-sizewithfont-and-drawinrect-to-workout-how-much-of-a-strin

perfectly fits the page and then chop the string at that point Is there a smarter way Any ideas Thanks. iphone ios cgcontext sizewithfont share improve this question The NSString additions to UIKit for drawing text you can pre determine the..

iPhone CGContextRef CGBitmapContextCreate unsupported parameter combination

http://stackoverflow.com/questions/5545600/iphone-cgcontextref-cgbitmapcontextcreate-unsupported-parameter-combination

newImageRef return newImage Can someone explain to me way I have this issue Thank you Andrei iphone uiimage cgcontext cgimage cgbitmapcontextcreate share improve this question I figured out it's a problem with the color space. Just replace..

Line graphs on iOS [closed]

http://stackoverflow.com/questions/7254882/line-graphs-on-ios

graphs on iOS without using Core Plot but using inbuilt frameworks Desperately searching for an answer. iphone ios cgcontext linegraph share improve this question Some of the charting libraries for iPhone iPad that I found were http code.google.com..

iPhone take augmented reality screenshot with AVCaptureVideoPreviewLayer

http://stackoverflow.com/questions/8980847/iphone-take-augmented-reality-screenshot-with-avcapturevideopreviewlayer

width heightInPoints height UIGraphicsBeginImageContext CGSizeMake widthInPoints heightInPoints CGContextRef cgcontext UIGraphicsGetCurrentContext UIKit coordinate system is upside down to GL Quartz coordinate system Flip the CGImage by rendering.. it to the flipped bitmap context The size of the destination area is measured in POINTS CGContextSetBlendMode cgcontext kCGBlendModeCopy CGContextDrawImage cgcontext CGRectMake 0.0 0.0 widthInPoints heightInPoints iref Retrieve the UIImage.. size of the destination area is measured in POINTS CGContextSetBlendMode cgcontext kCGBlendModeCopy CGContextDrawImage cgcontext CGRectMake 0.0 0.0 widthInPoints heightInPoints iref Retrieve the UIImage from the current context UIImage image UIGraphicsGetImageFromCurrentImageContext..