iphone Programming Glossary: alpha
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage a pixel alpha value for a UIImage I am currently trying to obtain the alpha value of a pixel in a UIImageView. I.. a pixel alpha value for a UIImage I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from UIImageView image and created a.. 0 0 width height image CGContextRelease context I then calculate the array index for the given alpha channel using the coordinates from the UIImageView. int byteIndex bytesPerRow uiViewPoint.y uiViewPoint.x..
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 CGContextSetFillColor context CGColorGetComponents UIColor colorWithRed 0.5 green 0.5 blue 0 alpha 1 .CGColor don't make color too saturated CGContextFillRect context rect draw base UIImage imageNamed.. rect draw base UIImage imageNamed @ someImage.png drawInRect rect blendMode kCGBlendModeOverlay alpha 1.0 draw image iphone cocoa touch image processing share improve this question First you'll want..
How to get the RGB values for a pixel on an image on the iphone http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone pixel A working code sample would be most appreciated and note that I am not concerned with the alpha value. iphone cocoa touch image bitmap share improve this question A little more detail... I posted.. A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function.. struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function returns pre calculated RGBA divide RGB by A to get unmodified RGB RGBAPixel..
Resize UIImage with aspect ratio? http://stackoverflow.com/questions/1703100/resize-uiimage-with-aspect-ratio screenRect.size value drawInRect screenRect blendMode kCGBlendModePlusDarker alpha 1 UIImage tmpValue UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext Which is working..
Creating a left-arrow button (like UINavigationBar's “back” style) on a UIToolbar http://stackoverflow.com/questions/227078/creating-a-left-arrow-button-like-uinavigationbars-back-style-on-a-uitoolba could manually create it with button images but I can't find the source images anywhere. They have alpha channel edges so screenshotting and cutting won't get very versatile results. Any ideas beyond screenshotting..
Inner shadow effect on UIView layer? http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer setup the shadow properties on the context aColor UIColor colorWithRed 0.0f green 0.0f blue 0.0f alpha 0.5f CGContextSaveGState context CGContextSetShadowWithColor context CGSizeMake 0.0f 1.0f 3.0f aColor..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller file include @synthesize bgimage spinner loadingLabel add this in ViewDidLoad set loading label to alpha 0 so its not displayed loadingLabel.alpha 0 everything else is its own function void sendEmail create.. add this in ViewDidLoad set loading label to alpha 0 so its not displayed loadingLabel.alpha 0 everything else is its own function void sendEmail create soft wait overlay so the user knows whats.. 0 320 480 bgimage.image UIImage imageNamed @ waitOverLay.png self.view addSubview bgimage bgimage.alpha 0 bgimage addSubview loadingLabel loadingLabel.alpha 0 UIView beginAnimations @ Fade In context nil..
Custom colors in UITabBar http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar initWithFrame frame v setBackgroundColor UIColor alloc initWithRed 1.0 green 0.0 blue 0.0 alpha 0.1 tabBar1 insertSubview v atIndex 0 v release @end And in your Nib file replace the class of your..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage a pixel alpha value for a UIImage I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from UIImageView image and created.. a pixel alpha value for a UIImage I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from UIImageView image and created a RGBA byte array from this. Alpha is premultiplied. CGImageRef.. colorSpace CGContextDrawImage context CGRectMake 0 0 width height image CGContextRelease context I then calculate the array index for the given alpha channel using the coordinates from the UIImageView. int byteIndex bytesPerRow uiViewPoint.y uiViewPoint.x bytesPerPixel unsigned char alpha rawData byteIndex 3..
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 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 context rect draw base UIImage imageNamed @ someImage.png drawInRect rect blendMode kCGBlendModeOverlay.. don't make color too saturated CGContextFillRect context rect draw base UIImage imageNamed @ someImage.png drawInRect rect blendMode kCGBlendModeOverlay alpha 1.0 draw image iphone cocoa touch image processing share improve this question First you'll want to subclass UIImageView and override the drawRect method...
How to get the RGB values for a pixel on an image on the iphone http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone in which I could extract this information for a given pixel A working code sample would be most appreciated and note that I am not concerned with the alpha value. iphone cocoa touch image bitmap share improve this question A little more detail... I posted earlier this evening with a consolidation and small addition.. context CGColorSpaceRef colorSpace UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function returns pre calculated RGBA divide RGB by A to get unmodified.. array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function returns pre calculated RGBA divide RGB by A to get unmodified RGB RGBAPixel bitmap NSLog @ Returning bitmap representation of UIImage...
Resize UIImage with aspect ratio? http://stackoverflow.com/questions/1703100/resize-uiimage-with-aspect-ratio iPhone CGRect screenRect CGRectMake 0 0 320.0 480.0 UIGraphicsBeginImageContext screenRect.size value drawInRect screenRect blendMode kCGBlendModePlusDarker alpha 1 UIImage tmpValue UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext Which is working great as long as the aspect ratio of the image matches that..
Creating a left-arrow button (like UINavigationBar's “back” style) on a UIToolbar http://stackoverflow.com/questions/227078/creating-a-left-arrow-button-like-uinavigationbars-back-style-on-a-uitoolba even though they're very similar to UINavigationBars. I could manually create it with button images but I can't find the source images anywhere. They have alpha channel edges so screenshotting and cutting won't get very versatile results. Any ideas beyond screenshotting for every size and color scheme I intend to use Update..
Inner shadow effect on UIView layer? http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer context visiblePath CGContextClip context Now setup the shadow properties on the context aColor UIColor colorWithRed 0.0f green 0.0f blue 0.0f alpha 0.5f CGContextSaveGState context CGContextSetShadowWithColor context CGSizeMake 0.0f 1.0f 3.0f aColor CGColor Now fill the rectangle so the shadow gets drawn aColor..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller void stopSpinner void startSpinner For your .m file include @synthesize bgimage spinner loadingLabel add this in ViewDidLoad set loading label to alpha 0 so its not displayed loadingLabel.alpha 0 everything else is its own function void sendEmail create soft wait overlay so the user knows whats going on in the.. For your .m file include @synthesize bgimage spinner loadingLabel add this in ViewDidLoad set loading label to alpha 0 so its not displayed loadingLabel.alpha 0 everything else is its own function void sendEmail create soft wait overlay so the user knows whats going on in the background. self createWaitOverlay the guts.. bgimage UIImageView alloc initWithFrame CGRectMake 0 0 320 480 bgimage.image UIImage imageNamed @ waitOverLay.png self.view addSubview bgimage bgimage.alpha 0 bgimage addSubview loadingLabel loadingLabel.alpha 0 UIView beginAnimations @ Fade In context nil UIView setAnimationDelay 0 UIView setAnimationDuration .5 bgimage.alpha..
Custom colors in UITabBar http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar 0.0 0 self.view.bounds.size.width 48 UIView v UIView alloc initWithFrame frame v setBackgroundColor UIColor alloc initWithRed 1.0 green 0.0 blue 0.0 alpha 0.1 tabBar1 insertSubview v atIndex 0 v release @end And in your Nib file replace the class of your TabBar Controller with CustomUITabBarController. share improve..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage a pixel alpha value for a UIImage I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage.. a pixel alpha value for a UIImage I am currently trying to obtain the alpha value of a pixel in a UIImageView. I have obtained the CGImage from UIImageView image and created a RGBA byte array from.. context CGRectMake 0 0 width height image CGContextRelease context I then calculate the array index for the given alpha channel using the coordinates from the UIImageView. int byteIndex bytesPerRow uiViewPoint.y uiViewPoint.x bytesPerPixel..
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 CGContextSetFillColor context CGColorGetComponents UIColor colorWithRed 0.5 green 0.5 blue 0 alpha 1 .CGColor don't make color too saturated CGContextFillRect context rect draw base UIImage imageNamed @ someImage.png drawInRect.. context rect draw base UIImage imageNamed @ someImage.png drawInRect rect blendMode kCGBlendModeOverlay alpha 1.0 draw image iphone cocoa touch image processing share improve this question First you'll want to subclass UIImageView..
How to get the RGB values for a pixel on an image on the iphone http://stackoverflow.com/questions/144250/how-to-get-the-rgb-values-for-a-pixel-on-an-image-on-the-iphone for a given pixel A working code sample would be most appreciated and note that I am not concerned with the alpha value. iphone cocoa touch image bitmap share improve this question A little more detail... I posted earlier this evening.. UInt8 pixelByteData A pointer to an array of RGBA bytes in memory RPVW_RGBAPixel pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function returns pre.. pixelData The pixel struct with alpha in this version typedef struct RGBAPixel byte red byte green byte blue byte alpha RGBAPixel Bitmap function returns pre calculated RGBA divide RGB by A to get unmodified RGB RGBAPixel bitmap NSLog @ Returning..
Resize UIImage with aspect ratio? http://stackoverflow.com/questions/1703100/resize-uiimage-with-aspect-ratio 0 320.0 480.0 UIGraphicsBeginImageContext screenRect.size value drawInRect screenRect blendMode kCGBlendModePlusDarker alpha 1 UIImage tmpValue UIGraphicsGetImageFromCurrentImageContext UIGraphicsEndImageContext Which is working great as long as..
Creating a left-arrow button (like UINavigationBar's “back” style) on a UIToolbar http://stackoverflow.com/questions/227078/creating-a-left-arrow-button-like-uinavigationbars-back-style-on-a-uitoolba UINavigationBars. I could manually create it with button images but I can't find the source images anywhere. They have alpha channel edges so screenshotting and cutting won't get very versatile results. Any ideas beyond screenshotting for every..
Inner shadow effect on UIView layer? http://stackoverflow.com/questions/4431292/inner-shadow-effect-on-uiview-layer context Now setup the shadow properties on the context aColor UIColor colorWithRed 0.0f green 0.0f blue 0.0f alpha 0.5f CGContextSaveGState context CGContextSetShadowWithColor context CGSizeMake 0.0f 1.0f 3.0f aColor CGColor Now fill the..
Locking the Fields in MFMailComposeViewController http://stackoverflow.com/questions/6284599/locking-the-fields-in-mfmailcomposeviewcontroller For your .m file include @synthesize bgimage spinner loadingLabel add this in ViewDidLoad set loading label to alpha 0 so its not displayed loadingLabel.alpha 0 everything else is its own function void sendEmail create soft wait overlay.. bgimage spinner loadingLabel add this in ViewDidLoad set loading label to alpha 0 so its not displayed loadingLabel.alpha 0 everything else is its own function void sendEmail create soft wait overlay so the user knows whats going on in the background... CGRectMake 0 0 320 480 bgimage.image UIImage imageNamed @ waitOverLay.png self.view addSubview bgimage bgimage.alpha 0 bgimage addSubview loadingLabel loadingLabel.alpha 0 UIView beginAnimations @ Fade In context nil UIView setAnimationDelay..
Custom colors in UITabBar http://stackoverflow.com/questions/675433/custom-colors-in-uitabbar v UIView alloc initWithFrame frame v setBackgroundColor UIColor alloc initWithRed 1.0 green 0.0 blue 0.0 alpha 0.1 tabBar1 insertSubview v atIndex 0 v release @end And in your Nib file replace the class of your TabBar Controller with..
Retrieving a pixel alpha value for a UIImage http://stackoverflow.com/questions/1042830/retrieving-a-pixel-alpha-value-for-a-uiimage a pixel in a UIImageView. I have obtained the CGImage from UIImageView image and created a RGBA byte array from this. Alpha is premultiplied. CGImageRef image uiImage.CGImage NSUInteger width CGImageGetWidth image NSUInteger height CGImageGetHeight.. 8 CGContextRef context CGBitmapContextCreate rawData width height bitsPerComponent bytesPerRow colorSpace kCGImageAlphaPremultipliedLast kCGBitmapByteOrder32Big CGColorSpaceRelease colorSpace CGContextDrawImage context CGRectMake 0 0 width..
Alpha transparent PNGs not displaying correctly in Mobile Safari http://stackoverflow.com/questions/1374618/alpha-transparent-pngs-not-displaying-correctly-in-mobile-safari transparent PNGs not displaying correctly in Mobile Safari I'm using some semi transparent PNGs as background images on..
Applying background gradient to a Grouple table cell http://stackoverflow.com/questions/1979165/applying-background-gradient-to-a-grouple-table-cell num_locations 2 CGFloat locations 2 0.0 1.0 CGFloat components 8 0.8f 0.8f 0.8f 1.0f Bottom Colour Red Green Blue Alpha. 0.9f 0.9f 0.9f 1.0 Top Colour Red Green Blue Alpha. myColorspace CGColorSpaceCreateDeviceRGB myGradient CGGradientCreateWithColorComponents.. components 8 0.8f 0.8f 0.8f 1.0f Bottom Colour Red Green Blue Alpha. 0.9f 0.9f 0.9f 1.0 Top Colour Red Green Blue Alpha. myColorspace CGColorSpaceCreateDeviceRGB myGradient CGGradientCreateWithColorComponents myColorspace components locations..
Use a CoreGraphic Stroke as Alpha Mask in iPhone App http://stackoverflow.com/questions/2208579/use-a-coregraphic-stroke-as-alpha-mask-in-iphone-app a CoreGraphic Stroke as Alpha Mask in iPhone App I'm basically looking to create something akin to a very simple version of iSteam iFog alebit for a..
Need some help understanding transient properties in Core Data http://stackoverflow.com/questions/7504391/need-some-help-understanding-transient-properties-in-core-data constantly stop and check if the objects were faults or not. For example I set up a simple model with classes like so Alpha @class Beta @interface Alpha NSManagedObject @private @property nonatomic retain NSNumber num @property nonatomic retain.. the objects were faults or not. For example I set up a simple model with classes like so Alpha @class Beta @interface Alpha NSManagedObject @private @property nonatomic retain NSNumber num @property nonatomic retain NSString aString @property nonatomic.. nonatomic retain NSString aString @property nonatomic retain NSSet betas NSString unmodeledMethod @end @interface Alpha CoreDataGeneratedAccessors void addBetasObject Beta value void removeBetasObject Beta value void addBetas NSSet values void..
Which toolkit for iPhone mobile webapps? http://stackoverflow.com/questions/917935/which-toolkit-for-iphone-mobile-webapps JQTouch. JQTouch is stable now and features are included in the Sencha Touch framework while JQuery Mobile is only in Alpha state at this point. Having learned the lessons of JQTouch JQuery Mobile adopts some new philosophy that may or may not..
Draw a straight line using OpenGL ES in iPhone? http://stackoverflow.com/questions/9736887/draw-a-straight-line-using-opengl-es-in-iphone GL_TRUE Make the line a cyan color self.effect.constantColor GLKVector4Make 0.0f Red 1.0f Green 1.0f Blue 1.0f Alpha I was able to get the line to draw by including a few more steps. It all involves sending data over to the GPU to be processed...
Record the sound and play it back with changed pitch http://stackoverflow.com/questions/10549317/record-the-sound-and-play-it-back-with-changed-pitch the recorder @ error localizedDescription void levelTimerCallback NSTimer timer recorder updateMeters const double ALPHA 0.05 NOISE FILERATION ALGORITHMS double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 double audioMonitorResults1.. ALGORITHMS double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 double audioMonitorResults1 ALPHA peakPowerForChannel 1.0 ALPHA audioMonitorResults1 double audioMonitorResults audioMonitorResults recorder peakPowerForChannel.. pow 10 0.05 recorder peakPowerForChannel 0 double audioMonitorResults1 ALPHA peakPowerForChannel 1.0 ALPHA audioMonitorResults1 double audioMonitorResults audioMonitorResults recorder peakPowerForChannel 0 NSLog @ This time only..
Detecting a clap in IOS http://stackoverflow.com/questions/11173605/detecting-a-clap-in-ios the audio with SCListener Here is my attempt void levelTimerCallback NSTimer timer recorder updateMeters const double ALPHA 0.05 double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 lowPassResults ALPHA peakPowerForChannel 1.0.. const double ALPHA 0.05 double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 lowPassResults ALPHA peakPowerForChannel 1.0 ALPHA lowPassResults if recorder peakPowerForChannel 0 0 totalClapsLabel.text NSString stringWithFormat.. double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 lowPassResults ALPHA peakPowerForChannel 1.0 ALPHA lowPassResults if recorder peakPowerForChannel 0 0 totalClapsLabel.text NSString stringWithFormat @ d total SCListener listener..
Detecting Blow through iPhone MIC in Cocos and then Performing animation on an image http://stackoverflow.com/questions/12985461/detecting-blow-through-iphone-mic-in-cocos-and-then-performing-animation-on-an-i 50 100 150 200 self.view addSubview image void levelTimerCallback NSTimer timer recorder updateMeters const double ALPHA 0.05 double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 lowPassResults ALPHA peakPowerForChannel 1.0.. const double ALPHA 0.05 double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 lowPassResults ALPHA peakPowerForChannel 1.0 ALPHA lowPassResults NSLog @ Average input f Peak input f Low pass results f recorder averagePowerForChannel.. double peakPowerForChannel pow 10 0.05 recorder peakPowerForChannel 0 lowPassResults ALPHA peakPowerForChannel 1.0 ALPHA lowPassResults NSLog @ Average input f Peak input f Low pass results f recorder averagePowerForChannel 0 recorder peakPowerForChannel..
iOS TextField Validation http://stackoverflow.com/questions/7665323/ios-textfield-validation or NO depending on the text field how many characters are currently in it and what characters it wants to add #define ALPHA @ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #define NUMERIC @ 1234567890 #define ALPHA_NUMERIC ALPHA NUMERIC.. to add #define ALPHA @ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #define NUMERIC @ 1234567890 #define ALPHA_NUMERIC ALPHA NUMERIC BOOL textField UITextField textField shouldChangeCharactersInRange NSRange range replacementString.. ALPHA @ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #define NUMERIC @ 1234567890 #define ALPHA_NUMERIC ALPHA NUMERIC BOOL textField UITextField textField shouldChangeCharactersInRange NSRange range replacementString NSString string..
How to check if UITextField's text is valid email? http://stackoverflow.com/questions/7707906/how-to-check-if-uitextfields-text-is-valid-email be added or not. Return YES or NO depending on the text fields current text compared to a valid email address #define ALPHA @ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #define NUMERIC @ 1234567890 #define ALPHA_NUMERIC ALPHA NUMERIC.. address #define ALPHA @ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #define NUMERIC @ 1234567890 #define ALPHA_NUMERIC ALPHA NUMERIC BOOL textField UITextField textField shouldChangeCharactersInRange NSRange range replacementString.. ALPHA @ ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz #define NUMERIC @ 1234567890 #define ALPHA_NUMERIC ALPHA NUMERIC BOOL textField UITextField textField shouldChangeCharactersInRange NSRange range replacementString NSString string..
Detecting blowing on the iPhone microphone? http://stackoverflow.com/questions/795968/detecting-blowing-on-the-iphone-microphone or a member of your class double micPower 0.0 Tweak this value to your liking must be between 0 and 1 const double ALPHA 0.05 Do this every 'tick' of your application e.g. every 1 30 of a second double instantaneousPower SCListener sharedListener.. SCListener sharedListener peakPower This is the key line in computing the low pass filtered value micPower ALPHA instantaneousPower 1.0 ALPHA micPower if micPower THRESHOLD 0.99 in your example User is blowing on the microphone share..
|