00001 // vim:set ts=4 sw=4 noet cin: 00002 00003 #ifndef SLICERENDERER_H_ 00004 #define SLICERENDERER_H_ 00005 00006 #include "ARender.h" 00007 #include "Data.h" 00008 00017 class SliceRenderer : public ARender { 00018 public: 00019 SliceRenderer(Data& aData); 00020 ~SliceRenderer(); 00021 00022 enum Axis { 00023 AXIS_X, 00024 AXIS_Y, 00025 AXIS_Z 00026 }; 00027 00028 void setAxis(Axis newAxis); 00029 Axis getAxis() const; 00030 00031 void setPosition(unsigned int aPos); 00032 unsigned int getPosition() const; 00033 00034 unsigned int maxpos() const; 00035 00036 // ARender 00037 virtual Color getPixelColor(unsigned int x, unsigned int y); 00038 virtual Size getImageSize() const; 00039 virtual void render(unsigned char* buffer); 00040 00041 private: 00042 Data& mData; 00043 Axis mAxis; 00044 unsigned int mPosition; 00045 00046 // OPTIMIZATION: 00047 // we will pass these values to getData, in this order. the indices 00048 // tell us which of the values is for the specified x and y. 00049 void calcCoords(); 00050 unsigned int mXIndex, mYIndex, mPosIndex; 00051 unsigned int mCoords[3]; 00052 }; 00053 00054 #endif