00001 //**************************************************************************/ 00002 // Copyright (c) 1998-2006 Autodesk, Inc. 00003 // All rights reserved. 00004 // 00005 // These coded instructions, statements, and computer programs contain 00006 // unpublished proprietary information written by Autodesk, Inc., and are 00007 // protected by Federal copyright law. They may not be disclosed to third 00008 // parties or copied or duplicated in any form, in whole or in part, without 00009 // the prior written consent of Autodesk, Inc. 00010 //**************************************************************************/ 00011 // FILE: pixelbuf.h 00012 // DESCRIPTION: Pixel Buffer Classes 00013 // These templated classes let you set up a buffer for pixels 00014 // that will automatically clean itself up when it goes out of 00015 // scope. 00016 // AUTHOR: Tom Hudson 00017 // HISTORY: Dec. 09 1995 - Started file 00018 //**************************************************************************/ 00019 00020 #pragma once 00021 00022 #include "maxheap.h" 00023 #include "maxheapdirect.h" 00024 #include "maxtypes.h" 00025 00038 template <class T> class PixelBufT: public MaxHeapOperators 00039 { 00040 private: 00041 T *buf; 00042 int width; 00043 public: 00049 inline PixelBufT(int width) { buf = (T *)MAX_calloc(width,sizeof(T)); this->width=width; }; 00051 inline ~PixelBufT() { if(buf) MAX_free(buf); }; 00053 inline T* Ptr() { return buf; }; 00059 inline T& operator[](int i) { return buf[i]; } 00072 int Fill(int start, int count, T color) { 00073 int ix,jx=start+count; 00074 if(jx > width) // MAB - 07/15/03 - changed from >= 00075 return 0; 00076 for(ix=start; ix<jx; buf[ix++]=color); 00077 return 1; 00078 }; 00079 }; 00080 00081 typedef PixelBufT<UBYTE> PixelBuf8; 00082 typedef PixelBufT<USHORT> PixelBuf16; 00083 typedef PixelBufT<BMM_Color_24> PixelBuf24; 00084 typedef PixelBufT<BMM_Color_32> PixelBuf32; 00085 typedef PixelBufT<BMM_Color_48> PixelBuf48; 00086 typedef PixelBufT<BMM_Color_64> PixelBuf64; 00087 typedef PixelBufT<BMM_Color_fl> PixelBufFloat; 00088 00089 typedef PixelBufT<BMM_Color_64> PixelBuf; 00090