ˇ@

Home 

2014/10/15 ¤U¤Č 10:09:55

iphone Programming Glossary: graphics

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

values were what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics quartz graphics share improve this question Yes CGContexts have their y axis pointing up while in.. what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics quartz graphics share improve this question Yes CGContexts have their y axis pointing up while in UIKit it points..

How do I make UILabel display outlined text?

http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text

staring at it intently and frowning really really hard. objective c iphone cocoa touch core graphics share improve this question I was able to do it by overriding drawTextInRect void drawTextInRect..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

size BTW . Can any of you show me how to just ROTATE my UIImage 90 degrees CCW using just core graphics functions while preserving the current size UIImage reverseImageByScalingToSize CGSize targetSize UIImage.. ref CGContextRelease bitmap CGImageRelease ref return newImage iphone uikit uiimage core graphics rotation share improve this question What about something like static inline double radians double..

Resize UIImage with aspect ratio?

http://stackoverflow.com/questions/1703100/resize-uiimage-with-aspect-ratio

image size. Is there an easy way to do this similar to what I'm doing Thanks iphone uiimage core graphics share improve this question After you set your screen rect do something like the following to decide..

Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]

http://stackoverflow.com/questions/2244147/disabling-implicit-animations-in-calayer-setneedsdisplayinrect

to update just the changed parts. This is working splendidly. However when the graphics system updates my layer it's transitioning from the old to the new image using a cross fade. I'd like..

Rounded UIView using CALayers - only some corners - How?

http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how

viewDidLoad MyView is just a UIImageView subclass @interface MyView UIImageView I'd never used graphics contexts before but I managed to hobble together this code. It's missing the code for two of the corners...

iPhone image stretching (skew)

http://stackoverflow.com/questions/2351586/iphone-image-stretching-skew

be converted to the actual 3D vector x w y w z w before projection if CA follows usual 3D compute graphics rules so you could cheat by using the transform P . . Q x x' . R . S y y' . . 1 . z z' . T . U 1 w'..

Get PDF hyperlinks on iOS with Quartz

http://stackoverflow.com/questions/4080373/get-pdf-hyperlinks-on-ios-with-quartz

top of your page and use it to open the URL with UIApplication's openURL iphone ipad pdf quartz graphics share improve this question heres the basic idea to get to the annots CGPDFDictionary for each page..

Gradients on UIView and UILabels On iPhone [duplicate]

http://stackoverflow.com/questions/422066/gradients-on-uiview-and-uilabels-on-iphone

either a View or Label but the back ground must be a gradient as opposed to a true color. Using a graphics program to create desired look is no good as the text may vary depending on data returned from a server...

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

again not sure how to achieve the inner shadow effect like this Help appreciated... iphone core graphics calayer share improve this question For anyone else wondering how to draw an inner shadow using..

Is there a way to make drawRect work right NOW?

http://stackoverflow.com/questions/4739748/is-there-a-way-to-make-drawrect-work-right-now

astounding solutions in the other specific question hope it helps. iphone ios cocoa quartz graphics runloop share improve this question Updates to the user interface happen at the end of the current..

Round two corners in UIView

http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview

context CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image context CGBitmapContextCreate NULL rect.size.width rect.size.height 8..

Can I use CGAffineTransformMakeRotation to rotate a view more than 360 degrees?

http://stackoverflow.com/questions/542739/can-i-use-cgaffinetransformmakerotation-to-rotate-a-view-more-than-360-degrees

or would OpenGL be a better route to go Thanks Blake. iphone cocoa touch core animation core graphics share improve this question You can rotate a view by some number of radians regardless of whether..

UIImage: Resize, then Crop

http://stackoverflow.com/questions/603907/uiimage-resize-then-crop

just not work correctly. Thank you SO much for your help. iphone ios image processing core graphics share improve this question I needed the same thing in my case to pick the dimension that fits once..

How do I draw a shadow under a UIView?

http://stackoverflow.com/questions/805872/how-do-i-draw-a-shadow-under-a-uiview

to draw the shadow but the Quartz 2D programming guide is a little vague Save the graphics state. Call the function CGContextSetShadow passing the appropriate values. Perform all the drawing.. the appropriate values. Perform all the drawing to which you want to apply shadows. Restore the graphics state I've tried the following in a UIView subclass void drawRect CGRect rect CGContextRef currentContext.. anything I need to do to my UIView to make this work iphone objective c ios cocoa touch core graphics share improve this question In your current code you save the GState of the current context configure..

How do I draw a line on the iPhone?

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

for the purpose of study using Quartz and UIKit. How do I start drawing iphone cocoa touch quartz graphics share improve this question The first step is to define a subclass of UIView to create a space to..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

zero values for the alpha channel. Do I need to translate the co ordinates between UIKit and Core Graphics i.e is the y axis inverted Or have I misunderstood premultiplied alpha values Update @Nikolai Ruhe's.. suggestion was key to this. I did not in fact need to translate between UIKit coordinates and Core Graphics coordinates. However after setting the blend mode my alpha values were what I expected CGContextSetBlendMode..

How would I tint an image programatically on the iPhone?

http://stackoverflow.com/questions/1117211/how-would-i-tint-an-image-programatically-on-the-iphone

code and it works like a charm Final final update For those of you just learning about Core Graphics here is the simplest thing that could possibly work. In your subclassed UIView void drawRect CGRect.. could possibly work. In your subclassed UIView void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColor context CGColorGetComponents UIColor colorWithRed 0.5 green 0.5.. with the proper blending mode something like this void drawRect CGRect area CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context Draw picture first CGContextDrawImage context self.frame..

How can i change the color of pagination dots of UIPageControl?

http://stackoverflow.com/questions/2942636/how-can-i-change-the-color-of-pagination-dots-of-uipagecontrol

today and decided to write my own simple replacement class. It's a sublassed UIView that uses Core Graphics to render the dots in the colors you specify. You use the exposed properties to customize and control.. recognizer self.currentPage void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetAllowsAntialiasing context true CGRect currentBounds self.bounds CGFloat..

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

share improve this question For anyone else wondering how to draw an inner shadow using Core Graphics as per Costique suggestion then this is how on iOS adjust as needed In your drawRect method... CGRect.. iOS adjust as needed In your drawRect method... CGRect bounds self bounds CGContextRef context UIGraphicsGetCurrentContext CGFloat radius 0.5f CGRectGetHeight bounds Create the visible path which will be the..

Customize the MKAnnotationView callout

http://stackoverflow.com/questions/8018841/customize-the-mkannotationview-callout

behaviour but this time the view returned CalloutView is initialized from a XIB and contains Core Graphics code in BaseCalloutView to animate and replicate a callout. The initializer of the CalloutView class..

How do I draw a line on the iPhone?

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

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.. Build and Run you should now see a short red line on the iPhone. For more information about Core Graphics look up the Apple Documentation. I've also found it helpful to search for functions beginning with CGContext..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

coordinates. However after setting the blend mode my alpha values were what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics quartz graphics share improve this question Yes CGContexts have their y axis pointing up while in UIKit it points down. See the docs . Edit after reading code.. However after setting the blend mode my alpha values were what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics quartz graphics share improve this question Yes CGContexts have their y axis pointing up while in UIKit it points down. See the docs . Edit after reading code You also want..

How do I make UILabel display outlined text?

http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text

seem to get drawTextInRect to bend to my will at all despite staring at it intently and frowning really really hard. objective c iphone cocoa touch core graphics share improve this question I was able to do it by overriding drawTextInRect void drawTextInRect CGRect rect CGSize shadowOffset self.shadowOffset UIColor textColor..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

get an error whenever I provide a SMALLER size as the target size BTW . Can any of you show me how to just ROTATE my UIImage 90 degrees CCW using just core graphics functions while preserving the current size UIImage reverseImageByScalingToSize CGSize targetSize UIImage anImage UIImage sourceImage anImage CGFloat targetWidth.. bitmap UIImage newImage UIImage imageWithCGImage ref CGContextRelease bitmap CGImageRelease ref return newImage iphone uikit uiimage core graphics rotation share improve this question What about something like static inline double radians double degrees return degrees M_PI 180 UIImage rotate UIImage src..

Resize UIImage with aspect ratio?

http://stackoverflow.com/questions/1703100/resize-uiimage-with-aspect-ratio

on the top and bottom or sides depending on the original image size. Is there an easy way to do this similar to what I'm doing Thanks iphone uiimage core graphics share improve this question After you set your screen rect do something like the following to decide what rect to draw the image in float hfactor value.bounds.size.width..

Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]

http://stackoverflow.com/questions/2244147/disabling-implicit-animations-in-calayer-setneedsdisplayinrect

minimize the amount of drawing I need to do so I'm using setNeedsDisplayInRect to update just the changed parts. This is working splendidly. However when the graphics system updates my layer it's transitioning from the old to the new image using a cross fade. I'd like it to switch over instantly. I've tried using CATransaction..

Rounded UIView using CALayers - only some corners - How?

http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how

alloc initWithFrame rect self.view addSubview myView super viewDidLoad MyView is just a UIImageView subclass @interface MyView UIImageView I'd never used graphics contexts before but I managed to hobble together this code. It's missing the code for two of the corners. If you read the code you can see how I implemented this..

iPhone image stretching (skew)

http://stackoverflow.com/questions/2351586/iphone-image-stretching-skew

as a 2D transform either. However the vector x y z w 1 will be converted to the actual 3D vector x w y w z w before projection if CA follows usual 3D compute graphics rules so you could cheat by using the transform P . . Q x x' . R . S y y' . . 1 . z z' . T . U 1 w' with appropriate P Q R S T U that maps the 4 points to the expected..

Get PDF hyperlinks on iOS with Quartz

http://stackoverflow.com/questions/4080373/get-pdf-hyperlinks-on-ios-with-quartz

coordinates. e.g. you could create a button and put it on top of your page and use it to open the URL with UIApplication's openURL iphone ipad pdf quartz graphics share improve this question heres the basic idea to get to the annots CGPDFDictionary for each page atleast. after that you should be able to figure it out..

Gradients on UIView and UILabels On iPhone [duplicate]

http://stackoverflow.com/questions/422066/gradients-on-uiview-and-uilabels-on-iphone

in iPhone apps My application needs to display text in either a View or Label but the back ground must be a gradient as opposed to a true color. Using a graphics program to create desired look is no good as the text may vary depending on data returned from a server. Does anyone know the quickest way to tackle this Your thoughts..

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

I am at a loss as to what to do I could add another layer but again not sure how to achieve the inner shadow effect like this Help appreciated... iphone core graphics calayer share improve this question For anyone else wondering how to draw an inner shadow using Core Graphics as per Costique suggestion then this is how on..

Is there a way to make drawRect work right NOW?

http://stackoverflow.com/questions/4739748/is-there-a-way-to-make-drawrect-work-right-now

mystery progressive slowdown ... Felz and Void have each presented astounding solutions in the other specific question hope it helps. iphone ios cocoa quartz graphics runloop share improve this question Updates to the user interface happen at the end of the current pass through the run loop. These updates are performed on..

Round two corners in UIView

http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview

CGFloat radius_tr CGFloat radius_bl CGFloat radius_br CGContextRef context CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image context CGBitmapContextCreate NULL rect.size.width rect.size.height 8 0 colorSpace kCGImageAlphaPremultipliedLast free the rgb colorspace..

Can I use CGAffineTransformMakeRotation to rotate a view more than 360 degrees?

http://stackoverflow.com/questions/542739/can-i-use-cgaffinetransformmakerotation-to-rotate-a-view-more-than-360-degrees

using another thread or a timer to do the animation myself or would OpenGL be a better route to go Thanks Blake. iphone cocoa touch core animation core graphics share improve this question You can rotate a view by some number of radians regardless of whether it is less than a full rotation or many multiples of a full..

UIImage: Resize, then Crop

http://stackoverflow.com/questions/603907/uiimage-resize-then-crop

be upside down look like crap draw out of bounds or otherwise just not work correctly. Thank you SO much for your help. iphone ios image processing core graphics share improve this question I needed the same thing in my case to pick the dimension that fits once scaled and then crop each end to fit the rest to the width...

How do I draw a shadow under a UIView?

http://stackoverflow.com/questions/805872/how-do-i-draw-a-shadow-under-a-uiview

a UIView in Cocoa Touch. I understand that I should use CGContextSetShadow to draw the shadow but the Quartz 2D programming guide is a little vague Save the graphics state. Call the function CGContextSetShadow passing the appropriate values. Perform all the drawing to which you want to apply shadows. Restore the graphics state.. graphics state. Call the function CGContextSetShadow passing the appropriate values. Perform all the drawing to which you want to apply shadows. Restore the graphics state I've tried the following in a UIView subclass void drawRect CGRect rect CGContextRef currentContext UIGraphicsGetCurrentContext CGContextSaveGState currentContext.. me and I'm a bit stuck about a where to go next and b if there's anything I need to do to my UIView to make this work iphone objective c ios cocoa touch core graphics share improve this question In your current code you save the GState of the current context configure it to draw a shadow .. and the restore it to what it was..

How do I draw a line on the iPhone?

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

and would like to draw a line to the phone screen for the purpose of study using Quartz and UIKit. How do I start drawing iphone cocoa touch quartz graphics share improve this question The first step is to define a subclass of UIView to create a space to draw in. If you're starting with a new application the easiest..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

a completely black transparent area of the image I get non zero values for the alpha channel. Do I need to translate the co ordinates between UIKit and Core Graphics i.e is the y axis inverted Or have I misunderstood premultiplied alpha values Update @Nikolai Ruhe's suggestion was key to this. I did not in fact need to translate.. premultiplied alpha values Update @Nikolai Ruhe's suggestion was key to this. I did not in fact need to translate between UIKit coordinates and Core Graphics coordinates. However after setting the blend mode my alpha values were what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics..

How would I tint an image programatically on the iPhone?

http://stackoverflow.com/questions/1117211/how-would-i-tint-an-image-programatically-on-the-iphone

that had an imageView set up properly so I could test Ramin's code and it works like a charm Final final update For those of you just learning about Core Graphics here is the simplest thing that could possibly work. In your subclassed UIView void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColor.. learning about Core Graphics here is the simplest thing that could possibly work. In your subclassed UIView void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColor context CGColorGetComponents UIColor colorWithRed 0.5 green 0.5 blue 0 alpha 1 .CGColor don't make color too saturated CGContextFillRect.. it with a rectangle filled with the color you want along with the proper blending mode something like this void drawRect CGRect area CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context Draw picture first CGContextDrawImage context self.frame self.image.CGImage Blend mode could be any of CGBlendMode..

How can i change the color of pagination dots of UIPageControl?

http://stackoverflow.com/questions/2942636/how-can-i-change-the-color-of-pagination-dots-of-uipagecontrol

share improve this question I ran into this problem today and decided to write my own simple replacement class. It's a sublassed UIView that uses Core Graphics to render the dots in the colors you specify. You use the exposed properties to customize and control it. If you want to you can register a delegate object to get.. recognizer self.currentPage void swipedRight UISwipeGestureRecognizer recognizer self.currentPage void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetAllowsAntialiasing context true CGRect currentBounds self.bounds CGFloat dotsWidth self.numberOfPages kDotDiameter MAX 0 self.numberOfPages..

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

like this Help appreciated... iphone core graphics calayer share improve this question For anyone else wondering how to draw an inner shadow using Core Graphics as per Costique suggestion then this is how on iOS adjust as needed In your drawRect method... CGRect bounds self bounds CGContextRef context UIGraphicsGetCurrentContext.. Core Graphics as per Costique suggestion then this is how on iOS adjust as needed In your drawRect method... CGRect bounds self bounds CGContextRef context UIGraphicsGetCurrentContext CGFloat radius 0.5f CGRectGetHeight bounds Create the visible path which will be the shape that gets the inner shadow In this case it's just a..

Customize the MKAnnotationView callout

http://stackoverflow.com/questions/8018841/customize-the-mkannotationview-callout

annotation CalloutAnnotation is added which follows the same behaviour but this time the view returned CalloutView is initialized from a XIB and contains Core Graphics code in BaseCalloutView to animate and replicate a callout. The initializer of the CalloutView class id initWithAnnotation CalloutAnnotation annotation NSString..

How do I draw a line on the iPhone?

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

MyView. Next you 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 c 5.0f 5.0f CGContextAddLineToPoint c.. c 50.0f 50.0f CGContextStrokePath c Save everything and click Build and Run you should now see a short red line on the iPhone. For more information about Core Graphics look up the Apple Documentation. I've also found it helpful to search for functions beginning with CGContext in the Xcode documentation viewer and browse through..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

the blend mode my alpha values were what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics quartz graphics share improve this question Yes CGContexts have their y axis pointing up while in UIKit it points down... my alpha values were what I expected CGContextSetBlendMode context kCGBlendModeCopy iphone uikit core graphics quartz graphics share improve this question Yes CGContexts have their y axis pointing up while in UIKit it points down. See the docs..

How do I make UILabel display outlined text?

http://stackoverflow.com/questions/1103148/how-do-i-make-uilabel-display-outlined-text

to my will at all despite staring at it intently and frowning really really hard. objective c iphone cocoa touch core graphics share improve this question I was able to do it by overriding drawTextInRect void drawTextInRect CGRect rect CGSize..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

size as the target size BTW . Can any of you show me how to just ROTATE my UIImage 90 degrees CCW using just core graphics functions while preserving the current size UIImage reverseImageByScalingToSize CGSize targetSize UIImage anImage UIImage.. UIImage imageWithCGImage ref CGContextRelease bitmap CGImageRelease ref return newImage iphone uikit uiimage core graphics rotation share improve this question What about something like static inline double radians double degrees return degrees..

Resize UIImage with aspect ratio?

http://stackoverflow.com/questions/1703100/resize-uiimage-with-aspect-ratio

on the original image size. Is there an easy way to do this similar to what I'm doing Thanks iphone uiimage core graphics share improve this question After you set your screen rect do something like the following to decide what rect to draw..

Disabling implicit animations in -[CALayer setNeedsDisplayInRect:]

http://stackoverflow.com/questions/2244147/disabling-implicit-animations-in-calayer-setneedsdisplayinrect

do so I'm using setNeedsDisplayInRect to update just the changed parts. This is working splendidly. However when the graphics system updates my layer it's transitioning from the old to the new image using a cross fade. I'd like it to switch over..

Rounded UIView using CALayers - only some corners - How?

http://stackoverflow.com/questions/2264083/rounded-uiview-using-calayers-only-some-corners-how

addSubview myView super viewDidLoad MyView is just a UIImageView subclass @interface MyView UIImageView I'd never used graphics contexts before but I managed to hobble together this code. It's missing the code for two of the corners. If you read the..

iPhone image stretching (skew)

http://stackoverflow.com/questions/2351586/iphone-image-stretching-skew

x y z w 1 will be converted to the actual 3D vector x w y w z w before projection if CA follows usual 3D compute graphics rules so you could cheat by using the transform P . . Q x x' . R . S y y' . . 1 . z z' . T . U 1 w' with appropriate P Q..

Get PDF hyperlinks on iOS with Quartz

http://stackoverflow.com/questions/4080373/get-pdf-hyperlinks-on-ios-with-quartz

button and put it on top of your page and use it to open the URL with UIApplication's openURL iphone ipad pdf quartz graphics share improve this question heres the basic idea to get to the annots CGPDFDictionary for each page atleast. after that..

Gradients on UIView and UILabels On iPhone [duplicate]

http://stackoverflow.com/questions/422066/gradients-on-uiview-and-uilabels-on-iphone

to display text in either a View or Label but the back ground must be a gradient as opposed to a true color. Using a graphics program to create desired look is no good as the text may vary depending on data returned from a server. Does anyone know..

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

add another layer but again not sure how to achieve the inner shadow effect like this Help appreciated... iphone core graphics calayer share improve this question For anyone else wondering how to draw an inner shadow using Core Graphics as per..

Is there a way to make drawRect work right NOW?

http://stackoverflow.com/questions/4739748/is-there-a-way-to-make-drawrect-work-right-now

Void have each presented astounding solutions in the other specific question hope it helps. iphone ios cocoa quartz graphics runloop share improve this question Updates to the user interface happen at the end of the current pass through the..

Round two corners in UIView

http://stackoverflow.com/questions/4847163/round-two-corners-in-uiview

radius_br CGContextRef context CGColorSpaceRef colorSpace colorSpace CGColorSpaceCreateDeviceRGB create a bitmap graphics context the size of the image context CGBitmapContextCreate NULL rect.size.width rect.size.height 8 0 colorSpace kCGImageAlphaPremultipliedLast..

Can I use CGAffineTransformMakeRotation to rotate a view more than 360 degrees?

http://stackoverflow.com/questions/542739/can-i-use-cgaffinetransformmakerotation-to-rotate-a-view-more-than-360-degrees

do the animation myself or would OpenGL be a better route to go Thanks Blake. iphone cocoa touch core animation core graphics share improve this question You can rotate a view by some number of radians regardless of whether it is less than a..

UIImage: Resize, then Crop

http://stackoverflow.com/questions/603907/uiimage-resize-then-crop

out of bounds or otherwise just not work correctly. Thank you SO much for your help. iphone ios image processing core graphics share improve this question I needed the same thing in my case to pick the dimension that fits once scaled and then..

How do I draw a shadow under a UIView?

http://stackoverflow.com/questions/805872/how-do-i-draw-a-shadow-under-a-uiview

that I should use CGContextSetShadow to draw the shadow but the Quartz 2D programming guide is a little vague Save the graphics state. Call the function CGContextSetShadow passing the appropriate values. Perform all the drawing to which you want to.. passing the appropriate values. Perform all the drawing to which you want to apply shadows. Restore the graphics state I've tried the following in a UIView subclass void drawRect CGRect rect CGContextRef currentContext UIGraphicsGetCurrentContext.. go next and b if there's anything I need to do to my UIView to make this work iphone objective c ios cocoa touch core graphics share improve this question In your current code you save the GState of the current context configure it to draw a shadow..

How do I draw a line on the iPhone?

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

to the phone screen for the purpose of study using Quartz and UIKit. How do I start drawing iphone cocoa touch quartz graphics share improve this question The first step is to define a subclass of UIView to create a space to draw in. If you're..

Retrieving a pixel alpha value for a UIImage

http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage

the image I get non zero values for the alpha channel. Do I need to translate the co ordinates between UIKit and Core Graphics i.e is the y axis inverted Or have I misunderstood premultiplied alpha values Update @Nikolai Ruhe's suggestion was key.. @Nikolai Ruhe's suggestion was key to this. I did not in fact need to translate between UIKit coordinates and Core Graphics coordinates. However after setting the blend mode my alpha values were what I expected CGContextSetBlendMode context kCGBlendModeCopy..

iPhone board game: OpenGL ES or CoreGraphics? [closed]

http://stackoverflow.com/questions/1082511/iphone-board-game-opengl-es-or-coregraphics

board game OpenGL ES or CoreGraphics closed I want to program a board game similar to checkers for the iPhone. Would OpenGL ES or CoreGraphics be a better option.. ES or CoreGraphics closed 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 iphone opengl es core graphics share improve.. Animation or even just UIViews themselves. If you do direct drawing of all of your elements in a single view via Core Graphics then refresh that view for every animation frame you'll get horrible performance. I'd suggest drawing the discrete elements..

How would I tint an image programatically on the iPhone?

http://stackoverflow.com/questions/1117211/how-would-i-tint-an-image-programatically-on-the-iphone

so I could test Ramin's code and it works like a charm Final final update For those of you just learning about Core Graphics here is the simplest thing that could possibly work. In your subclassed UIView void drawRect CGRect rect CGContextRef context.. simplest thing that could possibly work. In your subclassed UIView void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColor context CGColorGetComponents UIColor colorWithRed 0.5 green 0.5 blue 0 alpha 1 .CGColor.. you want along with the proper blending mode something like this void drawRect CGRect area CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context Draw picture first CGContextDrawImage context self.frame self.image.CGImage..

How do I add a gradient to the text of a UILabel, but not the background?

http://stackoverflow.com/questions/1266179/how-do-i-add-a-gradient-to-the-text-of-a-uilabel-but-not-the-background

done by subclassing UILabel and overriding drawRect to have code like the following within it CGContextRef context UIGraphicsGetCurrentContext CGContextSaveGState context CGContextTranslateCTM context 0.0f self.bounds.size.height CGContextScaleCTM.. CGColorSpaceRelease rgbColorspace CGContextRestoreGState context One shortcoming of this approach is that the Core Graphics functions I use don't handle Unicode text properly. What the code does is it flips the drawing context vertically the iPhone..

What's the difference between NSNumber and NSInteger?

http://stackoverflow.com/questions/1285098/whats-the-difference-between-nsnumber-and-nsinteger

always meant to be in seconds without having to deal with a struct. When you move into the graphics world where Core Graphics lives suddenly floats are all around you hovering in the air haha . So it makes sense to introduce a CGFloat there. This..

How can i create a PDF file programmatically in an iphone application?

http://stackoverflow.com/questions/1360912/how-can-i-create-a-pdf-file-programmatically-in-an-iphone-application

Any Suggestion. iphone share improve this question See pg 35 of Drawing with Quartz to see how to create a PDF Graphics Context. Some notes iPhoneOSNote If you want to create a PDF graphics context in an iPhone application make sure you also.. If you want to create a PDF graphics context in an iPhone application make sure you also read śDrawing to a Graphics Context in iPhone OS page 27 . You can write any content to a PDF that ™s appropriate for your application ”images text path..

How can i change the color of pagination dots of UIPageControl?

http://stackoverflow.com/questions/2942636/how-can-i-change-the-color-of-pagination-dots-of-uipagecontrol

into this problem today and decided to write my own simple replacement class. It's a sublassed UIView that uses Core Graphics to render the dots in the colors you specify. You use the exposed properties to customize and control it. If you want to.. void swipedRight UISwipeGestureRecognizer recognizer self.currentPage void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGContextSetAllowsAntialiasing context true CGRect currentBounds self.bounds CGFloat dotsWidth self.numberOfPages..

iPhone - Draw transparent rectangle on UIView to reveal view beneath

http://stackoverflow.com/questions/3800278/iphone-draw-transparent-rectangle-on-uiview-to-reveal-view-beneath

section . topView.opaque NO topView.backgroundColor UIColor clearColor If you want to do circles you have to use Core Graphics aka Quartz 2D . You'll probably want to read the programming guide which is available here . To draw an ellipse instead.. would look something like this void drawRect CGRect rect Get the current graphics context CGContextRef context UIGraphicsGetCurrentContext CGContextSetFillColorWithColor context UIColor blueColor .CGColor CGContextFillRect context rect if CGRectIntersects..

Inner shadow effect on UIView layer?

http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer

core graphics calayer share improve this question For anyone else wondering how to draw an inner shadow using Core Graphics as per Costique suggestion then this is how on iOS adjust as needed In your drawRect method... CGRect bounds self bounds.. then this is how on iOS adjust as needed In your drawRect method... CGRect bounds self bounds CGContextRef context UIGraphicsGetCurrentContext CGFloat radius 0.5f CGRectGetHeight bounds Create the visible path which will be the shape that gets the..

Get RGB value from UIColor presets

http://stackoverflow.com/questions/4700168/get-rgb-value-from-uicolor-presets

blue CGFloat blue alpha CGFloat alpha In iOS 4 and earlier the only way I know of for doing this is to create a Core Graphics bitmap context in an RGB color space and draw into it with your color. You can then read out the RGB values from the resulting..

What do I have to learn to get done with a 3D racing game for the iPhone? What Tools do I need?

http://stackoverflow.com/questions/581784/what-do-i-have-to-learn-to-get-done-with-a-3d-racing-game-for-the-iphone-what-t

Wavefront OBJ modeler on the iPhone that may help in that regard. For a good text on OpenGL ES I'd recommend Mobile 3D Graphics with OpenGL ES and M3G . When it comes to Cocoa development in general it will take you a little while to get up to speed...

How can I edit PDF files in an iOS application?

http://stackoverflow.com/questions/6846785/how-can-i-edit-pdf-files-in-an-ios-application

PDF back into the documents directory. Is this possible within an iOS application If so how Is this a task for Core Graphics iphone objective c ios ipad core graphics share improve this question Editing PDF directly on iPad iPhone is a rather..

Customize the MKAnnotationView callout

http://stackoverflow.com/questions/8018841/customize-the-mkannotationview-callout

follows the same behaviour but this time the view returned CalloutView is initialized from a XIB and contains Core Graphics code in BaseCalloutView to animate and replicate a callout. The initializer of the CalloutView class id initWithAnnotation..

Most efficient way to draw part of an image in iOS

http://stackoverflow.com/questions/8035673/most-efficient-way-to-draw-part-of-an-image-in-ios

CGRect without scaling For reference this is how I currently do it void drawRect CGRect rect CGContextRef context UIGraphicsGetCurrentContext CGRect frameRect CGRectMake frameOrigin.x rect.origin.x frameOrigin.y rect.origin.y rect.size.width rect.size.height.. memory architecture but anyway initial design intention of CGImage seems to be for CPU. So it seems to be done in CPU. Graphics operations done in CPU are a lot slower than in GPU. Simply clipping an image and compositing the image layers are very..

How do I draw a line on the iPhone?

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

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.. everything and click Build and Run you should now see a short red line on the iPhone. For more information about Core Graphics look up the Apple Documentation. I've also found it helpful to search for functions beginning with CGContext in the Xcode..

Newbie wants to create a PDF reader for ipod touch - what's the best approach?

http://stackoverflow.com/questions/93297/newbie-wants-to-create-a-pdf-reader-for-ipod-touch-whats-the-best-approach

zoom able single pages with a previous next page function. iphone pdf ipod share improve this question The Core Graphics API is pretty much the same in Cocoa and Cocoa touch. Read up on CGPDFDocument it should provide you with everything you..