gfx/thebes/gfxPSSurface.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/thebes/gfxPSSurface.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef GFX_PSSURFACE_H
    1.10 +#define GFX_PSSURFACE_H
    1.11 +
    1.12 +#include "gfxASurface.h"
    1.13 +
    1.14 +/* for the output stream */
    1.15 +#include "nsCOMPtr.h"
    1.16 +#include "nsIOutputStream.h"
    1.17 +#include "gfxContext.h"
    1.18 +
    1.19 +class gfxPSSurface : public gfxASurface {
    1.20 +public:
    1.21 +    enum PageOrientation {
    1.22 +        PORTRAIT,
    1.23 +        LANDSCAPE
    1.24 +    };
    1.25 +
    1.26 +    gfxPSSurface(nsIOutputStream *aStream, const gfxSize& aSizeInPoints, PageOrientation aOrientation);
    1.27 +    virtual ~gfxPSSurface();
    1.28 +
    1.29 +    virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
    1.30 +    virtual nsresult EndPrinting();
    1.31 +    virtual nsresult AbortPrinting();
    1.32 +    virtual nsresult BeginPage();
    1.33 +    virtual nsresult EndPage();
    1.34 +    virtual void Finish();
    1.35 +
    1.36 +    void SetDPI(double x, double y);
    1.37 +    void GetDPI(double *xDPI, double *yDPI);
    1.38 +
    1.39 +    virtual bool GetRotateForLandscape() { return (mOrientation == LANDSCAPE); }
    1.40 +
    1.41 +    // this is in points!
    1.42 +    virtual const gfxIntSize GetSize() const
    1.43 +    {
    1.44 +        return mSize;
    1.45 +    }
    1.46 +
    1.47 +    virtual int32_t GetDefaultContextFlags() const
    1.48 +    {
    1.49 +        return gfxContext::FLAG_SIMPLIFY_OPERATORS |
    1.50 +               gfxContext::FLAG_DISABLE_SNAPPING;
    1.51 +    }
    1.52 +
    1.53 +private:
    1.54 +    nsCOMPtr<nsIOutputStream> mStream;
    1.55 +    double mXDPI;
    1.56 +    double mYDPI;
    1.57 +    gfxIntSize mSize;
    1.58 +    PageOrientation mOrientation;
    1.59 +};
    1.60 +
    1.61 +#endif /* GFX_PSSURFACE_H */

mercurial