Skip to content

Instantly share code, notes, and snippets.

@andymatuschak
Created September 7, 2009 06:44
Show Gist options
  • Save andymatuschak/182204 to your computer and use it in GitHub Desktop.
Save andymatuschak/182204 to your computer and use it in GitHub Desktop.
//
// PXImageBackground.h
// Pixen-XCode
//
// Copyright (c) 2003,2004,2005 Open Sword Group
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use,copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
// THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// Created by Joe Osborn on Tue Oct 28 2003.
// Copyright (c) 2003 Open Sword Group. All rights reserved.
//
#import <AppKit/AppKit.h>
@interface PXImage <NSCoding, NSCopying> : NSObject
{
NSMutableArray *tiles;
NSSize size;
}
- (PXImage *)initWithSize:(NSSize)size;
- (NSColor *)colorAtX:(int)x y:(int)y;
- (void)setColor:(NSColor *)color atX:(int)x y:(int)y;
- (void)flipHorizontally;
- (void)flipVertically;
- (void)translateX:(int)deltaX y:(int)deltaY;
- (void)rotateByDegrees:(int)degrees; // Only supports 90, 180, 270.
- (void)setSize:(NSSize *)newSize; // Just resizes; no scaling.
- (void)drawInRect:(NSRect)dst fromRect:(NSRect)src operation:(NSCompositingOperation)op fraction:(double)fraction;
- (CGImageRef)CGImage;
- (void)overlayImage:(PXImage *)image; // Composites the contents of the provided image atop this one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment