20#include "kis_tiff_reader.h"
24#include <kis_iterators_pixel.h>
25#include <kis_paint_device.h>
27#include "kis_tiff_stream.h"
29 uint KisTIFFReaderTarget8bit::copyDataToChannels( TQ_UINT32 x, TQ_UINT32 y, TQ_UINT32 dataWidth, TIFFStreamBase* tiffstream)
31 KisHLineIterator it = paintDevice() -> createHLineIterator(x, y, dataWidth,
true);
32 double coeff = TQ_UINT8_MAX / (double)( pow(2, sourceDepth() ) - 1 );
34 while (!it.isDone()) {
35 TQ_UINT8 *d = it.rawData();
37 for(i = 0; i < nbColorsSamples() ; i++)
39 d[poses()[i]] = (TQ_UINT8)( tiffstream->nextValue() * coeff );
41 postProcessor()->postProcess8bit( d);
42 if(transform()) cmsDoTransform(transform(), d, d, 1);
43 d[poses()[i]] = TQ_UINT8_MAX;
44 for(
int k = 0; k < nbExtraSamples(); k++)
47 d[poses()[i]] = (TQ_UINT32) ( tiffstream->nextValue() * coeff );
49 tiffstream->nextValue();
55 uint KisTIFFReaderTarget16bit::copyDataToChannels( TQ_UINT32 x, TQ_UINT32 y, TQ_UINT32 dataWidth, TIFFStreamBase* tiffstream)
57 KisHLineIterator it = paintDevice() -> createHLineIterator(x, y, dataWidth,
true);
58 double coeff = TQ_UINT16_MAX / (double)( pow(2, sourceDepth() ) - 1 );
60 while (!it.isDone()) {
61 TQ_UINT16 *d =
reinterpret_cast<TQ_UINT16 *
>(it.rawData());
63 for(i = 0; i < nbColorsSamples(); i++)
65 d[poses()[i]] = (TQ_UINT16)( tiffstream->nextValue() * coeff );
67 postProcessor()->postProcess16bit( d);
68 if(transform()) cmsDoTransform(transform(), d, d, 1);
69 d[poses()[i]] = TQ_UINT16_MAX;
70 for(
int k = 0; k < nbExtraSamples(); k++)
73 d[poses()[i]] = (TQ_UINT16) ( tiffstream->nextValue() * coeff );
75 tiffstream->nextValue();
82 uint KisTIFFReaderTarget32bit::copyDataToChannels( TQ_UINT32 x, TQ_UINT32 y, TQ_UINT32 dataWidth, TIFFStreamBase* tiffstream)
84 KisHLineIterator it = paintDevice() -> createHLineIterator(x, y, dataWidth,
true);
85 double coeff = TQ_UINT32_MAX / (double)( pow(2, sourceDepth() ) - 1 );
87 while (!it.isDone()) {
88 TQ_UINT32 *d =
reinterpret_cast<TQ_UINT32 *
>(it.rawData());
90 for(i = 0; i < nbColorsSamples(); i++)
92 d[poses()[i]] = (TQ_UINT32)( tiffstream->nextValue() * coeff );
94 postProcessor()->postProcess32bit( d);
95 if(transform()) cmsDoTransform(transform(), d, d, 1);
96 d[poses()[i]] = TQ_UINT32_MAX;
97 for(
int k = 0; k < nbExtraSamples(); k++)
100 d[poses()[i]] = (TQ_UINT32) ( tiffstream->nextValue() * coeff );
102 tiffstream->nextValue();
108 uint KisTIFFReaderFromPalette::copyDataToChannels(TQ_UINT32 x, TQ_UINT32 y, TQ_UINT32 dataWidth, TIFFStreamBase* tiffstream)
110 KisHLineIterator it = paintDevice() -> createHLineIterator(x, y, dataWidth,
true);
111 while (!it.isDone()) {
112 TQ_UINT16* d =
reinterpret_cast<TQ_UINT16 *
>(it.rawData());
113 uint32 index = tiffstream->nextValue();
115 d[1] = m_green[index];
116 d[0] = m_blue[index];
117 d[3] = TQ_UINT16_MAX;