New: + CPColor checkerBoardColor for debug use.

This color has a standard 'transparency' checkerboard pattern which is especially useful for our scrolling tests where it makes scrolling easy to visualise.

Refs #2078, #2079.
This commit is contained in:
Alexander Ljungberg
2014-04-03 11:38:11 +01:00
parent 1a1fc3ef21
commit 1b351ad5bb
3 changed files with 8 additions and 0 deletions
+6
View File
@@ -813,6 +813,12 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
return [CPColor colorWithRed:RAND() green:RAND() blue:RAND() alpha:1.0];
}
+ (CPColor)checkerBoardColor
{
// Thanks to cocco http://stackoverflow.com/a/18368212/76900.
return [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEX////MzMw46qqDAAAAEElEQVQImWNg+M+AFeEQBgB+vw/xfUUZkgAAAABJRU5ErkJggg=="]];
}
@end
/// @cond IGNORE
@@ -59,6 +59,7 @@
var scrollView = [self makeScrollview];
[scrollView setFrameOrigin:CGPointMake(20,20)]
[[scrollView documentView] setBackgroundColor:[CPColor checkerBoardColor]];
[[scrollView documentView] addSubview:innerScrollView];
[[aWindow contentView] addSubview:scrollView];
@@ -31,6 +31,7 @@
[scrollView setDocumentView:contentView];
[contentView2 setAutoresizingMask:CPViewWidthSizable];
[contentView2 setBackgroundColor:[CPColor checkerBoardColor]];
[scrollView2 setDocumentView:contentView2];
}