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

pdfgraphics.h

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

/// \file pdfgraphics.h Interface of PDF graphics classes

#ifndef _PDFGRAPHICS_H_
#define _PDFGRAPHICS_H_

#include "wx/pdfdocdef.h"

/// Class representing ExtGState. (For internal use only)
00019 class WXDLLIMPEXP_PDFDOC wxPdfExtGState
{
public:
  /// Constructor
  wxPdfExtGState(double lineAlpha, double fillAlpha, wxPdfBlendMode blendMode);

  /// Destructor
  virtual ~wxPdfExtGState();

  /// Set ExtGState object index
00029   void SetObjIndex(int n) { m_n = n; }

  /// Get ExtGState object index
00032   int  GetObjIndex() { return m_n; }

  double GetLineAlpha() const { return m_lineAlpha; }
  double GetFillAlpha() const { return m_fillAlpha; }
00036   wxPdfBlendMode GetBlendMode() const { return m_blendMode; };

private:
  int            m_n;         ///< ExtGState index
  double         m_lineAlpha;
  double         m_fillAlpha;
  wxPdfBlendMode m_blendMode;
};

/// Class representing a coons patch. (For internal use only)
00046 class WXDLLIMPEXP_PDFDOC wxPdfCoonsPatch
{
public:
  wxPdfCoonsPatch(int edgeFlag, wxPdfColour colors[], double x[], double y[]);
  virtual ~wxPdfCoonsPatch();

  int GetEdgeFlag() { return m_edgeFlag; }
  wxPdfColour* GetColors() { return m_colors; }
  double* GetX() { return m_x; }
  double* GetY() { return m_y; }
private:
  int m_edgeFlag;
  wxPdfColour m_colors[4];
  double m_x[12];
  double m_y[12];
};

enum wxPdfGradientType
{
  wxPDF_GRADIENT_AXIAL,
  wxPDF_GRADIENT_MIDAXIAL,
  wxPDF_GRADIENT_RADIAL,
  wxPDF_GRADIENT_COONS
};

/// Class representing gradients. (For internal use only)
00072 class WXDLLIMPEXP_PDFDOC wxPdfGradient
{
public:
  /// Constructor
  wxPdfGradient(wxPdfGradientType type);

  /// Destructor
  virtual ~wxPdfGradient();

  /// Set gradient object index
00082   void SetObjIndex(int n) { m_n = n; }

  /// Get gradient object index
00085   int  GetObjIndex() { return m_n; }

  /// Get the gradient type
00088   const wxPdfGradientType GetType() const { return m_type; };

protected:
  wxPdfGradientType m_type;      ///< Gradient type

private:
00094   int               m_n;         ///< Gradient index
};

/// Class representing axial gradients. (For internal use only)
00098 class WXDLLIMPEXP_PDFDOC wxPdfAxialGradient : public wxPdfGradient
{
public:
  /// Constructor
  wxPdfAxialGradient(const wxPdfColour& color1, const wxPdfColour& color2, double x1, double y1, double x2, double y2, double intexp);

  /// Destructor
  virtual ~wxPdfAxialGradient();

  /// Get the gradient color 1
00108   const wxPdfColour& GetColor1() const { return m_color1; };

  /// Get the gradient color 2
00111   const wxPdfColour& GetColor2() const { return m_color2; };

  double GetX1() const { return m_x1; }
  double GetY1() const { return m_y1; }
  double GetX2() const { return m_x2; }
  double GetY2() const { return m_y2; }
  double GetIntExp() const { return m_intexp; }

private:
00120   wxPdfColour m_color1;    ///< Gradient color 1
00121   wxPdfColour m_color2;    ///< Gradient color 2
  double      m_x1;
  double      m_y1;
  double      m_x2;
  double      m_y2;
  double      m_intexp;
};

/// Class representing mid axial gradients. (For internal use only)
00130 class WXDLLIMPEXP_PDFDOC wxPdfMidAxialGradient : public wxPdfAxialGradient
{
public:
  /// Constructor
  wxPdfMidAxialGradient(const wxPdfColour& color1, const wxPdfColour& color2, double x1, double y1, double x2, double y2, double midpoint, double intexp);

  /// Destructor
  virtual ~wxPdfMidAxialGradient();

  double GetMidPoint() const { return m_midpoint; }

private:
  double      m_midpoint;
};

/// Class representing radial gradients. (For internal use only)
00146 class WXDLLIMPEXP_PDFDOC wxPdfRadialGradient : public wxPdfAxialGradient
{
public:
  /// Constructor
  wxPdfRadialGradient(const wxPdfColour& color1, const wxPdfColour& color2, double x1, double y1, double r1, double x2, double y2, double r2, double intexp);

  /// Destructor
  virtual ~wxPdfRadialGradient();

  double GetR1() const { return m_r1; }
  double GetR2() const { return m_r2; }

private:
  double      m_r1;
  double      m_r2;
};

/// Class representing coons patch mesh gradients. (For internal use only)
00164 class WXDLLIMPEXP_PDFDOC wxPdfCoonsPatchGradient : public wxPdfGradient
{
public:
  /// Constructor
  wxPdfCoonsPatchGradient(const wxPdfCoonsPatchMesh& mesh, double minCoord, double maxCoord);

  /// Destructor
  virtual ~wxPdfCoonsPatchGradient();

  wxPdfColourType GetColorType() { return m_colorType; }
  wxMemoryOutputStream* GetBuffer() { return &m_buffer; } 

private:
  wxPdfColourType      m_colorType;
00178   wxMemoryOutputStream m_buffer;    ///< buffer holding in-memory gradient data
};

/// Class representing a flattened path
00182 class WXDLLIMPEXP_PDFDOC wxPdfFlatPath
{
public:
  /// Constructor
  wxPdfFlatPath(const wxPdfShape* shape, double flatness = 1, int limit = 10);

  /// Destructor
  virtual ~wxPdfFlatPath();

  /// Initialize path iterator
  void InitIter();

  /// Fetch current path segment
  void FetchSegment();

  /// Advance path iterator
  void Next();

  /// Get current path segment
  /**
  * \param[out] coords coordinates of current segment
  * \returns current segment type
  */
  int CurrentSegment(double coords[]);

  /// Subdivide cubic bezier curve path
  void SubdivideCubic();

  /// Check whether path iterator is done
00211   bool IsDone() { return m_done; }

  /// Measure flattened path length
  double MeasurePathLength();

private:
00217   const wxPdfShape* m_shape;    ///< associated shape
00218   double      m_flatnessSq;     ///< square of flatness
00219   int         m_recursionLimit; ///< resursion limit
00220   int         m_stackMaxSize;   ///< maximal stack size
00221   int         m_stackSize;      ///< current stack size
00222   double*     m_stack;          ///< recursion stack
00223   int*        m_recLevel;       ///< level stack
00224   double      m_scratch[6];     ///< coordinate array for current segment
00225   int         m_iterType;       ///< iterator for segment type
00226   int         m_iterPoints;     ///< iterator for segment points
00227   int         m_srcSegType;     ///< current segment type
00228   double      m_srcPosX;        ///< current segment abscissa
00229   double      m_srcPosY;        ///< current segment ordinate
00230   bool        m_done;           ///< flag whether iterator is done
};

#endif

Generated by  Doxygen 1.6.0   Back to index