Debian Codegraph @

podofo/tools/podofocolor/graphicsstack.cpp

raw
1 /**
2 * SPDX-FileCopyrightText: (C) 2010 Dominik Seichter <[email protected]>
3 * SPDX-License-Identifier: GPL-2.0-or-later
4 */
5
6 #include <podofo/private/PdfDeclarationsPrivate.h>
7 #include "graphicsstack.h"
8
9 using namespace PoDoFo;
10
11 GraphicsStack::GraphicsStack()
12 {
13 // Initialize graphicsstack with default graphicsstack
14 TGraphicsStackElement element;
15 m_stack.push(element);
16 }
17
18 GraphicsStack::~GraphicsStack()
19 {
20 }
21
22 void GraphicsStack::Push()
23 {
24 PODOFO_RAISE_LOGIC_IF(m_stack.empty(), "Can push copy on graphicsstack! Stack is empty!");
25 TGraphicsStackElement copy(m_stack.top());
26 m_stack.push(copy);
27 }
28
29 void GraphicsStack::Pop()
30 {
31 PODOFO_RAISE_LOGIC_IF(m_stack.empty(), "Can pop graphicsstack! Stack is empty!");
32 m_stack.pop();
33 }
34
35 GraphicsStack::TGraphicsStackElement& GraphicsStack::GetCurrentGraphicsState()
36 {
37 PODOFO_RAISE_LOGIC_IF(m_stack.empty(), "Can get current graphicsstate!");
38 return m_stack.top();
39 }