Bug 2379 - CGImage related iphone sdk samples don't work
Summary: CGImage related iphone sdk samples don't work
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 5.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2011-12-06 23:50 UTC by Art
Modified: 2011-12-09 18:47 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

CGImage sample (28.06 KB, application/zip)
2011-12-09 13:33 UTC, Art

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Art 2011-12-06 23:50:28 UTC
I couldn't get CGImage related iphone sdk samples to work. 
For example, the following code doesn't work.

UIImage myImage = UIImage.FromFile("myImage.png");

CGImage SetTransparent  (UIImage image)
                       CGImage rawImageRef = image.CGImage
       CGImage rawImageRef = image.CGImage;
       float [] colorMasking =new float[6]     {222, 255, 222, 255, 222, 255}
       CGImage maskedImageRef = rawImageRef.WithMaskingColors(colorMasking);

return maskedImageRef
Comment 1 Rolf Bjarne Kvinge [MSFT] 2011-12-09 09:58:58 UTC
You're not doing anything with the image SetTransparent returns. Can you add a complete (compilable) test case we can try out?
Comment 2 Art 2011-12-09 13:33:26 UTC
Created attachment 1023 [details]
CGImage sample

I attached the CGImage project.

I am trying to convert the samples in the following URL
Comment 3 Rolf Bjarne Kvinge [MSFT] 2011-12-09 18:47:37 UTC
It seems to depend on the image. I converted img1.png to a jpg, and the masking works (you'll also have to change the coefficients to be in the range 0.0-1.0).

This is probably because the png already has an alpha channel.

Here are a few related links:

I haven't tested it, but creating a context with the correct channels like this might make it possible to use your png: