From 1b351ad5bb4355da92ee14b9b5f6c6c5369b0eec Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Thu, 3 Apr 2014 11:38:11 +0100 Subject: [PATCH] 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. --- AppKit/CPColor.j | 6 ++++++ Tests/Manual/CPScrollView/AppController.j | 1 + Tests/Manual/CPScrollView2/AppController.j | 1 + 3 files changed, 8 insertions(+) diff --git a/AppKit/CPColor.j b/AppKit/CPColor.j index e3fdd083e..5d27584d9 100644 --- a/AppKit/CPColor.j +++ b/AppKit/CPColor.j @@ -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 diff --git a/Tests/Manual/CPScrollView/AppController.j b/Tests/Manual/CPScrollView/AppController.j index ca14df599..47f6ed117 100644 --- a/Tests/Manual/CPScrollView/AppController.j +++ b/Tests/Manual/CPScrollView/AppController.j @@ -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]; diff --git a/Tests/Manual/CPScrollView2/AppController.j b/Tests/Manual/CPScrollView2/AppController.j index bd5ced4c7..86bca236d 100644 --- a/Tests/Manual/CPScrollView2/AppController.j +++ b/Tests/Manual/CPScrollView2/AppController.j @@ -31,6 +31,7 @@ [scrollView setDocumentView:contentView]; [contentView2 setAutoresizingMask:CPViewWidthSizable]; + [contentView2 setBackgroundColor:[CPColor checkerBoardColor]]; [scrollView2 setDocumentView:contentView2]; }