/usr/include/podofo/doc/PdfPainterMM.h is in libpodofo-dev 0.9.5-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | /***************************************************************************
* Copyright (C) 2006 by Dominik Seichter *
* domseichter@web.de *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Library General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
* In addition, as a special exception, the copyright holders give *
* permission to link the code of portions of this program with the *
* OpenSSL library under certain conditions as described in each *
* individual source file, and distribute linked combinations *
* including the two. *
* You must obey the GNU General Public License in all respects *
* for all of the code used other than OpenSSL. If you modify *
* file(s) with this exception, you may extend this exception to your *
* version of the file(s), but you are not obligated to do so. If you *
* do not wish to do so, delete this exception statement from your *
* version. If you delete this exception statement from all source *
* files in the program, then also delete it here. *
***************************************************************************/
#ifndef _PDF_PAINTER_MM_H_
#define _PDF_PAINTER_MM_H_
#include "podofo/base/PdfDefines.h"
#include "PdfPainter.h"
namespace PoDoFo {
class PdfCanvas;
class PdfFont;
class PdfImage;
class PdfName;
class PdfObject;
class PdfReference;
class PdfStream;
class PdfString;
class PdfXObject;
#ifndef CONVERSION_CONSTANT
/** \def CONVERSION_CONSTANT
* Conversation constant to convert 1/1000th mm to 1/72 inch
* Internal use only.
*/
#define CONVERSION_CONSTANT 0.002834645669291339
#endif // CONVERSION_CONSTANT
/**
* This class provides an easy to use painter object which allows you to draw on a PDF page
* object.
*
* During all drawing operations, you are still able to access the stream of the object you are
* drawing on directly.
*
* This painter takes all coordinates in 1/1000th mm instead of PDF units.
*
* Developer note: we use ownership rather than inheritance here, so as to use the same
* methods names a PdfPainter AND avoid compiler confusion on picking the right one.
*
* \see PdfPainter
*/
class PODOFO_DOC_API PdfPainterMM : public PdfPainter {
public:
/** Create a new PdfPainterMM object.
*/
PdfPainterMM() {}
virtual ~PdfPainterMM();
/** Set the line width for all stroking operations.
* \param lWidth in 1/1000th mm
*/
inline void SetStrokeWidthMM( long lWidth );
/** Draw a line with the current color and line settings.
* \param lStartX x coordinate of the starting point
* \param lStartY y coordinate of the starting point
* \param lEndX x coordinate of the ending point
* \param lEndY y coordinate of the ending point
*/
inline void DrawLineMM( long lStartX, long lStartY, long lEndX, long lEndY );
/** Add a rectangle into the current path
* \param lX x coordinate of the rectangle
* \param lY y coordinate of the rectangle
* \param lWidth width of the rectangle
* \param lHeight absolute height of the rectangle
*/
inline void RectangleMM( long lX, long lY, long lWidth, long lHeight );
/** Add an ellipse into the current path
* \param lX x coordinate of the ellipse (left coordinate)
* \param lY y coordinate of the ellipse (top coordinate)
* \param lWidth width of the ellipse
* \param lHeight absolute height of the ellipse
*/
inline void EllipseMM( long lX, long lY, long lWidth, long lHeight );
/** Draw a text string on a page using a given font object.
* You have to call SetFont before calling this function.
* \param lX the x coordinate
* \param lY the y coordinate
* \param sText the text string which should be printed
*
* \see PdfPainter::SetFont()
*/
inline void DrawTextMM( long lX, long lY, const PdfString & sText);
/** Draw a text string on a page using a given font object.
* You have to call SetFont before calling this function.
* \param lX the x coordinate
* \param lY the y coordinate
* \param sText the text string which should be printed (is not allowed to be NULL!)
* \param lLen draw only lLen characters of pszText
*
* \see PdfPainter::SetFont()
*/
inline void DrawTextMM( long lX, long lY, const PdfString & sText, long lLen );
/** Draw an image on the current page.
* \param lX the x coordinate (bottom left position of the image)
* \param lY the y coordinate (bottom position of the image)
* \param pObject an PdfXObject
* \param dScaleX option scaling factor in x direction
* \param dScaleY option scaling factor in y direction
*/
inline void DrawImageMM( long lX, long lY, PdfImage* pObject, double dScaleX = 1.0, double dScaleY = 1.0);
/** Draw an XObject on the current page.
* \param lX the x coordinate (bottom left position of the XObject)
* \param lY the y coordinate (bottom position of the XObject)
* \param pObject an PdfXObject
* \param dScaleX option scaling factor in x direction
* \param dScaleY option scaling factor in y direction
*/
inline void DrawXObjectMM( long lX, long lY, PdfXObject* pObject, double dScaleX = 1.0, double dScaleY = 1.0);
/** Append a line segment to the current path. Matches the PDF 'l' operator.
* This function is useful to construct an own path
* for drawing or clipping.
* \param lX x position
* \param lY y position
*/
inline void LineToMM( long lX, long lY );
/** Begin a new path. Matches the PDF 'm' operator.
* This function is useful to construct an own path
* for drawing or clipping.
* \param lX x position
* \param lY y position
*/
inline void MoveToMM( long lX, long lY );
};
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::SetStrokeWidthMM( long lWidth )
{
this->SetStrokeWidth( static_cast<double>(lWidth) * CONVERSION_CONSTANT );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::DrawLineMM( long lStartX, long lStartY, long lEndX, long lEndY )
{
this->DrawLine( static_cast<double>(lStartX) * CONVERSION_CONSTANT,
static_cast<double>(lStartY) * CONVERSION_CONSTANT,
static_cast<double>(lEndX) * CONVERSION_CONSTANT,
static_cast<double>(lEndY) * CONVERSION_CONSTANT );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::RectangleMM( long lX, long lY, long lWidth, long lHeight )
{
this->Rectangle( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT,
static_cast<double>(lWidth) * CONVERSION_CONSTANT,
static_cast<double>(lHeight) * CONVERSION_CONSTANT );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::EllipseMM( long lX, long lY, long lWidth, long lHeight )
{
this->Ellipse( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT,
static_cast<double>(lWidth) * CONVERSION_CONSTANT,
static_cast<double>(lHeight) * CONVERSION_CONSTANT );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::DrawTextMM( long lX, long lY, const PdfString & sText)
{
this->DrawText( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT,
sText );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::DrawTextMM( long lX, long lY, const PdfString & sText, long lLen )
{
this->DrawText( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT,
sText, lLen );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::DrawImageMM( long lX, long lY, PdfImage* pObject, double dScaleX, double dScaleY )
{
this->DrawImage( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT,
pObject, dScaleX, dScaleY );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::DrawXObjectMM( long lX, long lY, PdfXObject* pObject, double dScaleX, double dScaleY )
{
this->DrawXObject( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT,
pObject, dScaleX, dScaleY );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::LineToMM( long lX, long lY )
{
this->LineTo( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT );
}
// -----------------------------------------------------
//
// -----------------------------------------------------
inline void PdfPainterMM::MoveToMM( long lX, long lY )
{
this->MoveTo( static_cast<double>(lX) * CONVERSION_CONSTANT,
static_cast<double>(lY) * CONVERSION_CONSTANT );
}
};
#endif // _PDF_PAINTER_MM_H_
|