Bump version to 21.06.18.1
[LibreOffice.git] / include / vcl / GraphicAttributes.hxx
blob5216d29341663e63edf81bb9d7f8e26f67a081b1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #pragma once
22 #include <tools/degree.hxx>
23 #include <vcl/dllapi.h>
24 #include <vcl/bitmap.hxx>
26 enum class GraphicDrawMode
28 Standard = 0,
29 Greys = 1,
30 Mono = 2,
31 Watermark = 3
34 class VCL_DLLPUBLIC GraphicAttr
36 private:
37 double mfGamma;
38 BmpMirrorFlags mnMirrFlags;
39 tools::Long mnLeftCrop;
40 tools::Long mnTopCrop;
41 tools::Long mnRightCrop;
42 tools::Long mnBottomCrop;
43 Degree10 mnRotate10;
44 short mnContPercent;
45 short mnLumPercent;
46 short mnRPercent;
47 short mnGPercent;
48 short mnBPercent;
49 bool mbInvert;
50 sal_uInt8 mcTransparency;
51 GraphicDrawMode meDrawMode;
53 public:
54 GraphicAttr();
56 bool operator==(const GraphicAttr& rAttr) const;
57 bool operator!=(const GraphicAttr& rAttr) const { return !(*this == rAttr); }
59 void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; }
60 GraphicDrawMode GetDrawMode() const { return meDrawMode; }
62 void SetMirrorFlags(BmpMirrorFlags nMirrFlags) { mnMirrFlags = nMirrFlags; }
63 BmpMirrorFlags GetMirrorFlags() const { return mnMirrFlags; }
65 void SetCrop(tools::Long nLeft_100TH_MM, tools::Long nTop_100TH_MM, tools::Long nRight_100TH_MM,
66 tools::Long nBottom_100TH_MM)
68 mnLeftCrop = nLeft_100TH_MM;
69 mnTopCrop = nTop_100TH_MM;
70 mnRightCrop = nRight_100TH_MM;
71 mnBottomCrop = nBottom_100TH_MM;
73 tools::Long GetLeftCrop() const { return mnLeftCrop; }
74 tools::Long GetTopCrop() const { return mnTopCrop; }
75 tools::Long GetRightCrop() const { return mnRightCrop; }
76 tools::Long GetBottomCrop() const { return mnBottomCrop; }
78 void SetRotation(Degree10 nRotate10) { mnRotate10 = nRotate10; }
79 Degree10 GetRotation() const { return mnRotate10; }
81 void SetLuminance(short nLuminancePercent) { mnLumPercent = nLuminancePercent; }
82 short GetLuminance() const { return mnLumPercent; }
84 void SetContrast(short nContrastPercent) { mnContPercent = nContrastPercent; }
85 short GetContrast() const { return mnContPercent; }
87 void SetChannelR(short nChannelRPercent) { mnRPercent = nChannelRPercent; }
88 short GetChannelR() const { return mnRPercent; }
90 void SetChannelG(short nChannelGPercent) { mnGPercent = nChannelGPercent; }
91 short GetChannelG() const { return mnGPercent; }
93 void SetChannelB(short nChannelBPercent) { mnBPercent = nChannelBPercent; }
94 short GetChannelB() const { return mnBPercent; }
96 void SetGamma(double fGamma) { mfGamma = fGamma; }
97 double GetGamma() const { return mfGamma; }
99 void SetInvert(bool bInvert) { mbInvert = bInvert; }
100 bool IsInvert() const { return mbInvert; }
102 void SetTransparency(sal_uInt8 cTransparency) { mcTransparency = cTransparency; }
103 sal_uInt8 GetTransparency() const { return mcTransparency; }
105 bool IsSpecialDrawMode() const { return (meDrawMode != GraphicDrawMode::Standard); }
106 bool IsMirrored() const { return mnMirrFlags != BmpMirrorFlags::NONE; }
107 bool IsCropped() const
109 return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0);
111 bool IsRotated() const { return ((mnRotate10 % Degree10(3600)) != Degree10(0)); }
112 bool IsTransparent() const { return (mcTransparency > 0); }
113 bool IsAdjusted() const
115 return (mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 || mnGPercent != 0
116 || mnBPercent != 0 || mfGamma != 1.0 || mbInvert);
120 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */