¡@

Home 

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

iphone Programming Glossary: cgcontextcliptomask

Cropping image with transparency in iPhone

http://stackoverflow.com/questions/10810798/cropping-image-with-transparency-in-iphone

maskImage.size.width 2 image.size.height ratio maskImage.size.height 2 image.size.width ratio image.size.height ratio CGContextClipToMask mainViewContentContext rect1 maskImageRef CGContextDrawImage mainViewContentContext rect2 image.CGImage CGImageRef newImage.. maskImage.size.width 2 image.size.height ratio maskImage.size.height 2 image.size.width ratio image.size.height ratio CGContextClipToMask mainViewContentContext rect1 maskImageRef CGContextDrawImage mainViewContentContext rect2 image.CGImage Create CGImageRef..

How can I change the saturation of an UIImage?

http://stackoverflow.com/questions/1144768/how-can-i-change-the-saturation-of-an-uiimage

1.0 1.0 CGContextDrawImage context rect self.image.CGImage CGContextSetBlendMode context kCGBlendModeSaturation CGContextClipToMask context self.bounds image.CGImage restricts drawing to within alpha channel CGContextSetRGBFillColor context 0.0 0.0 0.0..

iPhone - How do you color an image?

http://stackoverflow.com/questions/1223340/iphone-how-do-you-color-an-image

baseImage.size.height CGContextScaleCTM ctx 1 1 CGContextTranslateCTM ctx 0 area.size.height CGContextSaveGState ctx CGContextClipToMask ctx area baseImage.CGImage theColor set CGContextFillRect ctx area CGContextRestoreGState ctx CGContextSetBlendMode ctx..

Drawing incrementally in a UIView (iPhone)

http://stackoverflow.com/questions/1798414/drawing-incrementally-in-a-uiview-iphone

rect CGContextRef context UIGraphicsGetCurrentContext CGContextDrawImage context self.bounds maskRef draw the mask CGContextClipToMask context self.bounds maskRef respect alpha mask CGContextSetBlendMode context kCGBlendModeColorBurn set blending mode for.. context cachedImage drawAtPoint CGPointZero if myPoints count 0 Drop drop myPoints objectAtIndex myPoints count 1 CGContextClipToMask ctx self.bounds maskRef respect alpha mask CGContextAddEllipseInRect ctx CGRectMake drop.point.x drop.dropSize 2 drop.point.y.. rect CGContextRef context UIGraphicsGetCurrentContext CGContextDrawImage context self.bounds maskRef draw the mask CGContextClipToMask context self.bounds maskRef respect alpha mask CGContextSetBlendMode context kCGBlendModeColorBurn set blending mode if..

iPhone, reproduce the magnifier effect

http://stackoverflow.com/questions/2030730/iphone-reproduce-the-magnifier-effect

mask UIImage imageNamed @ loupeMask .CGImage UIImage glass UIImage imageNamed @ loupeImage CGContextSaveGState context CGContextClipToMask context bounds mask CGContextFillRect context bounds CGContextScaleCTM context 2.0 2.0 draw your subject view here CGContextRestoreGState..

how to change UITabbar selected color?

http://stackoverflow.com/questions/2506290/how-to-change-uitabbar-selected-color

Setup transparency layer and clip to mask CGContextBeginTransparencyLayer c NULL CGContextScaleCTM c 1.0 1.0 CGContextClipToMask c CGRectMake itemImagePosition.x itemImagePosition.y itemImageSize.width itemImageSize.height itemImage CGImage Fill and..

How to tint a transparent PNG image in iPhone?

http://stackoverflow.com/questions/3514066/how-to-tint-a-transparent-png-image-in-iphone

quite a long time to find out. You can also use one of the blend modes kCGBlendModeSourceIn DestinationIn instead of CGContextClipToMask . If you want to create a UIImage each of the following code sections can be surrounded by the following code UIGraphicsBeginImageContext..

How to get UILabel (UITextView) auto adjusted font size?

http://stackoverflow.com/questions/3669844/how-to-get-uilabel-uitextview-auto-adjusted-font-size

CGContextScaleCTM myContext 1.0 1.0 create mask CGImageRef alphaMask CGBitmapContextCreateImage myContext CGContextClipToMask myContext rect alphaMask rgbColorspace CGColorSpaceCreateDeviceRGB glossGradient CGGradientCreateWithColorComponents rgbColorspace..

layer.renderInContext doesn't take layer.mask into account?

http://stackoverflow.com/questions/4896296/layer-renderincontext-doesnt-take-layer-mask-into-account

the drawing right with coordinate switch CGContextTranslateCTM context 0 cHeight CGContextScaleCTM context 1.0 1.0 CGContextClipToMask context CGRectMake maskLayer.frame.origin.x mod maskLayer.frame.origin.y modTwo maskLayer.frame.size.width mod maskLayer.frame.size.height..

Custom image mask in iOS

http://stackoverflow.com/questions/5880597/custom-image-mask-in-ios

In second option i use firstly use CGImageMaskCreate method i use previously created black mask images of puzzle then CGContextClipToMask . In either options i have problem with performance mostly when i crop image into 16 puzzles and drag in over the screen..

Overlaying a UIImage with a color?

http://stackoverflow.com/questions/845278/overlaying-a-uiimage-with-a-color

drawRect CGRect rect CGRect bounds self bounds UIColor blackColor set CGContextRef context UIGraphicsGetCurrentContext CGContextClipToMask context bounds myImage CGImage CGContextFillRect context bounds Note myImage should be an instance variable that contains..

iOS - How to achieve emboss effect for the text on UILabel?

http://stackoverflow.com/questions/8467141/ios-how-to-achieve-emboss-effect-for-the-text-on-uilabel

mask.size UIGraphicsBeginImageContextWithOptions rect.size NO mask.scale UIColor blackColor setFill UIRectFill rect CGContextClipToMask UIGraphicsGetCurrentContext rect mask.CGImage CGContextClearRect UIGraphicsGetCurrentContext rect UIImage image UIGraphicsGetImageFromCurrentImageContext.. CGContextRef gc UIGraphicsGetCurrentContext Clip to the mask that only allows drawing inside the string's image. CGContextClipToMask gc rect mask.CGImage We apply the mask twice because we're going to draw through it twice. Only applying it once would make.. the mask twice because we're going to draw through it twice. Only applying it once would make the edges too sharp. CGContextClipToMask gc rect mask.CGImage mask nil done with mask let ARC free it Draw the red text. textColor setFill CGContextFillRect gc rect..

Draw glow around inside edge of multiple CGPaths

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

rect.size NO mask.scale Fill the entire image with color. color setFill UIRectFill rect Now erase the masked part. CGContextClipToMask UIGraphicsGetCurrentContext rect mask.CGImage CGContextClearRect UIGraphicsGetCurrentContext rect UIImage image UIGraphicsGetImageFromCurrentImageContext.. Save the graphics state so I can restore the clip and shadow attributes after drawing. CGContextSaveGState gc CGContextClipToMask gc bounds mask.CGImage CGContextSetShadowWithColor gc offset blur color.CGColor invertedImage drawInRect bounds CGContextRestoreGState..

How to mask an image in IOS sdk?

http://stackoverflow.com/questions/9872975/how-to-mask-an-image-in-ios-sdk

whiteColor .CGColor NSLog @ Rect @ CGContextGetClipBoundingBox ctx CGImageRef alphaMask CGBitmapContextCreateImage ctx CGContextClipToMask ctx CGContextGetClipBoundingBox ctx alphaMask draw in context you can use also drawInRect withFont text drawAtPoint CGPointMake..