Tuesday, 13 December 2011

UrlDemo 5

URLDemo5
//For the CiFaceDetection

http://maniacdev.com/2011/11/tutorial-easy-face-detection-with-core-image-in-ios-5/

//For the different example
http://iphonecode.weebly.com/second-page.html

//For the paint app reference
http://itunes.apple.com/us/app/xpaint/id388881325?mt=8
http://itunes.apple.com/us/app/doodle-touch/id398904512?mt=8

//For the Enape and MKStoreManager of the app
http://www.sixtemia.com/journal/2009/08/12/using-store-kit-framework/

//For the different snippet of the iphone
http://borkware.com/quickies/everything-by-date
http://jidh.weebly.com/iphone-development.html

//For the UUID in iphone
  CFUUIDRef cfuuid = CFUUIDCreate (kCFAllocatorDefault);
    NSString *uuid = (NSString *)CFUUIDCreateString (kCFAllocatorDefault, cfuuid);
    CFRelease (cfuuid);
    NSLog(@"%@",uuid);
//For the paint demo
http://code.google.com/p/paintboardiphone/downloads/list
http://pastebin.com/9dKPHt6R

http://www.iphonedevsdk.com/forum/iphone-sdk-development/13064-how-draw-transparent-stroke-anyway-delete-some-part-uiimage-cg.html

//For the checking of network
-(BOOL)checkNetworkConnection{
    NSString *connectingString=[[NSString alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://google.com"]];
    if ([connectingString length]==0) {
        NSLog(@"not connected");
        UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Error" message:@"Network is not available " delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert show];
        [alert release];
        netWork=YES;
    }
    else {
        netWork=NO;
    }
   
    [connectingString release];
    return netWork;
}
// For the sorting of array into alphabetic order
wordArray = [[wordArray sortedArrayUsingSelector:
                       @selector(compare:)] mutableCopy];
//For the pdf demos
http://pspdfkit.com/

//For the line drawing and erasing
write it between the touch moved

UITouch *touch = [touches anyObject];   
    CGPoint currentPoint = [touch locationInView:self.colorView];
      //currentPoint.y -= 20;
        if (appDelegate.iphoneIpad==1) {
            drawPencil.frame=CGRectMake(currentPoint.x+5,currentPoint.y-30,drawPencil.frame.size.width,drawPencil.frame.size.height);       
           
        }
        else{
            drawPencil.frame=CGRectMake(currentPoint.x+10,currentPoint.y-80,drawPencil.frame.size.width,drawPencil.frame.size.height);       
           
        }
       
        if (eraseDrawImg==NO) {
                //For Drawing of line....
           
                //drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
                UIGraphicsBeginImageContext(self.colorView.frame.size);
                [drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
                CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
                CGContextSetLineWidth(UIGraphicsGetCurrentContext(), eraseSize);
                
                    CGContextSetStrokeColorWithColor(UIGraphicsGetCurrentContext(),color);
               
                CGContextBeginPath(UIGraphicsGetCurrentContext());
                CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
                CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
                CGContextStrokePath(UIGraphicsGetCurrentContext());
                drawImage.image=UIGraphicsGetImageFromCurrentImageContext();
                          
                UIGraphicsEndImageContext();  
                
            } 
            else{
                //For Erasing of Drawn line....

                UIGraphicsBeginImageContext(self.colorView.frame.size);
                [drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)];
                CGContextSetLineCap(UIGraphicsGetCurrentContext(),kCGImageAlphaNone); //kCGImageAlphaPremultipliedLast);
                CGContextSetLineWidth(UIGraphicsGetCurrentContext(), eraseSize);
                CGContextSetRGBStrokeColor(UIGraphicsGetCurrentContext(), 1, 0, 0, 10);
                CGContextAddArc(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y, eraseSize, 0.0, 2*M_PI, 0);//, 50, 50, 50, 0.0, 2*M_PI, 0);
                CGContextClip(UIGraphicsGetCurrentContext());
                CGContextClearRect(UIGraphicsGetCurrentContext(),self.colorView.frame);

                CGContextBeginPath(UIGraphicsGetCurrentContext());
                CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
                CGContextClearRect(UIGraphicsGetCurrentContext(), CGRectMake(lastPoint.x, lastPoint.y, eraseSize,eraseSize));
                
                CGContextStrokePath(UIGraphicsGetCurrentContext());
                drawImage.image = UIGraphicsGetImageFromCurrentImageContext();
                UIGraphicsEndImageContext();
            }           
           // NSLog(@"%d",imageTag);
         NSLog(@"%@",lineArray);
        lastPoint = currentPoint;
   
        mouseMoved++;
   
    if (mouseMoved == 10) {
        mouseMoved = 0;
        }
    }

//For the Bluring to imageview

-(UIImage*)imageWithBlurAroundPoint:(CGPoint)point {
    CGRect             bnds = CGRectZero;
    UIImage*           copy = nil;
    CGContextRef       ctxt = nil;
    CGImageRef         imag = rgbImg.image.CGImage;
    CGRect             rect = CGRectZero;
    CGAffineTransform  tran = CGAffineTransformIdentity;
    int                indx = 0;
   
    rect.size.width  = CGImageGetWidth(imag);
    rect.size.height = CGImageGetHeight(imag);
   
    bnds = rect;
   
    UIGraphicsBeginImageContext(bnds.size);
    ctxt = UIGraphicsGetCurrentContext();
   
    // Cut out a sample out the image
    CGRect fillRect = CGRectMake(point.x - 10, point.y - 10, 20, 20);
    CGImageRef sampleImageRef = CGImageCreateWithImageInRect(rgbImg.image.CGImage, fillRect);
   
    // Flip the image right side up & draw
    CGContextSaveGState(ctxt);
   
    CGContextScaleCTM(ctxt, 1.0, -1.0);
    CGContextTranslateCTM(ctxt, 0.0, -rect.size.height);
    CGContextConcatCTM(ctxt, tran);
   
    CGContextDrawImage(UIGraphicsGetCurrentContext(), rect, imag);
   
    // Restore the context so that the coordinate system is restored
    CGContextRestoreGState(ctxt);
   
    // Cut out a sample image and redraw it over the source rect
    // several times, shifting the opacity and the positioning slightly
    // to produce a blurred effect
    for (indx = 0; indx < 5; indx++) {
        CGRect myRect = CGRectOffset(fillRect, 0.5 * indx, 0.5 * indx);
        CGContextSetAlpha(ctxt, 0.2 * indx);
        CGContextScaleCTM(ctxt, 1.0, -1.0);
        CGContextDrawImage(ctxt, myRect, sampleImageRef);
    }
   
    copy = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
   
    return copy;

}
//For the soap parsing demo
http://www.icodeblog.com/2008/11/03/iphone-programming-tutorial-intro-to-soap-web-services/

//For the page curl effect from left to right & vice versa
https://github.com/jemmons/PageCurl


 //For the glow of the line
    /*float glowWidth = 10.0;
     float colorValues[] = { 0, 0, 1, 1.0 };
     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
     CGColorRef glowColor = CGColorCreate( colorSpace, colorValues );
     CGContextSetShadowWithColor( c, CGSizeMake( 0.0, 0.0 ), glowWidth, glowColor );*/

//touch and erase in uiimageview in iphone
http://www.iphonedevsdk.com/forum/iphone-sdk-development/13064-how-draw-transparent-stroke-anyway-delete-some-part-uiimage-cg.html




No comments:

Post a Comment