As soon as I implemented this I realised how much of a pain it would be to copy out the arrow images, rotate them in an external program, then copy them back in. So I put some buttons next to the arrow image wells that allow the user to rotate the arrows within Slider itself.
Another snippet I had to write during the great Slider rebuild.
I needed to be able to take an NSImage supplied by the user and tile it within an NSBezierPath defined by more user-set values.
The below example uses a rounded rectangle.
1 2 3 4 5 6 7 8 9 10 11 12 13 14
NSBitmapImageRep *theImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:imageSize.width pixelsHigh:imageSize.height bitsPerSample:8 samplesPerPixel:4 hasAlpha:YES isPlanar:NO colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:0 bitsPerPixel:0]; [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithBitmapImageRep:theImage]]; //bgImage can be any NSImage NSColor *c = [NSColor colorWithPatternImage:bgImage]; [c set]; [path appendBezierPathWithRoundedRect:NSMakeRect(0, 0, imageSize.width, imageSize.height) xRadius:10.0 yRadius:10.0]; [path fill]; [NSGraphicsContext restoreGraphicsState];
I realised that I didnâ€™t want comments to be visible on the page in case one set of photos became wildly popular (yeah, right); which would result in a page of comments with a few photos, instead of a page of photos with maybe one or two comments. For some reason, Greybox popped into my head, and wouldnâ€™t leave. A few hours later, this happened: Hangzhou Day 1.