LibreOffice Module vcl (master)  1
GraphicAttributes.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #pragma once
21 
22 #include <vcl/dllapi.h>
23 #include <vcl/bitmap.hxx>
24 
25 enum class GraphicDrawMode
26 {
27  Standard = 0,
28  Greys = 1,
29  Mono = 2,
30  Watermark = 3
31 };
32 
34 {
35 private:
36  double mfGamma;
38  long mnLeftCrop;
39  long mnTopCrop;
42  sal_uInt16 mnRotate10;
44  short mnLumPercent;
45  short mnRPercent;
46  short mnGPercent;
47  short mnBPercent;
48  bool mbInvert;
51 
52 public:
53  GraphicAttr();
54 
55  bool operator==(const GraphicAttr& rAttr) const;
56  bool operator!=(const GraphicAttr& rAttr) const { return !(*this == rAttr); }
57 
58  void SetDrawMode(GraphicDrawMode eDrawMode) { meDrawMode = eDrawMode; }
59  GraphicDrawMode GetDrawMode() const { return meDrawMode; }
60 
61  void SetMirrorFlags(BmpMirrorFlags nMirrFlags) { mnMirrFlags = nMirrFlags; }
62  BmpMirrorFlags GetMirrorFlags() const { return mnMirrFlags; }
63 
64  void SetCrop(long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM,
65  long nBottom_100TH_MM)
66  {
67  mnLeftCrop = nLeft_100TH_MM;
68  mnTopCrop = nTop_100TH_MM;
69  mnRightCrop = nRight_100TH_MM;
70  mnBottomCrop = nBottom_100TH_MM;
71  }
72  long GetLeftCrop() const { return mnLeftCrop; }
73  long GetTopCrop() const { return mnTopCrop; }
74  long GetRightCrop() const { return mnRightCrop; }
75  long GetBottomCrop() const { return mnBottomCrop; }
76 
77  void SetRotation(sal_uInt16 nRotate10) { mnRotate10 = nRotate10; }
78  sal_uInt16 GetRotation() const { return mnRotate10; }
79 
80  void SetLuminance(short nLuminancePercent) { mnLumPercent = nLuminancePercent; }
81  short GetLuminance() const { return mnLumPercent; }
82 
83  void SetContrast(short nContrastPercent) { mnContPercent = nContrastPercent; }
84  short GetContrast() const { return mnContPercent; }
85 
86  void SetChannelR(short nChannelRPercent) { mnRPercent = nChannelRPercent; }
87  short GetChannelR() const { return mnRPercent; }
88 
89  void SetChannelG(short nChannelGPercent) { mnGPercent = nChannelGPercent; }
90  short GetChannelG() const { return mnGPercent; }
91 
92  void SetChannelB(short nChannelBPercent) { mnBPercent = nChannelBPercent; }
93  short GetChannelB() const { return mnBPercent; }
94 
95  void SetGamma(double fGamma) { mfGamma = fGamma; }
96  double GetGamma() const { return mfGamma; }
97 
98  void SetInvert(bool bInvert) { mbInvert = bInvert; }
99  bool IsInvert() const { return mbInvert; }
100 
101  void SetTransparency(sal_uInt8 cTransparency) { mcTransparency = cTransparency; }
102  sal_uInt8 GetTransparency() const { return mcTransparency; }
103 
104  bool IsSpecialDrawMode() const { return (meDrawMode != GraphicDrawMode::Standard); }
105  bool IsMirrored() const { return mnMirrFlags != BmpMirrorFlags::NONE; }
106  bool IsCropped() const
107  {
108  return (mnLeftCrop != 0 || mnTopCrop != 0 || mnRightCrop != 0 || mnBottomCrop != 0);
109  }
110  bool IsRotated() const { return ((mnRotate10 % 3600) != 0); }
111  bool IsTransparent() const { return (mcTransparency > 0); }
112  bool IsAdjusted() const
113  {
114  return (mnLumPercent != 0 || mnContPercent != 0 || mnRPercent != 0 || mnGPercent != 0
115  || mnBPercent != 0 || mfGamma != 1.0 || mbInvert);
116  }
117 };
118 
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetTransparency(sal_uInt8 cTransparency)
void SetGamma(double fGamma)
bool IsInvert() const
BmpMirrorFlags GetMirrorFlags() const
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
void SetInvert(bool bInvert)
long GetRightCrop() const
bool IsMirrored() const
void SetMirrorFlags(BmpMirrorFlags nMirrFlags)
GraphicDrawMode GetDrawMode() const
long GetTopCrop() const
void SetDrawMode(GraphicDrawMode eDrawMode)
double GetGamma() const
bool IsTransparent() const
short GetChannelR() const
sal_uInt16 mnRotate10
short GetLuminance() const
GraphicDrawMode
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition: vclenum.hxx:206
long GetLeftCrop() const
bool IsCropped() const
bool IsSpecialDrawMode() const
void SetContrast(short nContrastPercent)
void SetCrop(long nLeft_100TH_MM, long nTop_100TH_MM, long nRight_100TH_MM, long nBottom_100TH_MM)
bool IsRotated() const
GraphicDrawMode meDrawMode
void SetChannelG(short nChannelGPercent)
BmpMirrorFlags
Definition: bitmap.hxx:36
bool IsAdjusted() const
sal_uInt16 GetRotation() const
void SetChannelR(short nChannelRPercent)
void SetChannelB(short nChannelBPercent)
short GetContrast() const
unsigned char sal_uInt8
sal_uInt8 mcTransparency
BmpMirrorFlags mnMirrFlags
void SetLuminance(short nLuminancePercent)
bool operator!=(const GraphicAttr &rAttr) const
long GetBottomCrop() const
short GetChannelG() const
short GetChannelB() const
void SetRotation(sal_uInt16 nRotate10)
sal_uInt8 GetTransparency() const