Ok so after a couple suggestions and rereading the Quartz information on 
shadows I modified my code but it's mostly all redundant since the shadow color 
is whatever the image color is and I cant seem to change that. Anyway Below is 
the code I am trying to use to draw a drop shadow under a UIImage inside of a 
UIImage view and it just isn't working. Sometimes I get a duplicate of the 
image with no color change, sometimes the image is clipped randomly and other 
times the image simply vanishes from the image view: P.S. I realize some of 
this code is useless but as you can see it was based on the apple example code.

        UIGraphicsBeginImageContext(self.frame.size);
        CGContextRef myContext =  UIGraphicsGetCurrentContext();
    CGSize          myShadowOffset = CGSizeMake (5,  10);// 2
    float           myColorValues[] = {0, 0, 0, .3};// 3
    CGColorRef      myColor;// 4
    CGColorSpaceRef myColorSpace;// 5
        CGImageRef imgRef = rotatingView.image.CGImage;
        CGFloat width = CGImageGetWidth(imgRef);
        CGFloat height = CGImageGetHeight(imgRef);
        
    CGContextSaveGState(myContext);// 6
        
    CGContextSetShadow (myContext, myShadowOffset, 5); // 7
    // Your drawing code here// 8
    CGContextSetRGBFillColor (myContext, 0, 1, 0, 1);
   // CGContextDrawImage(myContext, CGRectMake(0, 0, width, height), imgRef);
        [rotatingView.image drawInRect:self.frame];
    myColorSpace = CGColorSpaceCreateDeviceRGB ();// 9
    myColor = CGColorCreate (myColorSpace, myColorValues);// 10
    CGContextSetShadowWithColor (myContext, myShadowOffset, 5, myColor);// 11
    // Your drawing code here// 12
    CGContextSetRGBFillColor (myContext, 0, 0, 1, 1);
    //CGContextDrawImage(myContext, CGRectMake 
(width/3-75,height/2-100,width/4,height/4),imgRef);
        [rotatingView.image drawInRect:CGRectMake 
(width/3-75,height/2-100,width/4,height/4)];
    CGColorRelease (myColor);// 13
    CGColorSpaceRelease (myColorSpace); // 14
        
        UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
        CGContextRestoreGState(myContext);
        UIGraphicsEndImageContext();
        
        rotatingView.image = 
imageCopy;_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to