75 lines
1.3 KiB
C++
75 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include <pdfengine/graphics_state.hpp>
|
|
#include <pdfengine/path.hpp>
|
|
|
|
namespace pdfengine {
|
|
|
|
enum class ContentObjectType {
|
|
Text,
|
|
Path,
|
|
Image,
|
|
Unknown
|
|
};
|
|
|
|
enum class XObjectType {
|
|
Image,
|
|
Form,
|
|
Pattern,
|
|
Unknown
|
|
};
|
|
|
|
class ContentObject {
|
|
public:
|
|
virtual ~ContentObject() = default;
|
|
virtual ContentObjectType getType() const = 0;
|
|
};
|
|
|
|
class TextObject : public ContentObject {
|
|
public:
|
|
ContentObjectType getType() const override { return ContentObjectType::Text; }
|
|
|
|
std::string text;
|
|
std::string fontName;
|
|
double fontSize = 0.0;
|
|
|
|
double tm[6] = {1.0, 0.0, 0.0, 1.0, 0.0, 0.0};
|
|
};
|
|
|
|
class ImageObject : public ContentObject {
|
|
public:
|
|
ContentObjectType getType() const override { return ContentObjectType::Image; }
|
|
|
|
std::string name;
|
|
int width = 0;
|
|
int height = 0;
|
|
std::string colorSpace;
|
|
std::string filter;
|
|
int bitsPerComponent = 8;
|
|
bool hasSoftMask = false;
|
|
|
|
std::vector<uint8_t> pixelData;
|
|
|
|
Matrix transform;
|
|
};
|
|
|
|
enum class PathPaintOp {
|
|
Stroke,
|
|
Fill,
|
|
FillStroke
|
|
};
|
|
|
|
class PathObject : public ContentObject {
|
|
public:
|
|
ContentObjectType getType() const override { return ContentObjectType::Path; }
|
|
|
|
Path path;
|
|
PathPaintOp paintOp = PathPaintOp::Stroke;
|
|
Matrix transform;
|
|
};
|
|
|
|
}
|