Re: Is this possible?
Re: Is this possible?
- Subject: Re: Is this possible?
- From: Development <email@hidden>
- Date: Mon, 21 Dec 2009 13:25:50 -0700
Ok,
I have managed to get a beautiful shadow drawn in my rotating view (A view I used to rotate images so they don't distort). The rotating view sits inside an an image view. so it is layered as follows: ImageView(parent)->rotatingView(child)->image
Anyway. I get a lovely shadow, but there is still a problem, well two actually. First the shadow appears to be drawn on top of the image rather than under it. Second, it gets clipped to the edges of the rotating image view. I have already set rotatingView.clipsToBounds = NO; but that does not help.
Below is the code.
UIGraphicsBeginImageContext(self.frame.size);
CGContextRef myContext = UIGraphicsGetCurrentContext();
float myColorValues[] = {0, 0, 0, darkness};// 3
CGColorRef myColor;// 4
CGColorSpaceRef myColorSpace;
CGContextSaveGState(myContext);// 6
myColorSpace = CGColorSpaceCreateDeviceRGB ();// 9
myColor = CGColorCreate (myColorSpace, myColorValues);// 10
CGContextSetShadowWithColor (myContext, myShadowOffset, spread, myColor);// 11
// Your drawing code here// 12
// CGContextDrawImage(myContext, rotatingView.frame,imgRef);
rotatingView.clipsToBounds = NO;
[rotatingView.image drawInRect:rotatingView.frame
blendMode:kCGBlendModeNormal alpha:.5];
CGColorRelease (myColor);// 13
CGColorSpaceRelease (myColorSpace); // 14
UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
CGContextRestoreGState(myContext);
UIGraphicsEndImageContext();
rotatingView.image = imageCopy;_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden