#ifndef DOC_OUTPUT_H
#define DOC_OUTPUT_H


#include <memory>


struct DocImage;

// Messy
#include "hpdf.h"


class DocOutputPage
{
public:
	DocOutputPage(void*);
	~DocOutputPage();

	HPDF_Page page(); // TODO: remove need for this

	float width();
	float height();

	float textWidth(const char* str);

	void setColor(float, float, float);
	void setColor(unsigned int color);
	void setFontSize(int font, float size);

	void drawText(float x, float y, const char* str);
	void drawLine(float x1, float y1, float x2, float y2);
	void drawRect(float x1, float y1, float w, float h);
	void drawImage(DocImage& img, float x1, float y1, float w, float h);
	void drawImage(const char* fileName, float x1, float y1, float w, float h);
	void drawCircle(float x, float y, float radius);

private:
	struct Pimpl;
	std::unique_ptr<Pimpl> m_pimpl;
};


class DocOutputDevice
{
public:
	DocOutputDevice();
	~DocOutputDevice();

	DocImage& loadImage(const char* fileName);
	void freeImage(DocImage& image);

	DocOutputPage* newPage();

    void finalize(char* outputBuffer, size_t* size);
    void finalize(const char* outputFileName);

private:
	struct Pimpl;
	std::unique_ptr<Pimpl> m_pimpl;
};


#endif // DOC_OUTPUT_H

