Logo Search packages:      
Sourcecode: codeblocks version File versions  Download package

pdfproperties.h

Go to the documentation of this file.
///////////////////////////////////////////////////////////////////////////////
// Name:        pdfproperties.h
// Purpose:     
// Author:      Ulrich Telle
// Modified by:
// Created:     2006-07-13
// Copyright:   (c) Ulrich Telle
// Licence:     wxWindows licence
///////////////////////////////////////////////////////////////////////////////

/// \file pdfproperties.h Interface of the several wxPdfDocument property classes

#ifndef _PDFPROPERTIES_H_
#define _PDFPROPERTIES_H_

// wxWidgets headers
#include "wx/pdfdocdef.h"

/// Border options
00020 #define wxPDF_BORDER_NONE    0x0000
#define wxPDF_BORDER_LEFT    0x0001
#define wxPDF_BORDER_RIGHT   0x0002
#define wxPDF_BORDER_TOP     0x0004
#define wxPDF_BORDER_BOTTOM  0x0008
#define wxPDF_BORDER_FRAME   0x000F

/// Corner options
00028 #define wxPDF_CORNER_NONE          0x0000
#define wxPDF_CORNER_TOP_LEFT      0x0001
#define wxPDF_CORNER_TOP_RIGHT     0x0002
#define wxPDF_CORNER_BOTTOM_LEFT   0x0004
#define wxPDF_CORNER_BOTTOM_RIGHT  0x0008
#define wxPDF_CORNER_ALL           0x000F

/// Style options
00036 #define wxPDF_STYLE_NOOP      0x0000
#define wxPDF_STYLE_DRAW      0x0001
#define wxPDF_STYLE_FILL      0x0002
#define wxPDF_STYLE_FILLDRAW  0x0003
#define wxPDF_STYLE_DRAWCLOSE 0x0004
#define wxPDF_STYLE_MASK      0x0007

/// Font decoration options
00044 #define wxPDF_FONT_NORMAL     0x0000
#define wxPDF_FONT_UNDERLINE  0x0001
#define wxPDF_FONT_OVERLINE   0x0002
#define wxPDF_FONT_STRIKEOUT  0x0004
#define wxPDF_FONT_DECORATION 0x0007 // Mask all possible decorations

/// Permission options
00051 #define wxPDF_PERMISSION_NONE   0x0000  ///< Allow nothing
00052 #define wxPDF_PERMISSION_PRINT  0x0004  ///< Allow printing
00053 #define wxPDF_PERMISSION_MODIFY 0x0008  ///< Allow modifying
00054 #define wxPDF_PERMISSION_COPY   0x0010  ///< Allow text copying
00055 #define wxPDF_PERMISSION_ANNOT  0x0020  ///< Allow annotations
00056 #define wxPDF_PERMISSION_ALL    0x003C  ///< Allow anything

/// Encryption methods
00059 enum wxPdfEncryptionMethod
{
  wxPDF_ENCRYPTION_RC4V1,
  wxPDF_ENCRYPTION_RC4V2,
  wxPDF_ENCRYPTION_AESV2
};

/// Color types
00067 enum wxPdfColourType
{
  wxPDF_COLOURTYPE_UNKNOWN,
  wxPDF_COLOURTYPE_GRAY,
  wxPDF_COLOURTYPE_RGB,
  wxPDF_COLOURTYPE_CMYK,
  wxPDF_COLOURTYPE_SPOT
};

/// Form field border styles
00077 enum wxPdfBorderStyle
{
  wxPDF_BORDER_SOLID,
  wxPDF_BORDER_DASHED,
  wxPDF_BORDER_BEVELED,
  wxPDF_BORDER_INSET,
  wxPDF_BORDER_UNDERLINE
};

/// Alignment options
00087 enum wxPdfAlignment
{
  wxPDF_ALIGN_LEFT,
  wxPDF_ALIGN_CENTER,
  wxPDF_ALIGN_RIGHT,
  wxPDF_ALIGN_JUSTIFY,
  wxPDF_ALIGN_TOP    = wxPDF_ALIGN_LEFT,
  wxPDF_ALIGN_MIDDLE = wxPDF_ALIGN_CENTER,
  wxPDF_ALIGN_BOTTOM = wxPDF_ALIGN_RIGHT
};

/// Zoom options
00099 enum wxPdfZoom
{
  wxPDF_ZOOM_FULLPAGE,
  wxPDF_ZOOM_FULLWIDTH,
  wxPDF_ZOOM_REAL,
  wxPDF_ZOOM_DEFAULT,
  wxPDF_ZOOM_FACTOR
};

/// Layout options
00109 enum wxPdfLayout
{
  wxPDF_LAYOUT_CONTINUOUS,
  wxPDF_LAYOUT_SINGLE,
  wxPDF_LAYOUT_TWO,
  wxPDF_LAYOUT_DEFAULT
};

/// Viewer preferences
00118 #define wxPDF_VIEWER_HIDETOOLBAR     0x0001
#define wxPDF_VIEWER_HIDEMENUBAR     0x0002
#define wxPDF_VIEWER_HIDEWINDOWUI    0x0004
#define wxPDF_VIEWER_FITWINDOW       0x0008
#define wxPDF_VIEWER_CENTERWINDOW    0x0010
#define wxPDF_VIEWER_DISPLAYDOCTITLE 0x0020

/// Line Cap options
00126 enum wxPdfLineCap
{
  wxPDF_LINECAP_NONE   = -1,
  wxPDF_LINECAP_BUTT   = 0,
  wxPDF_LINECAP_ROUND  = 1,
  wxPDF_LINECAP_SQUARE = 2
};

/// Line join options
00135 enum wxPdfLineJoin
{
  wxPDF_LINEJOIN_NONE  = -1,
  wxPDF_LINEJOIN_MITER = 0,
  wxPDF_LINEJOIN_ROUND = 1,
  wxPDF_LINEJOIN_BEVEL = 2
};

/// Marker symbols
00144 enum wxPdfMarker
{
  wxPDF_MARKER_CIRCLE,
  wxPDF_MARKER_SQUARE,
  wxPDF_MARKER_TRIANGLE_UP,
  wxPDF_MARKER_TRIANGLE_DOWN,
  wxPDF_MARKER_TRIANGLE_LEFT,
  wxPDF_MARKER_TRIANGLE_RIGHT,
  wxPDF_MARKER_DIAMOND,
  wxPDF_MARKER_PENTAGON_UP,
  wxPDF_MARKER_PENTAGON_DOWN,
  wxPDF_MARKER_PENTAGON_LEFT,
  wxPDF_MARKER_PENTAGON_RIGHT,
  wxPDF_MARKER_STAR,
  wxPDF_MARKER_STAR4,
  wxPDF_MARKER_PLUS,
  wxPDF_MARKER_CROSS,
  wxPDF_MARKER_SUN,
  wxPDF_MARKER_BOWTIE_HORIZONTAL,
  wxPDF_MARKER_BOWTIE_VERTICAL,
  wxPDF_MARKER_ASTERISK,
  wxPDF_MARKER_LAST  // Marks the last available marker symbol; do not use!
};

/// Linear gradient types
00169 enum wxPdfLinearGradientType
{
  wxPDF_LINEAR_GRADIENT_HORIZONTAL,
  wxPDF_LINEAR_GRADIENT_VERTICAL,
  wxPDF_LINEAR_GRADIENT_MIDHORIZONTAL,
  wxPDF_LINEAR_GRADIENT_MIDVERTICAL,
  wxPDF_LINEAR_GRADIENT_REFLECTION_LEFT,
  wxPDF_LINEAR_GRADIENT_REFLECTION_RIGHT,
  wxPDF_LINEAR_GRADIENT_REFLECTION_TOP,
  wxPDF_LINEAR_GRADIENT_REFLECTION_BOTTOM
};

enum wxPdfBlendMode
{
  wxPDF_BLENDMODE_NORMAL,
  wxPDF_BLENDMODE_MULTIPLY, 
  wxPDF_BLENDMODE_SCREEN, 
  wxPDF_BLENDMODE_OVERLAY, 
  wxPDF_BLENDMODE_DARKEN, 
  wxPDF_BLENDMODE_LIGHTEN, 
  wxPDF_BLENDMODE_COLORDODGE, 
  wxPDF_BLENDMODE_COLORBURN,
  wxPDF_BLENDMODE_HARDLIGHT,
  wxPDF_BLENDMODE_SOFTLIGHT,
  wxPDF_BLENDMODE_DIFFERENCE, 
  wxPDF_BLENDMODE_EXCLUSION, 
  wxPDF_BLENDMODE_HUE, 
  wxPDF_BLENDMODE_SATURATION, 
  wxPDF_BLENDMODE_COLOR, 
  wxPDF_BLENDMODE_LUMINOSITY
};

enum wxPdfShapedTextMode
{
  wxPDF_SHAPEDTEXTMODE_ONETIME,
  wxPDF_SHAPEDTEXTMODE_STRETCHTOFIT,
  wxPDF_SHAPEDTEXTMODE_REPEAT
};

/// Class representing a PDF document information dictionary.
00209 class WXDLLIMPEXP_PDFDOC wxPdfInfo
{
public:
  wxPdfInfo() {}
  virtual~wxPdfInfo() {}

  void SetTitle(const wxString& title) { m_title = title; }
  void SetAuthor(const wxString& author) { m_author = author; }
  void SetSubject(const wxString& subject) { m_subject = subject; }
  void SetKeywords(const wxString& keywords) { m_keywords = keywords; }
  void SetCreator(const wxString& creator) { m_creator = creator; }
  void SetProducer(const wxString& producer) { m_producer = producer; }
  void SetCreationDate(const wxString& creationDate) { m_creationDate = creationDate; }
  void SetModDate(const wxString& modDate) { m_modDate = modDate; }

  const wxString GetTitle() const { return m_title; }
  const wxString GetAuthor() const { return m_author; }
  const wxString GetSubject() const { return m_subject; }
  const wxString GetKeywords() const { return m_keywords; }
  const wxString GetCreator() const { return m_creator; }
  const wxString GetProducer() const { return m_producer; }
  const wxString GetCreationDate() const { return m_creationDate; }
  const wxString GetModDate() const { return m_modDate; }

private:
00234   wxString m_title;        ///< The documentís title.
00235   wxString m_author;       ///< The name of the person who created the document.
00236   wxString m_subject;      ///< The subject of the document.
00237   wxString m_keywords;     ///< Keywords associated with the document.
00238   wxString m_creator;      ///< The name of the application that created the original document.
00239   wxString m_producer;     ///< The name of the application that produced the document.
00240   wxString m_creationDate; ///< The date and time the document was created.
00241   wxString m_modDate;      ///< The date and time the document was modified.
};

/// Class representing internal or external links.
00245 class WXDLLIMPEXP_PDFDOC wxPdfLink
{
public:
  /// Constructor for internal link
  /**
  * Use this constructor to create an \b internal link reference.
  * \see wxPdfDocument::Link(), wxPdfDocument::Write(), wxPdfDocument::Cell(), wxPdfDocument::ClippedCell(), wxPdfDocument::Image(), wxPdfDocument::RotatedImage()
  */
  wxPdfLink(int linkRef);

  /// Constructor for external link
  /**
  * Use this constructor to create an \b external link reference.
  * \see wxPdfDocument::Link(), wxPdfDocument::Write(), wxPdfDocument::Cell(), wxPdfDocument::ClippedCell(), wxPdfDocument::Image(), wxPdfDocument::RotatedImage()
  */
  wxPdfLink(const wxString& linkURL);

  /// Copy constructor
  wxPdfLink(const wxPdfLink& pdfLink);

  /// Destructor
  virtual ~wxPdfLink();

  /// Check whether this instance is a valid link reference
00269   bool  IsValid() const { return m_isValid; }

  /// Check whether this instance is an internal reference
00272   bool  IsLinkRef() const { return m_isRef; }

  /// Get the internal link reference
00275   int   GetLinkRef() const { return m_linkRef; }

  /// Get the external link reference
00278   const wxString GetLinkURL() const { return m_linkURL; }

  /// Set page number and position on page
00281   void   SetLink(int page, double ypos) { m_page = page; m_ypos = ypos; }

  /// Get the page this link refers to
00284   int    GetPage() { return m_page; }

  /// Get the page position this link refers to
00287   double GetPosition() { return m_ypos; }

private:
00290   bool     m_isValid;   ///< Flag whether this instance is valid
00291   bool     m_isRef;     ///< Flag whether this is an internal link reference
00292   int      m_linkRef;   ///< Internal link reference
00293   wxString m_linkURL;   ///< External link reference
00294   int      m_page;      ///< Page number this link refers to
00295   double   m_ypos;      ///< Position on page this link refers to
};

/// Class representing the sensitive area of links referring to a page. (For internal use only)
00299 class WXDLLIMPEXP_PDFDOC wxPdfPageLink : public wxPdfLink
{
public:
  /// Constructor
  wxPdfPageLink(double x, double y, double w, double h, const wxPdfLink& pdfLink);

  /// Destructor
  virtual ~wxPdfPageLink();

  /// Get the X offset
00309   double GetX() { return m_x; }

  /// Get the Y offset
00312   double GetY() { return m_y; }

  /// Get the width
00315   double GetWidth() { return m_w; }

  /// Get the height
00318   double GetHeight() { return m_h; }

private:
00321   double m_x;   ///< X offset of sensitive area
00322   double m_y;   ///< Y offset of sensitive area
00323   double m_w;   ///< Width of sensitive area
00324   double m_h;   ///< Height of sensitive area
};

/// Class representing text annotations.
00328 class WXDLLIMPEXP_PDFDOC wxPdfAnnotation
{
public:
  /// Constructor for text annotation
  /**
  * Use this constructor to create a text annotation.
  * \param x X offset of the annotation
  * \param y Y offset of the annotation
  * \param text annotation text
  */
  wxPdfAnnotation(double x, double y, const wxString& text);

  /// Copy constructor
  wxPdfAnnotation(const wxPdfAnnotation& annotation);

  /// Destructor
00344   virtual ~wxPdfAnnotation() {}

  /// Get the X offset of the annotation
00347   double GetX() const { return m_x; }

  /// Get the Y offset of the annotation
00350   double GetY() const { return m_y; }

  /// Get the text of the annotation
00353   wxString GetText() const { return m_text; }

private:
00356   double   m_x;     ///< X offset of the annotation
00357   double   m_y;     ///< Y offset of the annotation
00358   wxString m_text;  ///< Annotation text
};

/// Class representing bookmarks for defining the document's outline. (For internal use only)
00362 class WXDLLIMPEXP_PDFDOC wxPdfBookmark
{
public:
  /// Constructor
  wxPdfBookmark(const wxString& txt, int level, double y, int page);

  /// Destructor
  virtual ~wxPdfBookmark();

  /// Get the bookmark text
00372   wxString GetText() { return m_text; }

  /// Get the associated level
00375   int GetLevel() { return m_level; }

  /// Get the Y offset of the bookmark
00378   double GetY() { return m_y; }

  /// Get the page number of the bookmark
00381   int GetPage() { return m_page; }

  /// Set the parent of the bookmark
00384   void SetParent(int parent) { m_parent = parent; }

  /// Get the parent of the bookmark
00387   int GetParent() { return m_parent; }

  /// Set previous bookmark
00390   void SetPrev(int prev) { m_prev = prev; }

  /// Get previous bookmark
00393   int GetPrev() { return m_prev; }

  /// Set next bookmark
00396   void SetNext(int next) { m_next = next; }

  /// Get next bookmark
00399   int GetNext() { return m_next; }

  /// Set first bookmark
00402   void SetFirst(int first) { m_first = first; }

  /// Get first bookmark
00405   int GetFirst() { return m_first; }

  /// Set last bookmark
00408   void SetLast(int last) { m_last = last; }

  /// Get last bookmark
00411   int GetLast() { return m_last; }

private:
00414   wxString m_text;    ///< Text of bookmark
00415   int      m_level;   ///< Associated level
00416   double   m_y;       ///< Y offset
00417   int      m_page;    ///< Page number
00418   int      m_parent;  ///< Parent bookmark
00419   int      m_prev;    ///< Previous bookmark
00420   int      m_next;    ///< Next bookmark
00421   int      m_first;   ///< First bookmark
00422   int      m_last;    ///< Last bookmark
};

/// Class representing spot colors.
00426 class WXDLLIMPEXP_PDFDOC wxPdfSpotColour
{
public:
  /// Constructor for spot color
  wxPdfSpotColour(int index, double cyan, double magenta, double yellow, double black);

  /// Copy constructor
  wxPdfSpotColour(const wxPdfSpotColour& color);

  /// Set object index
00436   void SetObjIndex(int index) { m_objIndex = index; }

  /// Get object index
00439   int  GetObjIndex() const { return m_objIndex; }

  /// Get spot color index
00442   int    GetIndex() const { return m_index; }

  /// Get cyan level
00445   double GetCyan() const { return m_cyan; }

  /// Get magenta level
00448   double GetMagenta() const { return m_magenta; }

  /// Get yellow level
00451   double GetYellow() const { return m_yellow; }

  /// Get black level
00454   double GetBlack() const { return m_black; }

private:
00457   int    m_objIndex;   ///< object index
00458   int    m_index;      ///< color index
00459   double m_cyan;       ///< cyan level
00460   double m_magenta;    ///< magenta level
00461   double m_yellow;     ///< yellow level
00462   double m_black;      ///< black level
};

/// Class representing wxPdfDocument colors.
00466 class WXDLLIMPEXP_PDFDOC wxPdfColour
{
public:
  /// Default constructor
  /**
  * Constructs a color object with an undefined color
  */
  wxPdfColour();

  /// Constructor for grayscale color
  /**
  * Defines a grayscale color
  * \param grayscale indicates the gray level. Value between 0 and 255
  */
  wxPdfColour(const unsigned char grayscale);
  
  /// Constructor for wxColour color
  /**
  * Defines a wxColour color.
  * \param color defines a wxColour color composed of a red, green and blue component
  */
  wxPdfColour(const wxColour& color);

  /// Constructor for RGB color
  /**
  * Defines a RGB color.
  * \param red indicates the red level. Value between 0 and 255
  * \param green indicates the green level. Value between 0 and 255
  * \param blue indicates the blue level. Value between 0 and 255
  */
  wxPdfColour(const unsigned char red, const unsigned char green, const unsigned char blue);
  
  /// Constructor for CMYK color
  /**
  * Defines a CMYK color.
  * \param cyan indicates the cyan level. Value between 0 and 100
  * \param magenta indicates the magenta level. Value between 0 and 100
  * \param yellow indicates the yellow level. Value between 0 and 100
  * \param black indicates the black level. Value between 0 and 100
  */
  wxPdfColour(double cyan, double magenta, double yellow, double black);
  
  /// Constructor for named RGB color
  /**
  * Defines a named RGB color.
  * \param name is the name of the requested color. Use of HTML notation <b><tt>\#rrggbb</tt></b> as color name is also supported.
  */
  wxPdfColour(const wxString& name);
  
  /// Constructor for named RGB color
  /**
  * Defines a spot color.
  * \param spotColor is the spot color to be used
  * \param tint indicates the tint level. Value between 0 and 100. Default: 100.
  */
  wxPdfColour(const wxPdfSpotColour& spotColor, double tint);

  /// Copy constructor
  wxPdfColour(const wxPdfColour& color);

  /// Assignment operator
  wxPdfColour& operator=(const wxPdfColour& color);

  /// Set grayscale color
  /**
  * \param grayscale indicates the gray level. Value between 0 and 255. Default: 0 (Black).
  */
  void SetColor(const unsigned char grayscale = 0);
  
  /// Set wxColour color
  /**
  * \param color defines a wxColour color composed of a red, green and blue component
  */
  void SetColor(const wxColour& color);
  
  /// Set RGB color
  /**
  * \param red indicates the red level. Value between 0 and 255
  * \param green indicates the green level. Value between 0 and 255
  * \param blue indicates the blue level. Value between 0 and 255
  */
  void SetColor(const unsigned char red, const unsigned char green, const unsigned char blue);
  
  /// Set CMYK color
  /**
  * \param cyan indicates the cyan level. Value between 0 and 100
  * \param magenta indicates the magenta level. Value between 0 and 100
  * \param yellow indicates the yellow level. Value between 0 and 100
  * \param black indicates the black level. Value between 0 and 100
  */
  void SetColor(double cyan, double magenta, double yellow, double black);

  /// Set a named RGB color
  /**
  * \param name is the name of the requested color
  */
  void SetColor(const wxString& name);

  /// Set a spot color (internal use only)
  /**
  * \param spotColor is the spot color to be used
  * \param tint indicates the tint level. Value between 0 and 100. Default: 100.
  */
  void SetColor(const wxPdfSpotColour& spotColor, double tint);


  /// Get internal color string representation (for internal use only)
  /**
  * \param drawing flag specifying whether the color is used for drawing operations 
  */
  const wxString GetColor(bool drawing) const;

  /// Get color type
  /**
  */
00581   wxPdfColourType GetColorType() const { return m_type; }

  /// Get internal color value string representation (for internal use only)
  /**
  */
  const wxString GetColorValue() const;

  /// Compare color
  bool Equals(const wxPdfColour& color) const;

protected:
  /// Constructor for internal color string representation
  wxPdfColour(const wxString& color, bool WXUNUSED(internal));

  /// Get a color database
  static wxColourDatabase* GetColorDatabase();

private:
00599   wxPdfColourType m_type;   ///< color type
00600   wxString        m_prefix; ///< internal color string prefix
00601   wxString        m_color;  ///< internal color string

  static wxColourDatabase* ms_colorDatabase;
};

bool operator==(const wxPdfColour& a, const wxPdfColour& b);

bool operator!=(const wxPdfColour& a, const wxPdfColour& b);

/// Class representing double arrays (no standard class in wxWidgets unfortunately)
WX_DEFINE_USER_EXPORTED_ARRAY_DOUBLE(double, wxPdfArrayDouble, class WXDLLIMPEXP_PDFDOC);

/// Class representing line styles.
00614 class WXDLLIMPEXP_PDFDOC wxPdfLineStyle
{
public:
  /// Constructor
  /**
  * Creates a line style for use in graphics primitives.
  * \param[in] width Width of the line in user units.
  * \param[in] cap   Type of cap to put on the line (butt, round, square).
  *                  The difference between 'square' and 'butt' is that 'square'
  *                  projects a flat end past the end of the line.
  * \param[in] join  form of line joining: miter, round or bevel
  * \param[in] dash  pattern for dashed lines.Is an empty array (without dash) or
  *   array with series of length values, which are the lengths of the on and off dashes.
  *           For example: (2) represents 2 on, 2 off, 2 on , 2 off ...
  *                        (2,1) is 2 on, 1 off, 2 on, 1 off.. etc
  * \param[in] phase Modifier of the dash pattern which is used to shift the point at which the pattern starts
  * \param[in] color line color.
  * \see SetLineStyle(), Curve(), Line(), Circle(), Ellipse(), Rect(), RoundedRect(), Polygon(), RegularPolygon(), StarPolygon()
  */
  wxPdfLineStyle(double width = -1,
                 wxPdfLineCap cap = wxPDF_LINECAP_NONE, wxPdfLineJoin join = wxPDF_LINEJOIN_NONE,
                 const wxPdfArrayDouble& dash = wxPdfArrayDouble(), double phase = -1,
                 const wxPdfColour& color = wxPdfColour());

  /// Copy constructor
  wxPdfLineStyle(const wxPdfLineStyle& lineStyle);

  /// Assignment operator
  wxPdfLineStyle& operator= (const wxPdfLineStyle& lineStyle);

  /// Destructor
  virtual ~wxPdfLineStyle();

  /// Check whether the style is initialized.
00648   bool IsSet() const { return m_isSet; }

  /// Set the line width
00651   void SetWidth(double width) { m_width = width; }

  /// Get the line width
00654   double GetWidth() const { return m_width; }

  /// Set the line ending style
00657   void SetLineCap(const wxPdfLineCap cap) { m_cap = cap; }

  /// Get the line ending style
00660   wxPdfLineCap GetLineCap() const { return m_cap; }

  /// Set the line join style
00663   void SetLineJoin(const wxPdfLineJoin join) { m_join = join; }

  /// Get the line join style
00666   wxPdfLineJoin GetLineJoin() const { return m_join; }

  /// Set the dash pattern
00669   void SetDash(const wxPdfArrayDouble& dash) { m_dash = dash; }

  /// Get the dash pattern
00672   const wxPdfArrayDouble& GetDash() const { return m_dash; }

  /// Set the dash pattern phase
00675   void SetPhase(double phase) { m_phase = phase; }

  /// Get the dash pattern phase
00678   double GetPhase() const { return m_phase; }

  /// Set the line color
00681   void SetColour(const wxPdfColour& color) { m_color = color; };

  /// Get the line color
00684   const wxPdfColour& GetColour() const { return m_color; };

private:
  bool             m_isSet;   ///< Flag whether the style is initialized
00688   double           m_width;   ///< Line width
00689   wxPdfLineCap     m_cap;     ///< Line ending style
00690   wxPdfLineJoin    m_join;    ///< Line joining style
00691   wxPdfArrayDouble m_dash;    ///< Dash pattern
00692   double           m_phase;   ///< Dash pattern phase
00693   wxPdfColour      m_color;   ///< Line color
};

/// Class representing a coons patch mesh.

00698 class WXDLLIMPEXP_PDFDOC wxPdfCoonsPatchMesh
{
public:
  /// Constructor
  wxPdfCoonsPatchMesh();

  /// Destructor
  virtual ~wxPdfCoonsPatchMesh();

  /// Add patch to mesh
  /**
  * \param edgeFlag flag indicating the patch position relative to previous patches
  *   \li 0 - new patch, unrelated to previous patches (the first patch added must have this flag)
  *   \li 1 - above previous patch
  *   \li 2 - right to previous patch
  *   \li 3 - below previous patch
  * \param colors array of colors of this patch (size: 4 if edge flag is 1, 2 otherwise)
  * \param x array of x coordinates of patch mesh points (size: 12 if edge flag is 1, 8 otherwise)
  * \param y array of y coordinates of patch mesh points (size: 12 if edge flag is 1, 8 otherwise)
  * \returns true if the added patch is valid
  */
  bool AddPatch(int edgeFlag, wxPdfColour colors[], double x[], double y[]);

  /// Checks whether the coons patch mesh is valid
00722   bool Ok() const { return m_ok; }

  /// Get color type of the coons patch mesh
  /**
  * \returns the color type of the coons patch mesh (gray scale, RGB or CMYK)
  */
00728   wxPdfColourType GetColorType() const { return m_colorType; }

  /// Get the number of patches
  /**
  * \returns the number of patches of the coons patch mesh
  */
00734   size_t GetPatchCount() const { return m_patches.size(); }

  /// Get the array of patches
  /**
  *
  * \returns array of patches
  */
00741   const wxArrayPtrVoid* GetPatches() const { return &m_patches; }

private:
00744   bool            m_ok;        ///< flag whether the coons patch mesh is valid
00745   wxPdfColourType m_colorType; ///< color type of the mesh
00746   wxArrayPtrVoid  m_patches;   ///< array of patches
};

/// Shape segment types
00750 enum wxPdfSegmentType
{
  wxPDF_SEG_UNDEFINED,
  wxPDF_SEG_MOVETO,
  wxPDF_SEG_LINETO,
  wxPDF_SEG_CURVETO,
  wxPDF_SEG_CLOSE
};

/// Class representing a shape consisting of line and curve segments
00760 class WXDLLIMPEXP_PDFDOC wxPdfShape
{
public:
  /// Constructor
  wxPdfShape();

  /// Destructor
  virtual ~wxPdfShape();

  /// Begin a new subpath of the shape
  /**
  * Move to the starting point of a new (sub)path.
  * The new current point is (x, y).
  * \param x abscissa value
  * \param y ordinate value
  * \remark This must be the first operation in constructing the shape.
  */
  void MoveTo(double x, double y);

  /// Add line segment to the shape
  /**
  * Append a straight line segment from the current point to the point (x, y).
  * The new current point is (x, y).
  * \param x abscissa value
  * \param y ordinate value
  */
  void LineTo(double x, double y);

  /// Add a cubic Bezier curve to the shape
  /**
  * Append a cubic Bezier curve to the current path. The curve extends
  * from the current point to the point (x3, y3), using (x1, y1) and (x2, y2)
  * as the Bezier control points. The new current point is (x3, y3).
  * \param x1: Abscissa of control point 1
  * \param y1: Ordinate of control point 1
  * \param x2: Abscissa of control point 2
  * \param y2: Ordinate of control point 2
  * \param x3: Abscissa of end point
  * \param y3: Ordinate of end point
  */
  void CurveTo(double x1, double y1, double x2, double y2, double x3, double y3);

  /// Close (sub)path of the shape
  void ClosePath();

  /// Get the number of segments of the shape
00806   size_t GetSegmentCount() const { return m_types.GetCount(); }

  /// Get a specific segment of the shape (for internal use only)
  /**
  * \param[in] iterType index of segment in segment type array
  * \param[in] iterPoints index of segment in segment coordinate array
  * \param[out] coords array of segment coordinates (size: >= 8)
  * \returns the type of the segment
  */
  wxPdfSegmentType GetSegment(int iterType, int iterPoints, double coords[]) const;

private:
00818   wxArrayInt       m_types;   ///< array of segment types
00819   wxPdfArrayDouble m_x;       ///< array of abscissa values
00820   wxPdfArrayDouble m_y;       ///< array of ordinate values
00821   int              m_subpath; ///< subpath index
00822   int              m_segment; ///< segment index
00823   int              m_index;   ///< points index
};

#endif


Generated by  Doxygen 1.6.0   Back to index