#ifndef SkPDFUtils_DEFINED
#define SkPDFUtils_DEFINED
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkStream.h"
#include "include/private/base/SkAssert.h"
#include "include/private/base/SkDebug.h"
#include "src/base/SkUTF.h"
#include "src/base/SkUtils.h"
#include "src/shaders/SkShaderBase.h"
#include "src/utils/SkFloatToDecimal.h"
#include <cstdint>
#include <cstring>
#include <memory>
class SkBitmap;
class SkImage;
class SkPDFArray;
class SkPDFDict;
class SkPath;
class SkShader;
enum class SkBlendMode;
enum class SkPathFillType;
struct SkRect;
namespace SkPDF { struct DateTime; }
template <typename T>
bool SkPackedArrayEqual(T* u, T* v, size_t n) { … }
#if 0
#define PRINT_NOT_IMPL …
#else
#define PRINT_NOT_IMPL(str) …
#endif
#define NOT_IMPLEMENTED(condition, assertion) …
namespace SkPDFUtils {
const char* BlendModeName(SkBlendMode);
std::unique_ptr<SkPDFArray> RectToArray(const SkRect& rect);
std::unique_ptr<SkPDFArray> MatrixToArray(const SkMatrix& matrix);
void MoveTo(SkScalar x, SkScalar y, SkWStream* content);
void AppendLine(SkScalar x, SkScalar y, SkWStream* content);
void AppendRectangle(const SkRect& rect, SkWStream* content);
void EmitPath(const SkPath& path, SkPaint::Style paintStyle,
bool doConsumeDegerates, SkWStream* content, SkScalar tolerance = 0.25f);
inline void EmitPath(const SkPath& path, SkPaint::Style paintStyle,
SkWStream* content, SkScalar tolerance = 0.25f) { … }
void ClosePath(SkWStream* content);
void PaintPath(SkPaint::Style style, SkPathFillType fill, SkWStream* content);
void StrokePath(SkWStream* content);
void ApplyGraphicState(int objectIndex, SkWStream* content);
void ApplyPattern(int objectIndex, SkWStream* content);
size_t ColorToDecimal(uint8_t value, char result[5]);
static constexpr unsigned kFloatColorDecimalCount = …;
size_t ColorToDecimalF(float value, char result[kFloatColorDecimalCount + 2]);
inline void AppendColorComponent(uint8_t value, SkWStream* wStream) { … }
inline void AppendColorComponentF(float value, SkWStream* wStream) { … }
inline void AppendScalar(SkScalar value, SkWStream* stream) { … }
inline void WriteUInt16BE(SkWStream* wStream, uint16_t value) { … }
inline void WriteUInt8(SkWStream* wStream, uint8_t value) { … }
inline void WriteUTF16beHex(SkWStream* wStream, SkUnichar utf32) { … }
inline SkMatrix GetShaderLocalMatrix(const SkShader* shader) { … }
bool InverseTransformBBox(const SkMatrix& matrix, SkRect* bbox);
void PopulateTilingPatternDict(SkPDFDict* pattern,
SkRect& bbox,
std::unique_ptr<SkPDFDict> resources,
const SkMatrix& matrix);
bool ToBitmap(const SkImage* img, SkBitmap* dst);
#ifdef SK_PDF_BASE85_BINARY
void Base85Encode(std::unique_ptr<SkStreamAsset> src, SkDynamicMemoryWStream* dst);
#endif
void AppendTransform(const SkMatrix&, SkWStream*);
void GetDateTime(SkPDF::DateTime*);
}
#endif