Re: IOS graphics

2011-07-12 Thread Development
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 (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


Re: IOS graphics

2011-07-11 Thread Mike Abdullah
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 (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/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net

___

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


Re: IOS graphics

2011-07-11 Thread Development
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 (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/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net
 

___

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


Re: IOS graphics

2011-07-11 Thread Steve Christensen
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 (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


IOS graphics

2011-07-10 Thread Development
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 (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