~yves-piguet/npw/trunk

« back to all changes in this revision

Viewing changes to Src/NPWGraphics.h

  • Committer: Yves Piguet
  • Date: 2014-07-13 17:07:54 UTC
  • Revision ID: launchpad@nyctergatis.com-20140713170754-jwa5xo4klqh03va5
New macros NPWGraphicsTranslate and NPWGraphicsScale

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *      @file NPWGraphics.h
3
3
 *      @brief Helper functions for graphics
4
4
 *      @author Yves Piguet.
5
 
 *      @copyright 2008-2013, Yves Piguet
 
5
 *      @copyright 2008-2014, Yves Piguet
6
6
 */
7
7
 
8
8
#ifndef __NPWGraphics__
142
142
#define NPWGraphicsConcatCTM(pdf, a, b, c, d, e, f) \
143
143
        NPWGraphicsCmd(pdf, "cm", "ffffff", \
144
144
                (NPWFloat)(a), (NPWFloat)(b), (NPWFloat)(c), (NPWFloat)(d), (NPWFloat)(e), (NPWFloat)(f))
 
145
/// Concatenate a translation matrix to the current coordinate transform matrix
 
146
#define NPWGraphicsTranslate(pdf, dx, dy) \
 
147
        NPWGraphicsConcatCTM(pdf, 1, 0, 0, 1, dx, dy)
 
148
/// Concatenate a scaling matrix to the current coordinate transform matrix
 
149
#define NPWGraphicsScale(pdf, sx, sy) \
 
150
        NPWGraphicsConcatCTM(pdf, sx, 0, 0, sy, 0, 0)
145
151
/// Set line width for stroking
146
152
#define NPWGraphicsSetLineWidth(pdf, w) \
147
153
        NPWGraphicsCmd(pdf, "w", "f", (NPWFloat)(w))