/****************************************************************************** This source file is part of the Avogadro project. This source code is released under the 3-Clause BSD License, (see "LICENSE"). ******************************************************************************/ #ifndef AVOGADRO_RENDERING_TEXTRENDERSTRATEGY_H #define AVOGADRO_RENDERING_TEXTRENDERSTRATEGY_H #include "avogadrorenderingexport.h" #include #include namespace Avogadro { namespace Rendering { class TextProperties; /** * @class TextRenderStrategy textrenderstrategy.h * * @brief The TextRenderStrategy class defines an interface for generating * text images. */ class AVOGADRORENDERING_EXPORT TextRenderStrategy { public: TextRenderStrategy(); virtual ~TextRenderStrategy(); /** * Copy the current TextRenderStrategy implementation into an new object. */ virtual TextRenderStrategy* newInstance() const = 0; /** * @brief Calculate a bounding box. * @param string The text. * @param tprop The properties. * @param bbox The result in pixels (left, right, top, bottom). */ virtual void boundingBox(const std::string& string, const TextProperties& tprop, int bbox[4]) const = 0; /** * @brief render Render the string. * @param string The text. * @param tprop The properties. * @param buffer The target. Must be dims[0]*dims[1]*4 * bytes. The buffer will be filled with RGBA image data, with the top * scan row at the beginning. * @param dims Dimensions in pixels of the target buffer. */ virtual void render(const std::string& string, const TextProperties& tprop, unsigned char* buffer, const Vector2i& dims) const = 0; }; } // namespace Rendering } // namespace Avogadro #endif // AVOGADRO_RENDERING_TEXTRENDERSTRATEGY_H