LibreOffice Module vcl (master)
1
include
vcl
gdimtf.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
#ifndef INCLUDED_VCL_GDIMTF_HXX
21
#define INCLUDED_VCL_GDIMTF_HXX
22
23
#include <
vcl/dllapi.h
>
24
#include <
tools/gen.hxx
>
25
#include <
tools/solar.h
>
26
#include <
vcl/mapmod.hxx
>
27
#include <
vcl/bitmap.hxx
>
28
#include <
vcl/vclptr.hxx
>
29
#include <vector>
30
31
class
OutputDevice
;
32
class
MetaAction
;
33
class
SvStream
;
34
class
Color
;
35
class
BitmapEx
;
36
namespace
tools
{
37
class
Polygon
;
38
class
PolyPolygon;
39
}
40
class
Gradient
;
41
struct
ImplMetaReadData
;
42
43
#define GDI_METAFILE_END (size_t(0xFFFFFFFF))
44
45
enum class
MtfConversion
46
{
47
N1BitThreshold
,
48
N8BitGreys
49
};
50
51
52
typedef
Color
(*
ColorExchangeFnc
)(
const
Color
& rColor,
const
void
* pColParam );
53
typedef
BitmapEx
(*
BmpExchangeFnc
)(
const
BitmapEx
& rBmpEx,
const
void
* pBmpParam );
54
55
class
VCL_DLLPUBLIC
GDIMetaFile
final
56
{
57
private
:
58
::std::vector< rtl::Reference<MetaAction> >
m_aList
;
59
size_t
m_nCurrentActionElement
;
60
61
MapMode
m_aPrefMapMode
;
62
Size
m_aPrefSize
;
63
GDIMetaFile
*
m_pPrev
;
64
GDIMetaFile
*
m_pNext
;
65
VclPtr<OutputDevice>
m_pOutDev
;
66
bool
m_bPause
;
67
bool
m_bRecord
;
68
bool
m_bUseCanvas
;
69
70
// tdf#155479 need to know if it's SVG export
71
bool
m_bSVG
;
72
73
74
SAL_DLLPRIVATE
static
Color
ImplColAdjustFnc(
const
Color
& rColor,
const
void
* pColParam );
75
SAL_DLLPRIVATE
static
BitmapEx
ImplBmpAdjustFnc(
const
BitmapEx
& rBmpEx,
const
void
* pBmpParam );
76
77
SAL_DLLPRIVATE
static
Color
ImplColConvertFnc(
const
Color
& rColor,
const
void
* pColParam );
78
SAL_DLLPRIVATE
static
BitmapEx
ImplBmpConvertFnc(
const
BitmapEx
& rBmpEx,
const
void
* pBmpParam );
79
80
SAL_DLLPRIVATE
static
Color
ImplColMonoFnc(
const
Color
& rColor,
const
void
* pColParam );
81
SAL_DLLPRIVATE
static
BitmapEx
ImplBmpMonoFnc(
const
BitmapEx
& rBmpEx,
const
void
* pBmpParam );
82
83
SAL_DLLPRIVATE
static
Color
ImplColReplaceFnc(
const
Color
& rColor,
const
void
* pColParam );
84
SAL_DLLPRIVATE
static
BitmapEx
ImplBmpReplaceFnc(
const
BitmapEx
& rBmpEx,
const
void
* pBmpParam );
85
86
SAL_DLLPRIVATE
void
ImplExchangeColors(
ColorExchangeFnc
pFncCol,
const
void
* pColParam,
87
BmpExchangeFnc
pFncBmp,
const
void
* pBmpParam );
88
89
SAL_DLLPRIVATE
static
Point
ImplGetRotatedPoint(
const
Point
& rPt,
const
Point
& rRotatePt,
90
const
Size
& rOffset,
double
fSin,
double
fCos );
91
SAL_DLLPRIVATE
static
tools::Polygon
ImplGetRotatedPolygon(
const
tools::Polygon
& rPoly,
const
Point
& rRotatePt,
92
const
Size
& rOffset,
double
fSin,
double
fCos );
93
SAL_DLLPRIVATE
static
tools::PolyPolygon
ImplGetRotatedPolyPolygon(
const
tools::PolyPolygon
& rPoly,
const
Point
& rRotatePt,
94
const
Size
& rOffset,
double
fSin,
double
fCos );
95
SAL_DLLPRIVATE
static
void
ImplAddGradientEx(
GDIMetaFile
& rMtf,
96
const
OutputDevice
& rMapDev,
97
const
tools::PolyPolygon
& rPolyPoly,
98
const
Gradient
& rGrad );
99
100
SAL_DLLPRIVATE
bool
ImplPlayWithRenderer(
OutputDevice
& rOut,
const
Point
& rPos,
Size
rLogicDestSize);
101
102
void
Linker(
OutputDevice
* pOut,
bool
bLink );
103
104
public
:
105
GDIMetaFile
();
106
GDIMetaFile
(
const
GDIMetaFile
& rMtf );
107
~GDIMetaFile
();
108
109
GDIMetaFile
& operator=(
const
GDIMetaFile
& rMtf );
110
bool
operator==
(
const
GDIMetaFile
& rMtf )
const
;
111
bool
operator!=
(
const
GDIMetaFile
& rMtf )
const
{
return
!( *
this
== rMtf ); }
112
113
void
Clear
();
114
void
Mirror
(
BmpMirrorFlags
nMirrorFlags );
115
void
Move
(
tools::Long
nX,
tools::Long
nY );
116
// additional Move method getting specifics how to handle MapMode( MapUnit::MapPixel )
117
void
Move
(
tools::Long
nX,
tools::Long
nY,
tools::Long
nDPIX,
tools::Long
nDPIY );
118
void
ScaleActions(
double
fScaleX,
double
fScaleY);
119
void
Scale
(
double
fScaleX,
double
fScaleY );
120
void
Scale
(
const
Fraction
& rScaleX,
const
Fraction
& rScaleY );
121
void
Rotate
(
Degree10
nAngle10 );
122
void
Clip
(
const
tools::Rectangle
& );
123
bool
HasTransparentActions()
const
;
124
125
/* get the bound rect of the contained actions
126
* caveats:
127
* - clip actions will limit the contained actions,
128
* but the current clipregion of the passed OutputDevice will not
129
* - coordinates of actions will be transformed to preferred mapmode
130
* - the returned rectangle is relative to the preferred mapmode of the metafile
131
*/
132
tools::Rectangle
GetBoundRect(
OutputDevice
& i_rReference )
const
;
133
134
void
Adjust(
short
nLuminancePercent,
short
nContrastPercent,
135
short
nChannelRPercent = 0,
short
nChannelGPercent = 0,
136
short
nChannelBPercent = 0,
double
fGamma = 1.0,
137
bool
bInvert =
false
,
bool
msoBrightness =
false
);
138
139
void
Convert(
MtfConversion
eConversion );
140
void
ReplaceColors(
const
Color
* pSearchColors,
const
Color
* rReplaceColors,
141
sal_uLong
nColorCount );
142
143
GDIMetaFile
GetMonochromeMtf(
const
Color
& rCol )
const
;
144
145
void
Record
(
OutputDevice
* pOutDev );
146
bool
IsRecord
()
const
{
return
m_bRecord; }
147
148
void
Play
(
GDIMetaFile
& rMtf);
149
void
Play
(
OutputDevice
& rOutDev,
size_t
nPos =
GDI_METAFILE_END
);
150
void
Play
(
OutputDevice
& rOutDev,
const
Point
& rPos,
const
Size
& rSize);
151
152
void
Pause
(
bool
bPause );
153
bool
IsPause
()
const
{
return
m_bPause; }
154
155
void
Stop
();
156
157
void
WindStart();
158
void
WindPrev();
159
160
size_t
GetActionSize()
const
;
161
162
void
AddAction(
const
rtl::Reference<MetaAction>
& pAction);
163
void
AddAction(
const
rtl::Reference<MetaAction>
& pAction,
size_t
nPos);
164
void
push_back(
const
rtl::Reference<MetaAction>
& pAction);
169
void
ReplaceAction(
rtl::Reference<MetaAction>
pAction,
size_t
nAction );
170
171
MetaAction
* FirstAction();
172
MetaAction
* NextAction();
173
MetaAction
* GetAction(
size_t
nAction )
const
;
174
MetaAction
*
GetCurAction
()
const
{
return
GetAction( m_nCurrentActionElement ); }
175
176
const
Size
&
GetPrefSize
()
const
{
return
m_aPrefSize; }
177
void
SetPrefSize
(
const
Size
& rSize ) { m_aPrefSize = rSize; }
178
179
const
MapMode
&
GetPrefMapMode
()
const
{
return
m_aPrefMapMode; }
180
void
SetPrefMapMode
(
const
MapMode
& rMapMode ) { m_aPrefMapMode = rMapMode; }
181
182
183
sal_uLong
GetSizeBytes()
const
;
184
186
bool
CreateThumbnail(
BitmapEx
& rBitmapEx,
187
BmpConversion
nColorConversion =
BmpConversion::N24Bit
,
188
BmpScaleFlag
nScaleFlag =
BmpScaleFlag::BestQuality
)
const
;
189
190
void
UseCanvas(
bool
_bUseCanvas );
191
bool
GetUseCanvas
()
const
{
return
m_bUseCanvas; }
192
193
// tdf#155479
194
bool
getSVG
()
const
{
return
m_bSVG; }
195
void
setSVG
(
bool
bNew) { m_bSVG = bNew; }
196
198
void
dumpAsXml(
const
char
* pFileName =
nullptr
)
const
;
199
};
200
201
#endif
// INCLUDED_VCL_GDIMTF_HXX
202
203
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
AsCharFlags::Rotate
@ Rotate
BitmapEx
Definition:
bitmapex.hxx:38
Color
Fraction
GDIMetaFile
Definition:
gdimtf.hxx:56
GDIMetaFile::m_bPause
bool m_bPause
Definition:
gdimtf.hxx:66
GDIMetaFile::m_bUseCanvas
bool m_bUseCanvas
Definition:
gdimtf.hxx:68
GDIMetaFile::m_nCurrentActionElement
size_t m_nCurrentActionElement
Definition:
gdimtf.hxx:59
GDIMetaFile::IsPause
bool IsPause() const
Definition:
gdimtf.hxx:153
GDIMetaFile::GetPrefSize
const Size & GetPrefSize() const
Definition:
gdimtf.hxx:176
GDIMetaFile::IsRecord
bool IsRecord() const
Definition:
gdimtf.hxx:146
GDIMetaFile::GetCurAction
MetaAction * GetCurAction() const
Definition:
gdimtf.hxx:174
GDIMetaFile::m_pNext
GDIMetaFile * m_pNext
Definition:
gdimtf.hxx:64
GDIMetaFile::m_pPrev
GDIMetaFile * m_pPrev
Definition:
gdimtf.hxx:63
GDIMetaFile::m_aList
::std::vector< rtl::Reference< MetaAction > > m_aList
Definition:
gdimtf.hxx:58
GDIMetaFile::setSVG
void setSVG(bool bNew)
Definition:
gdimtf.hxx:195
GDIMetaFile::m_pOutDev
VclPtr< OutputDevice > m_pOutDev
Definition:
gdimtf.hxx:65
GDIMetaFile::operator!=
bool operator!=(const GDIMetaFile &rMtf) const
Definition:
gdimtf.hxx:111
GDIMetaFile::m_bSVG
bool m_bSVG
Definition:
gdimtf.hxx:71
GDIMetaFile::getSVG
bool getSVG() const
Definition:
gdimtf.hxx:194
GDIMetaFile::SetPrefMapMode
void SetPrefMapMode(const MapMode &rMapMode)
Definition:
gdimtf.hxx:180
GDIMetaFile::GetUseCanvas
bool GetUseCanvas() const
Definition:
gdimtf.hxx:191
GDIMetaFile::m_aPrefMapMode
MapMode m_aPrefMapMode
Definition:
gdimtf.hxx:61
GDIMetaFile::m_aPrefSize
Size m_aPrefSize
Definition:
gdimtf.hxx:62
GDIMetaFile::m_bRecord
bool m_bRecord
Definition:
gdimtf.hxx:67
GDIMetaFile::GetPrefMapMode
const MapMode & GetPrefMapMode() const
Definition:
gdimtf.hxx:179
GDIMetaFile::SetPrefSize
void SetPrefSize(const Size &rSize)
Definition:
gdimtf.hxx:177
Gradient
Definition:
gradient.hxx:40
MapMode
Definition:
mapmod.hxx:34
MetaAction
Definition:
metaact.hxx:75
OutputDevice
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition:
outdev.hxx:170
Point
Size
SvStream
VclPtr< OutputDevice >
rtl::Reference
tools::PolyPolygon
tools::Polygon
tools::Rectangle
MediaCommand::Record
@ Record
dllapi.h
VCL_DLLPUBLIC
#define VCL_DLLPUBLIC
Definition:
dllapi.h:29
Stop
aCursorMoveIdle Stop()
ColorExchangeFnc
Color(* ColorExchangeFnc)(const Color &rColor, const void *pColParam)
Definition:
gdimtf.hxx:52
BmpExchangeFnc
BitmapEx(* BmpExchangeFnc)(const BitmapEx &rBmpEx, const void *pBmpParam)
Definition:
gdimtf.hxx:53
GDI_METAFILE_END
#define GDI_METAFILE_END
Definition:
gdimtf.hxx:43
MtfConversion
MtfConversion
Definition:
gdimtf.hxx:46
gen.hxx
bitmap.hxx
BmpScaleFlag
BmpScaleFlag
Definition:
include/vcl/bitmap.hxx:54
BmpScaleFlag::BestQuality
@ BestQuality
BmpConversion
BmpConversion
Definition:
include/vcl/bitmap.hxx:70
BmpConversion::N1BitThreshold
@ N1BitThreshold
BmpConversion::N24Bit
@ N24Bit
BmpConversion::N8BitGreys
@ N8BitGreys
BmpMirrorFlags
BmpMirrorFlags
Definition:
include/vcl/bitmap.hxx:42
mapmod.hxx
Clear
void Clear(EHistoryType eHistory)
MediaState::Pause
@ Pause
MediaState::Play
@ Play
Clip
Clip
tools
tools::Long
long Long
UseOnPage::Mirror
@ Mirror
solar.h
sal_uLong
sal_uIntPtr sal_uLong
ImplMetaReadData
Definition:
metaact.hxx:55
o3tl::strong_int
SdrHdlKind::Move
@ Move
SdrObjKind::Polygon
@ Polygon
operator==
bool operator==(const ItalicMatrix &a, const ItalicMatrix &b)
Definition:
vclenum.hxx:175
vclptr.hxx
WallpaperStyle::Scale
@ Scale
Generated on Sun Jul 30 2023 04:34:48 for LibreOffice Module vcl (master) by
1.9.3