1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_GFX_PRINTTARGETCG_H
7 #define MOZILLA_GFX_PRINTTARGETCG_H
9 #include <Carbon/Carbon.h>
10 #include "PrintTarget.h"
12 class nsIOutputStream
;
14 namespace mozilla::gfx
{
17 * CoreGraphics printing target.
19 class PrintTargetCG final
: public PrintTarget
{
21 static already_AddRefed
<PrintTargetCG
> CreateOrNull(
22 nsIOutputStream
* aOutputStream
, PMPrintSession aPrintSession
,
23 PMPageFormat aPageFormat
, PMPrintSettings aPrintSettings
,
24 const IntSize
& aSize
);
26 nsresult
BeginPrinting(const nsAString
& aTitle
,
27 const nsAString
& aPrintToFileName
, int32_t aStartPage
,
28 int32_t aEndPage
) final
;
29 nsresult
EndPrinting() final
;
30 nsresult
AbortPrinting() final
;
31 nsresult
BeginPage(const IntSize
& aSizeInPoints
) final
;
32 nsresult
EndPage() final
;
34 already_AddRefed
<DrawTarget
> GetReferenceDrawTarget() final
;
37 PrintTargetCG(CGContextRef aPrintToStreamContext
,
38 PMPrintSession aPrintSession
, PMPageFormat aPageFormat
,
39 PMPrintSettings aPrintSettings
, const IntSize
& aSize
);
42 CGContextRef mPrintToStreamContext
= nullptr;
43 PMPrintSession mPrintSession
;
44 PMPageFormat mPageFormat
;
45 PMPrintSettings mPrintSettings
;
48 } // namespace mozilla::gfx
50 #endif /* MOZILLA_GFX_PRINTTARGETCG_H */