Bug 7362 - FromPatternImage unsupported colorspace component
Summary: FromPatternImage unsupported colorspace component
Status: RESOLVED NOT_ON_ROADMAP
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: 6.0.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
: 6545 ()
Depends on:
Blocks:
 
Reported: 2012-09-20 17:23 UTC by Dylan
Modified: 2012-09-21 09:33 UTC (History)
4 users (show)

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


Attachments
Attached is a copy of the image that used to work. (79.50 KB, image/png)
2012-09-20 17:40 UTC, Dylan
Details
File which uses the image pattern (2.64 KB, text/plain)
2012-09-20 19:20 UTC, Dylan
Details


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:
Status:
RESOLVED NOT_ON_ROADMAP

Description Dylan 2012-09-20 17:23:18 UTC
I have just updated to the latest MonoTouch stable version and code that was working 100% is now broken. 

var color = UIColor.FromPatternImage(UIImage.FromBundle("Images/background.png"))

This code no longer works in MT 6.0.0. It shows the default iPhone lined background and on investigation in debug mode the value of the variable color is: "System.Exception: Unsupported colorspace component length: 1".

I have no idea what this means, but this has now broken after the upgrade and obviously has a dramatic affect on the look and feel of my app! The UIImage is valid and can be found correctly and as I said this worked perfectly until now.
Comment 1 Sebastien Pouliot 2012-09-20 17:37:46 UTC
Patterns are not "true" colors, so the later message is likely the debugger calling ToString() to give you a description of the current instance (I'll look at this).

I do not recall changes to UIColor for 6.0. Do you remember which version of MonoTouch you used before updating ?

Could you attach a test case (at least the image, in case it's related) to the bug report ? We'll have a look asap. Thanks
Comment 2 Dylan 2012-09-20 17:40:54 UTC
Created attachment 2583 [details]
Attached is a copy of the image that used to work.

Prior to MT 6.0.0 being used, I was using 5.4.0. Either something changes in the latest Xcode version or MT version. Either way, it was working and now it isn't.
Comment 3 Sebastien Pouliot 2012-09-20 19:00:50 UTC
Ok, the part of the "Unsupported colorspace component length: 1" is due to the debugger calling ToString (which tries to call other members than do not work for a pattern).

This (first) part is fixed in a1ab48f2b1e335a36aabb834a4dfd136f40cd183
QA: unit tests added
Comment 4 Dylan 2012-09-20 19:20:38 UTC
Created attachment 2585 [details]
File which uses the image pattern

Attached is the file which uses a UIImage to set the ParentViewController.View.BackgroundColor to a particular pattern/image. Used in Monotouch Dialog. 

Usage would look as follows:

public class LoginScreen : CustomDialogViewController
{
   public LoginScreen() : base("Login", UIImage.FromBundle("Images/background.png")) 
{
...
}
}
Comment 5 Sebastien Pouliot 2012-09-20 20:33:59 UTC
Thanks for the extra data and the fact that this is MT.D based (it could be related to #6545).
Comment 6 Sebastien Pouliot 2012-09-21 08:29:00 UTC
You might want to try:
https://github.com/migueldeicaza/MonoTouch.Dialog/issues/150

It might be that iOS6 sets a background view (different from earlier versions of iOS) and that does not mix well with your custom color (pattern).
Comment 7 Dylan 2012-09-21 08:34:24 UTC
dialog_view_menu.TableView.BackgroundView = null;

That did the trick.
Comment 8 Sebastien Pouliot 2012-09-21 09:27:28 UTC
*** Bug 6545 has been marked as a duplicate of this bug. ***
Comment 9 Sebastien Pouliot 2012-09-21 09:30:48 UTC
The issue is that iOS 6 has a background view that does not mix well with custom colors/patterns. However this is not something we can disable (it's valid and useful to be able to combine both).

IOW if you want to create a custom look you need to set every properties that can affect it, like the background view, since we can't know what visual changes future iOS releases will have.
Comment 10 Brad Moore 2012-09-21 09:33:37 UTC
For the record,

TableView.BackgroundView = null;

Works with iOS6 (xcode 4.5) and iOS5 (xcode 4.4.1) SDKs/simulators.