7#ifndef CORE_FXGE_WIN32_CFX_PSRENDERER_H_
8#define CORE_FXGE_WIN32_CFX_PSRENDERER_H_
18#include "core/fxcrt/bytestring.h"
19#include "core/fxcrt/data_vector.h"
20#include "core/fxcrt/fx_coordinates.h"
21#include "core/fxcrt/fx_stream.h"
22#include "core/fxcrt/fx_string_wrappers.h"
23#include "core/fxcrt/retain_ptr.h"
24#include "core/fxcrt/span.h"
25#include "core/fxcrt/unowned_ptr.h"
26#include "core/fxge/cfx_graphstatedata.h"
38 DataVector<uint8_t> (*pA85EncodeFunc)(pdfium::span<
const uint8_t> src_span);
40 DataVector<uint8_t> (*pFlateEncodeFunc)(pdfium::span<
const uint8_t> src_span);
44 DataVector<uint8_t> (*pRunLengthEncodeFunc)(
45 pdfium::span<
const uint8_t> src_span);
77 uint32_t stroke_color,
103 pdfium::span<
const uint8_t> font_data);
109 size_t glyphs_per_descendant_font);
114 struct FaxCompressResult {
116 FaxCompressResult(
const FaxCompressResult&) =
delete;
117 FaxCompressResult& operator=(
const FaxCompressResult&) =
delete;
118 FaxCompressResult(FaxCompressResult&&)
noexcept;
119 FaxCompressResult& operator=(FaxCompressResult&&)
noexcept;
120 ~FaxCompressResult();
122 DataVector<uint8_t> data;
123 bool compressed =
false;
126 struct PSCompressResult {
128 PSCompressResult(
const PSCompressResult&) =
delete;
129 PSCompressResult& operator=(
const PSCompressResult&) =
delete;
130 PSCompressResult(PSCompressResult&&)
noexcept;
131 PSCompressResult& operator=(PSCompressResult&&)
noexcept;
134 DataVector<uint8_t> data;
138 void StartRendering();
142 void SetColor(uint32_t color);
143 void FindPSFontGlyph(CFX_GlyphCache* pGlyphCache,
148 void DrawTextAsType3Font(
int char_count,
152 fxcrt::ostringstream& buf);
153 bool DrawTextAsType42Font(
int char_count,
157 fxcrt::ostringstream& buf);
159 std::optional<PSCompressResult> PSCompressData(
160 pdfium::span<
const uint8_t> src_span)
const;
162 void WritePSBinary(pdfium::span<
const uint8_t> data);
163 void WriteStream(fxcrt::ostringstream& stream);
166 bool m_bInited =
false;
167 bool m_bGraphStateSet =
false;
168 bool m_bColorSet =
false;
170 uint32_t m_LastColor = 0;
176 std::vector<std::unique_ptr<Glyph>> m_PSFontList;
177 fxcrt::ostringstream m_PreambleOutput;
178 fxcrt::ostringstream m_Output;
179 std::vector<FX_RECT> m_ClipBoxStack;
fxcrt::ByteString ByteString
WindowsPrintMode g_pdfium_print_mode
@ kPostScript3Type42PassThrough
@ kPostScript3PassThrough
@ kPostScript2PassThrough
static std::optional< ByteString > GenerateType42SfntDataForTesting(const ByteString &psname, pdfium::span< const uint8_t > font_data)
bool DrawDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options)
bool SetDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top)
void SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState)
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FXDIB_ResampleOptions &options)
bool DrawText(int nChars, const TextCharPos *pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color)
static ByteString GenerateType42FontDictionaryForTesting(const ByteString &psname, const FX_RECT &bbox, size_t num_glyphs, size_t glyphs_per_descendant_font)
CFX_PSRenderer(CFX_PSFontTracker *font_tracker, const EncoderIface *encoder_iface)
FX_RECT GetClipBox() const
void SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options)
void Init(const RetainPtr< IFX_RetainableWriteStream > &stream, RenderingLevel level, int width, int height)
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options)
void RestoreState(bool bKeepSaved)
CFX_WindowsRenderDevice(HDC hDC, CFX_PSFontTracker *ps_font_tracker, const EncoderIface *encoder_iface)
~CFX_WindowsRenderDevice() override
~CPDF_WindowsRenderDevice() override
CPDF_WindowsRenderDevice(HDC hDC, CFX_PSFontTracker *ps_font_tracker)
fxcrt::ByteStringView ByteStringView
bool(* pJpegEncodeFunc)(const RetainPtr< const CFX_DIBBase > &pSource, uint8_t **dest_buf, size_t *dest_size)