19#ifndef vtkPixelTransfer_h
20#define vtkPixelTransfer_h
22#include "vtkCommonDataModelModule.h"
27VTK_ABI_NAMESPACE_BEGIN
37 static int Blit(
const vtkPixelExtent& ext,
int nComps,
int srcType,
void* srcData,
int destType,
46 void* srcData,
int nDestComps,
int destType,
void* destData);
51 template <
typename SOURCE_TYPE,
typename DEST_TYPE>
54 SOURCE_TYPE* srcData,
int nDestComps, DEST_TYPE* destData);
58 template <
typename SOURCE_TYPE>
61 SOURCE_TYPE* srcData,
int nDestComps,
int destType,
void* destData);
66 const vtkPixelExtent& ext,
int nComps,
int srcType,
void* srcData,
int destType,
void* destData)
69 ext, ext, ext, ext, nComps, srcType, srcData, nComps, destType, destData);
73template <
typename SOURCE_TYPE>
76 SOURCE_TYPE* srcData,
int nDestComps,
int destType,
void* destData)
82 nSrcComps, srcData, nDestComps, (VTK_TT*)destData););
88template <
typename SOURCE_TYPE,
typename DEST_TYPE>
91 SOURCE_TYPE* srcData,
int nDestComps, DEST_TYPE* destData)
93 if ((srcData ==
nullptr) || (destData ==
nullptr))
97 if ((srcWholeExt == srcSubset) && (destWholeExt == destSubset) && (nSrcComps == nDestComps))
100 size_t n = srcWholeExt.
Size() * nSrcComps;
101 for (
size_t i = 0; i < n; ++i)
103 destData[i] =
static_cast<DEST_TYPE
>(srcData[i]);
112 srcWholeExt.
Size(tmp);
115 destWholeExt.
Size(tmp);
120 srcExt.
Shift(srcWholeExt);
123 destExt.
Shift(destWholeExt);
131 int nCopyComps = nSrcComps < nDestComps ? nSrcComps : nDestComps;
133 for (
int j = 0; j < nxny[1]; ++j)
135 int sjj = swnx * (srcExt[2] + j) + srcExt[0];
136 int djj = dwnx * (destExt[2] + j) + destExt[0];
137 for (
int i = 0; i < nxny[0]; ++i)
139 int sidx = nSrcComps * (sjj + i);
140 int didx = nDestComps * (djj + i);
142 for (
int p = 0; p < nCopyComps; ++p)
144 destData[didx + p] =
static_cast<DEST_TYPE
>(srcData[sidx + p]);
147 for (
int p = nCopyComps; p < nDestComps; ++p)
149 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