31 #ifndef vtkPixelTransfer_h
32 #define vtkPixelTransfer_h
34 #include "vtkCommonDataModelModule.h"
35 #include "vtkSetGet.h"
77 template<
typename SOURCE_TYPE,
typename DEST_TYPE>
91 template<
typename SOURCE_TYPE>
130 template<
typename SOURCE_TYPE>
137 SOURCE_TYPE *srcData,
154 (VTK_TT*)destData););
160 template<
typename SOURCE_TYPE,
typename DEST_TYPE>
167 SOURCE_TYPE *srcData,
171 if ( (srcData == NULL) || (destData == NULL) )
175 if ( (srcWholeExt == srcSubset)
176 && (destWholeExt == destSubset)
177 && (nSrcComps == nDestComps) )
180 size_t n = srcWholeExt.
Size()*nSrcComps;
181 for (
size_t i=0; i<n; ++i)
183 destData[i] =
static_cast<DEST_TYPE
>(srcData[i]);
192 srcWholeExt.
Size(tmp);
195 destWholeExt.
Size(tmp);
200 srcExt.
Shift(srcWholeExt);
203 destExt.
Shift(destWholeExt);
211 int nCopyComps = nSrcComps < nDestComps ? nSrcComps : nDestComps;
213 for (
int j=0; j<nxny[1]; ++j)
215 int sjj = swnx*(srcExt[2]+j)+srcExt[0];
216 int djj = dwnx*(destExt[2]+j)+destExt[0];
217 for (
int i=0; i<nxny[0]; ++i)
219 int sidx = nSrcComps*(sjj+i);
220 int didx = nDestComps*(djj+i);
222 for (
int p=0; p<nCopyComps; ++p)
224 destData[didx+p] =
static_cast<DEST_TYPE
>(srcData[sidx+p]);
227 for (
int p=nCopyComps; p<nDestComps; ++p)
229 destData[didx+p] =
static_cast<DEST_TYPE
>(0);
static int Blit(const vtkPixelExtent &ext, int nComps, int srcType, void *srcData, int destType, void *destData)
for memory to memory transfers.
Representation of a cartesian pixel plane and common operations on it.
void Size(T nCells[2]) const
Get the number in each direction.
void Shift()
Shifts by low corner of this, moving to the origin.