Chipmunk2D Pro API Reference  7.0.3
 All Classes Functions Variables Typedefs Enumerations Enumerator Properties Groups Pages
Instance Methods | Properties | List of all members
ChipmunkBitmapSampler Class Reference

Generic sampler used with bitmap data. More...

#import <ChipmunkImageSampler.h>

Inherits ChipmunkAbstractSampler.

Inherited by ChipmunkCGContextSampler.

Instance Methods

(id) - initWithWidth:height:stride:bytesPerPixel:component:flip:pixelData:
 Init a sampler from bitmap data. More...
 
(void) - setBorderRepeat
 Set the border of the bitmap to repeat the edge pixels.
 
(void) - setBorderValue:
 Set the border of the bitmap to be a specific value.
 
(ChipmunkPolylineSet *) - marchAllWithBorder:hard:
 March the entire image.
 
- Instance Methods inherited from ChipmunkAbstractSampler
(id) - initWithSamplingFunction:
 Designated initializer.
 
(cpFloat- sample:
 Sample at a specific point.
 
(ChipmunkPolylineSet *) - march:xSamples:ySamples:hard:
 March a certain area of the sampler.
 

Properties

NSUInteger width
 Width of the bitmap in pixels.
 
NSUInteger height
 Height of the bitmap in pixels.
 
NSUInteger bytesPerPixel
 Bytes per pixel of the bitmap. (ex: RGBA8888 would be 4)
 
NSUInteger component
 Zero-based ndex of the component to sample. (ex: alpha of RGBA would be 3)
 
NSData * pixelData
 NSData object holding the pixel data.
 
cpBB outputRect
 Rect that the image maps to. More...
 
- Properties inherited from ChipmunkAbstractSampler
cpFloat marchThreshold
 The threshold passed to the cpMarch*() functions. More...
 
cpMarchSampleFunc sampleFunc
 Get the primitive cpMarchSampleFunc used by this sampler.
 

Detailed Description

Generic sampler used with bitmap data.

Currently limited to 8 bit per component data. Bitmap samplers currently provide no filtering, but could be easily extended to do so.

Method Documentation

- (id) initWithWidth: (NSUInteger)  width
height: (NSUInteger)  height
stride: (NSUInteger)  stride
bytesPerPixel: (NSUInteger)  bytesPerPixel
component: (NSUInteger)  component
flip: (bool)  flip
pixelData: (NSData *)  pixelData 

Init a sampler from bitmap data.

Stride refers to the length of a row of pixels in bytes. (Generally just w*h*bytesPerPixel unless there is padding) Image must use one byte per component, but can have any number of components. component refers to the 0-based index of the component to sample. (i.e. 3 would sample the alpha in an RGBA bitmap) flip allows you to flip the image vertically to match how it migh be drawn. pixelData can be either a NSData or NSMutableData (i.e. for deformable terrain) that contains the bitmap data.

Property Documentation

- (cpBB) outputRect
readwritenonatomicassign

Rect that the image maps to.

Defaults to (0.5, 0.5, width - 0.5, height - 0.5) so that pixel centers will be cleanly sampled.


The documentation for this class was generated from the following file: