Re: IOS graphics
Re: IOS graphics
- Subject: Re: IOS graphics
- From: Development <email@hidden>
- Date: Mon, 11 Jul 2011 23:36:21 -0700
I was afraid of that… The only thing I found that gave me a clue on how to do that specifically, did a hard freeze on the phone when I attempted to implement it.
On Jul 11, 2011, at 5:30 PM, Steve Christensen wrote:
> The first thing I notice is that none of the CGContext* calls after UIGraphicsBeginImageContext is referring to that image context so they are having no effect on it. You should move the UIGraphicsGetCurrentContext down after the [drawImage...] call.
>
> If you are still not able to get the desired result with any of the Quartz blend modes, you'll need to create a bitmap context and tweak the pixels in the pixel buffer directly.
>
>
> On Jul 11, 2011, at 8:48 AM, Development wrote:
>
>> Sorry I figured since it was only a sudo change anyway it wouldn't matter.
>>
>> UIImage * drawImage = rotatingView.image;
>> CGContextRef context = UIGraphicsGetCurrentContext();
>> CGRect newRect = CGRectMake(0.0, 0.0, rotatingView.frame.size.width, rotatingView.frame.size.height);
>>
>> UIGraphicsBeginImageContext(newRect.size);
>> [drawImage drawInRect:newRect];
>> CGContextTranslateCTM(context, 0.0, rotatingView.frame.size.height);
>> CGContextScaleCTM(context, 1.0, -1.0);
>> CGContextClipToMask(context, newRect, drawImage.CGImage);
>> CGContextSetBlendMode(context, kCGBlendModeHue);
>> CGContextSetRGBFillColor(context, self.color.r ,self.color.g , self.color.b, 1.0);
>> CGContextFillRect(context, newRect);
>> UIImage *viewImage = UIGraphicsGetImageFromCurrentImageContext();
>> UIGraphicsEndImageContext();
>>
>> This applies a colored rectangle applied over the image and clipped to it as a mask. Which is not what I want. But even it if was the problem is that when I get the png rep so I can save it with transparency to the document, the applied color is lost. An easy way around this is to sable the color values and reapply because when the document is "flattened" and save as a png the color appears correctly.
>> But again that's effort in the wrong direction anyway.
>> A side note the alpha is 1.0 right now, but in the finished product I thought I'd use a slider to adjust that as intensity or something. Anyway it doesn't matter it's just a colored rectangle over top of the image.
>>
>>
>> On Jul 11, 2011, at 5:16 AM, Mike Abdullah wrote:
>>
>>> Giving us a link to the example code would be a big help in understanding what you're trying.
>>>
>>> On 11 Jul 2011, at 02:06, Development wrote:
>>>
>>>> Im having a problem with adjusting the color values of a UIImage.
>>>>
>>>> How does one adjust levels and color values of a UIImage.
>>>> The example code I found only overlays a rectangle clipped to an image mask. It looks like color value adjustment until you realize 2 things.
>>>> a) I absolutely cannot render the image view with the color adjustment into a graphic context with the adjustment in tact, because what I always get back is the original, unadjusted image.
>>>> a b) it's not really adjusting the levels. And since it isn't it also means I cannot actually adjust the brightness, contrast or anything else either.
>>>>
>>>>
>>>> Is adjusting UIImage color levels even possible?
>
_______________________________________________
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