28#ifndef vtkPixelTransfer_h
29#define vtkPixelTransfer_h
31#include "vtkCommonDataModelModule.h"
45 static int Blit(
const vtkPixelExtent& ext,
int nComps,
int srcType,
void* srcData,
int destType,
54 void* srcData,
int nDestComps,
int destType,
void* destData);
59 template <
typename SOURCE_TYPE,
typename DEST_TYPE>
62 SOURCE_TYPE* srcData,
int nDestComps, DEST_TYPE* destData);
66 template <
typename SOURCE_TYPE>
69 SOURCE_TYPE* srcData,
int nDestComps,
int destType,
void* destData);
74 const vtkPixelExtent& ext,
int nComps,
int srcType,
void* srcData,
int destType,
void* destData)
77 ext, ext, ext, ext, nComps, srcType, srcData, nComps, destType, destData);
81template <
typename SOURCE_TYPE>
84 SOURCE_TYPE* srcData,
int nDestComps,
int destType,
void* destData)
90 nSrcComps, srcData, nDestComps, (VTK_TT*)destData););
96template <
typename SOURCE_TYPE,
typename DEST_TYPE>
99 SOURCE_TYPE* srcData,
int nDestComps, DEST_TYPE* destData)
101 if ((srcData ==
nullptr) || (destData ==
nullptr))
105 if ((srcWholeExt == srcSubset) && (destWholeExt == destSubset) && (nSrcComps == nDestComps))
108 size_t n = srcWholeExt.
Size() * nSrcComps;
109 for (
size_t i = 0; i < n; ++i)
111 destData[i] =
static_cast<DEST_TYPE
>(srcData[i]);
120 srcWholeExt.
Size(tmp);
123 destWholeExt.
Size(tmp);
128 srcExt.
Shift(srcWholeExt);
131 destExt.
Shift(destWholeExt);
139 int nCopyComps = nSrcComps < nDestComps ? nSrcComps : nDestComps;
141 for (
int j = 0; j < nxny[1]; ++j)
143 int sjj = swnx * (srcExt[2] + j) + srcExt[0];
144 int djj = dwnx * (destExt[2] + j) + destExt[0];
145 for (
int i = 0; i < nxny[0]; ++i)
147 int sidx = nSrcComps * (sjj + i);
148 int didx = nDestComps * (djj + i);
150 for (
int p = 0; p < nCopyComps; ++p)
152 destData[didx + p] =
static_cast<DEST_TYPE
>(srcData[sidx + p]);
155 for (
int p = nCopyComps; p < nDestComps; ++p)
157 destData[didx + p] =
static_cast<DEST_TYPE
>(0);
Representation of a cartesian pixel plane and common operations on it.
void Shift()
Shifts by low corner of this, moving to the origin.
void Size(T nCells[2]) const
Get the number in each direction.
static int Blit(const vtkPixelExtent &ext, int nComps, int srcType, void *srcData, int destType, void *destData)
for memory to memory transfers.
static int Blit(const vtkPixelExtent &srcWhole, const vtkPixelExtent &srcSubset, const vtkPixelExtent &destWhole, const vtkPixelExtent &destSubset, int nSrcComps, int srcType, void *srcData, int nDestComps, int destType, void *destData)
for memory to memory transfers.
vtkPixelTransfer()=default