Chipmunk2D Pro API Reference  7.0.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
ChipmunkImageSampler.h
1 // Copyright 2013 Howling Moon Software. All rights reserved.
2 // See http://chipmunk2d.net/legal.php for more information.
3 
4 #import "ObjectiveChipmunk/ObjectiveChipmunk.h"
5 #import "ChipmunkAutoGeometry.h"
6 
7 #import <TargetConditionals.h>
8 
9 #if TARGET_OS_IPHONE == 1
10  #import <CoreGraphics/CoreGraphics.h>
11 #endif
12 
13 
20 @private
21  NSUInteger _width, _height, _stride;
22  NSUInteger _bytesPerPixel, _component;
23 
24  bool _flip;
25  const uint8_t *_pixels;
26  NSData *_pixelData;
27 
28  cpFloat _borderValue;
29 
30  cpBB _outputRect;
31 }
32 
34 @property(nonatomic, readonly) NSUInteger width;
35 
37 @property(nonatomic, readonly) NSUInteger height;
38 
40 @property(nonatomic, readonly) NSUInteger bytesPerPixel;
41 
43 @property(nonatomic, assign) NSUInteger component;
44 
46 @property(nonatomic, readonly) NSData *pixelData;
47 
50 @property(nonatomic, assign) cpBB outputRect;
51 
60 -(id)initWithWidth:(NSUInteger)width height:(NSUInteger)height stride:(NSUInteger)stride bytesPerPixel:(NSUInteger)bytesPerPixel component:(NSUInteger)component flip:(bool)flip pixelData:(NSData *)pixelData;
61 
63 -(void)setBorderRepeat;
64 
66 -(void)setBorderValue:(cpFloat)borderValue;
67 
69 -(ChipmunkPolylineSet *)marchAllWithBorder:(bool)bordered hard:(bool)hard;
70 
71 @end
72 
73 
74 
78 @private
79  CGContextRef _context;
80 }
81 
83 @property(nonatomic, readonly) CGContextRef context;
84 
86 @property(nonatomic, readonly) NSMutableData *pixelData;
87 
90 -(id)initWithWidth:(unsigned long)width height:(unsigned long)height colorSpace:(CGColorSpaceRef)colorSpace bitmapInfo:(CGBitmapInfo)bitmapInfo component:(NSUInteger)component;
91 
92 @end
93 
94 
95 
98 
100 +(CGImageRef)loadImage:(NSURL *)url;
101 
104 -(id)initWithImage:(CGImageRef)image isMask:(bool)isMask contextWidth:(NSUInteger)width contextHeight:(NSUInteger)height;
105 
108 -(id)initWithImageFile:(NSURL *)url isMask:(bool)isMask;
109 
112 +(ChipmunkImageSampler *)samplerWithImageFile:(NSURL *)url isMask:(bool)isMask;
113 
114 @end