33#define BUFFER_SIZE 4096
37struct DestinationManagerStruct
39 jpeg_destination_mgr pub;
50 DestinationManagerStruct * destination =
reinterpret_cast<DestinationManagerStruct *
>(cinfo->dest);
53 destination->buffer =
static_cast<JOCTET *
>(
54 (*cinfo->mem->alloc_small) (
reinterpret_cast<j_common_ptr
>(cinfo), JPOOL_IMAGE,
BUFFER_SIZE *
sizeof(JOCTET)));
56 destination->pub.next_output_byte = destination->buffer;
62 DestinationManagerStruct * destination =
reinterpret_cast<DestinationManagerStruct *
>(cinfo->dest);
66 ERREXIT(cinfo, JERR_FILE_WRITE);
69 destination->pub.next_output_byte = destination->buffer;
77 DestinationManagerStruct * destination =
reinterpret_cast<DestinationManagerStruct *
>(cinfo->dest);
78 size_t datacount =
BUFFER_SIZE - destination->pub.free_in_buffer;
83 if (destination->stream->WriteBytes(destination->buffer, datacount) != datacount)
85 ERREXIT(cinfo, JERR_FILE_WRITE);
95 DestinationManagerStruct * destination;
103 if (cinfo->dest ==
nullptr)
105 cinfo->dest =
static_cast<jpeg_destination_mgr*
>(
106 (*cinfo->mem->alloc_small) (
reinterpret_cast<j_common_ptr
>(cinfo), JPOOL_PERMANENT,
sizeof(DestinationManagerStruct)));
109 destination =
reinterpret_cast<DestinationManagerStruct *
>(cinfo->dest);
113 destination->stream =
stream;
117 mrStream ( rStream ),
118 mpBuffer ( nullptr ),
120 mpExpWasGrey ( pExportWasGrey )
129 for(
const auto& rValue : *pFilterData )
131 if ( rValue.Name ==
"StatusIndicator" )
141 void* pScanline =
nullptr;
161 *pTmp++ = aColor.
GetRed();
175 *pTmp++ = aColor.
GetRed();
227 for(
tools::Long nX = 0; bIsGrey && ( nX < nWidth ); nX++ )
static void init_destination(j_compress_ptr cinfo)
void jpeg_svstream_dest(j_compress_ptr cinfo, void *output)
static boolean empty_output_buffer(j_compress_ptr cinfo)
static void term_destination(j_compress_ptr cinfo)
Bitmap GetBitmap(Color aTransparentReplaceColor) const
tools::Long Height() const
tools::Long Width() const
ScanlineFormat GetScanlineFormat() const
const BitmapColor & GetPaletteColor(sal_uInt16 nColor) const
BitmapColor GetPixelFromData(const sal_uInt8 *pData, tools::Long nX) const
sal_uInt8 GetIndexFromData(const sal_uInt8 *pData, tools::Long nX) const
Scanline GetScanline(tools::Long nY) const
bool HasGreyPalette8Bit() const
bool Convert(BmpConversion eConversion)
Convert bitmap format.
vcl::ScopedBitmapAccess< BitmapReadAccess, Bitmap, &Bitmap::AcquireReadAccess > ScopedReadAccess
sal_uInt8 GetBlue() const
sal_uInt8 GetGreen() const
sal_Int32 ReadInt32(const OUString &rKey, sal_Int32 nDefault)
basegfx::B2DSize GetPPI() const
GraphicType GetType() const
BitmapEx GetBitmapEx(const GraphicConversionParameters &rParameters=GraphicConversionParameters()) const
Bitmap::ScopedReadAccess mpReadAccess
void * GetScanline(tools::Long nY)
css::uno::Reference< css::task::XStatusIndicator > mxStatusIndicator
bool Write(const Graphic &rGraphic)
sal_Int32 maChromaSubsampling
JPEGWriter(SvStream &rStream, const css::uno::Sequence< css::beans::PropertyValue > *pFilterData, bool *pExportWasGrey)
constexpr ::Color COL_WHITE(0xFF, 0xFF, 0xFF)
Reference< XOutputStream > stream
sal_uInt32 AlignedWidth4Bytes(sal_uInt32 nWidthBits)
bool WriteJPEG(JPEGWriter *pJPEGWriter, void *pOutputStream, tools::Long nWidth, tools::Long nHeight, basegfx::B2DSize const &aPPI, bool bGreyScale, tools::Long nQualityPercent, tools::Long aChromaSubsampling, css::uno::Reference< css::task::XStatusIndicator > const &status)
#define SAL_INFO(area, stream)