Public Member Functions | Properties

ChipmunkBitmapSampler Class Reference

Generic sampler used with bitmap data. More...

#import <ChipmunkImageSampler.h>

Inherits ChipmunkAbstractSampler.

Inherited by ChipmunkCGContextSampler.

List of all members.

Public Member Functions

(id) - initWithWidth:height:stride:bytesPerPixel:component:flip:pixelData:
 Init a sampler from bitmap data.
(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.

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.

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.


Member Function 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 [read, write, assign]

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:
 All Classes Functions Variables Properties