25 if( lineBitsCount / 8 > 0 )
27 if( extraBitsMask != 0 )
29 sal_uInt8 extraByte = bits[ lineBitsCount / 8 ] & extraBitsMask;
49 if( lineBitsCount % 8 != 0 )
51 const int extraBitsCount = lineBitsCount % 8;
56 static const sal_uInt8 mask1Bit[] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
57 extraBitsMask = mask1Bit[ extraBitsCount ];
62 static const sal_uInt8 mask1Bit[] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
63 extraBitsMask = mask1Bit[ extraBitsCount ];
67 assert(extraBitsCount == 4);
71 assert(extraBitsCount == 4);
104 class ImplPixelFormat
109 static ImplPixelFormat* GetFormat( sal_uInt16 nBits,
const BitmapPalette& rPalette );
111 virtual void StartLine(
const sal_uInt8* pLine ) { mpData = pLine; }
113 virtual ~ImplPixelFormat() { }
116 class ImplPixelFormat8 :
public ImplPixelFormat
123 : mrPalette( rPalette )
129 return mrPalette[ *mpData++ ];
133 class ImplPixelFormat4 :
public ImplPixelFormat
142 : mrPalette( rPalette )
147 virtual void StartLine(
const sal_uInt8* pLine )
override
155 sal_uInt32 nIdx = ( mpData[mnX >> 1] >> mnShift) & 0x0f;
164 class ImplPixelFormat1 :
public ImplPixelFormat
172 : mrPalette(rPalette)
176 virtual void StartLine(
const sal_uInt8* pLine )
override
183 const BitmapColor& rColor = mrPalette[ (mpData[mnX >> 3 ] >> ( 7 - ( mnX & 7 ) )) & 1];
189 ImplPixelFormat* ImplPixelFormat::GetFormat( sal_uInt16 nBits,
const BitmapPalette& rPalette )
193 case 1:
return new ImplPixelFormat1( rPalette );
194 case 4:
return new ImplPixelFormat4( rPalette );
195 case 8:
return new ImplPixelFormat8( rPalette );
206 void writeColorRGBA(
sal_uInt8 color8Bit,
sal_uInt8*& dst ) { *dst++ = color8Bit; *dst++ = color8Bit; *dst++ = color8Bit; *dst++ = 0xff; };
208 void writeBlackA8(
sal_uInt8*& dst,
int count ) { memset( dst, 0, count ); dst += count; };
209 void writeWhiteA8(
sal_uInt8*& dst,
int count ) { memset( dst, 0xff, count ); dst += count; };
210 void writeWhiteRGBA(
sal_uInt8*& dst,
int count ) { memset( dst, 0xff, count * 4 ); dst += count * 4; };
211 void writeBlackRGBA(
sal_uInt8*& dst,
int count )
213 for(
int i = 0;
i < count; ++
i )
223 template< WriteColorFunction func, WriteBlackWhiteFunction funcBlack, WriteBlackWhiteFunction funcWhite >
224 void writeBlackWhiteData(
const sal_uInt8* src,
sal_uInt8* dst,
int width,
int height,
int bytesPerRow )
226 for(
int y = 0;
y < height; ++
y )
233 const sal_uInt64* src64 =
reinterpret_cast< const sal_uInt64*
>( src );
235 funcBlack( dst, 64 );
236 else if( *src64 == static_cast< sal_uInt64 >( -1 ))
237 funcWhite( dst, 64 );
240 src +=
sizeof( sal_uInt64 );
247 else if( *src == 0xff )
250 for(
int bit = 7;
bit >= 0; --
bit )
251 func(( *src >> bit ) & 1 ? 0xff : 0, dst );
255 for(
int bit = 7;
bit > 7 - xsize; --
bit )
256 func(( *src >> bit ) & 1 ? 0xff : 0, dst );
258 src = srcLine + bytesPerRow;
267 assert( bitCount == 1 || bitCount == 4 || bitCount == 8 );
269 std::unique_ptr< sal_uInt8[] >
data(
new sal_uInt8[width * height * bpp[ type ]] );
273 for(
int y = 0;
y < height; ++
y )
274 memcpy( data.get() +
y * width, src +
y * bytesPerRow, width );
283 writeBlackWhiteData< writeColorA8, writeBlackA8, writeWhiteA8 >
284 ( src, data.get(), width, height, bytesPerRow );
289 writeBlackWhiteData< writeColorRGBA, writeBlackRGBA, writeWhiteRGBA >
290 ( src, data.get(), width, height, bytesPerRow );
295 std::unique_ptr<ImplPixelFormat> pSrcFormat(ImplPixelFormat::GetFormat(bitCount, palette));
300 sal_uInt32 nY = height;
303 pSrcFormat->StartLine( pSrcData );
305 sal_uInt32 nX = width;
337 pSrcData += bytesPerRow;
sal_uInt64 BitmapChecksum
const size_t count(pCandidateA->getBorderLines().size())
bool IsGreyPalette8Bit() const
Returns true if the palette is 8-bit grey palette.
BitmapChecksum GetChecksum() const
void updateChecksum() const
BitmapChecksum mnChecksum
BitmapChecksum vcl_get_checksum(BitmapChecksum Checksum, const void *Data, sal_uInt32 DatLen)
static BitmapChecksum scanlineChecksum(BitmapChecksum nCrc, const sal_uInt8 *bits, int lineBitsCount, sal_uInt8 extraBitsMask)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt8 GetBlue() const
sal_uInt16 GetEntryCount() const
static std::unique_ptr< sal_uInt8[] > convertDataBitCount(const sal_uInt8 *src, int width, int height, int bitCount, int bytesPerRow, const BitmapPalette &palette, BitConvert type)
exports com.sun.star.chart2. data
sal_uInt8 GetGreen() const
tools::Long mnScanlineSize
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
ScanlineFormat RemoveScanline(ScanlineFormat nFormat)
virtual void ReleaseBuffer(BitmapBuffer *pBuffer, BitmapAccessMode nMode)=0
virtual BitmapBuffer * AcquireBuffer(BitmapAccessMode nMode)=0