-
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
qgstextrenderer.h
1919 lines (1640 loc) · 58.3 KB
/
qgstextrenderer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
qgstextrenderer.h
-----------------
begin : September 2015
copyright : (C) Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSTEXTRENDERER_H
#define QGSTEXTRENDERER_H
#include "qgis_sip.h"
#include "qgis_core.h"
#include "qgsmapunitscale.h"
#include "qgsunittypes.h"
#include "qgssymbollayerreference.h"
#include <QSharedData>
#include <QPainter>
#include <QPicture>
#include <QDomElement>
class QgsReadWriteContext;
class QgsTextBufferSettingsPrivate;
class QgsTextBackgroundSettingsPrivate;
class QgsTextShadowSettingsPrivate;
class QgsTextMaskSettingsPrivate;
class QgsTextSettingsPrivate;
class QgsVectorLayer;
class QgsPaintEffect;
class QgsMarkerSymbol;
class QgsPropertyCollection;
/**
* \class QgsTextBufferSettings
* \ingroup core
* Container for settings relating to a text buffer.
* \note QgsTextBufferSettings objects are implicitly shared.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsTextBufferSettings
{
public:
QgsTextBufferSettings();
/**
* Copy constructor.
* \param other source settings
*/
QgsTextBufferSettings( const QgsTextBufferSettings &other );
/**
* Copy constructor.
* \param other source QgsTextBufferSettings
*/
QgsTextBufferSettings &operator=( const QgsTextBufferSettings &other );
~QgsTextBufferSettings();
/**
* Returns whether the buffer is enabled.
* \see setEnabled()
*/
bool enabled() const;
/**
* Sets whether the text buffer will be drawn.
* \param enabled set to TRUE to draw buffer
* \see enabled()
*/
void setEnabled( bool enabled );
/**
* Returns the size of the buffer.
* \see sizeUnit()
* \see setSize()
*/
double size() const;
/**
* Sets the size of the buffer. The size units are specified using setSizeUnit().
* \param size buffer size
* \see size()
* \see setSizeUnit()
*/
void setSize( double size );
/**
* Returns the units for the buffer size.
* \see size()
* \see setSizeUnit()
*/
QgsUnitTypes::RenderUnit sizeUnit() const;
/**
* Sets the units used for the buffer size.
* \param unit size unit
* \see setSize()
* \see sizeUnit()
*/
void setSizeUnit( QgsUnitTypes::RenderUnit unit );
/**
* Returns the map unit scale object for the buffer size. This is only used if the
* buffer size is set to QgsUnitTypes::RenderMapUnit.
* \see setSizeMapUnitScale()
* \see sizeUnit()
*/
QgsMapUnitScale sizeMapUnitScale() const;
/**
* Sets the map unit scale object for the buffer size. This is only used if the
* buffer size is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for buffer size
* \see sizeMapUnitScale()
* \see setSizeUnit()
*/
void setSizeMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns the color of the buffer.
* \see setColor()
*/
QColor color() const;
/**
* Sets the color for the buffer.
* \param color buffer color
* \see color()
*/
void setColor( const QColor &color );
/**
* Returns whether the interior of the buffer will be filled in. If FALSE, only the stroke
* of the text will be drawn as the buffer. The effect of this setting is only visible for
* semi-transparent text.
* \see setFillBufferInterior()
*/
bool fillBufferInterior() const;
/**
* Sets whether the interior of the buffer will be filled in.
* \param fill set to FALSE to drawn only the stroke of the text as the buffer, or TRUE to also
* shade the area inside the text. The effect of this setting is only visible for semi-transparent text.
* \see fillBufferInterior()
*/
void setFillBufferInterior( bool fill );
/**
* Returns the buffer opacity. The opacity is a double value between 0 (fully transparent) and 1 (totally
* opaque).
* \see setOpacity()
*/
double opacity() const;
/**
* Sets the buffer opacity.
* \param opacity opacity as a double value between 0 (fully transparent) and 1 (totally
* opaque)
* \see opacity()
*/
void setOpacity( double opacity );
/**
* Returns the buffer join style.
* \see setJoinStyle
*/
Qt::PenJoinStyle joinStyle() const;
/**
* Sets the join style used for drawing the buffer.
* \param style join style
* \see joinStyle()
*/
void setJoinStyle( Qt::PenJoinStyle style );
/**
* Returns the blending mode used for drawing the buffer.
* \see setBlendMode()
*/
QPainter::CompositionMode blendMode() const;
/**
* Sets the blending mode used for drawing the buffer.
* \param mode blending mode
* \see blendMode()
*/
void setBlendMode( QPainter::CompositionMode mode );
/**
* Reads settings from a layer's custom properties (for QGIS 2.x projects).
* \param layer source vector layer
*/
void readFromLayer( QgsVectorLayer *layer );
/**
* Read settings from a DOM element.
* \see writeXml()
*/
void readXml( const QDomElement &elem );
/**
* Write settings into a DOM element.
* \see readXml()
*/
QDomElement writeXml( QDomDocument &doc ) const;
/**
* Returns the current paint effect for the buffer.
* \returns paint effect
* \see setPaintEffect()
*/
QgsPaintEffect *paintEffect() const;
/**
* Sets the current paint \a effect for the buffer.
* \param effect paint effect. Ownership is transferred to the buffer settings.
* \see paintEffect()
*/
void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
/**
* Updates the format by evaluating current values of data defined properties.
* \since QGIS 3.10
*/
void updateDataDefinedProperties( QgsRenderContext &context, const QgsPropertyCollection &properties );
private:
QSharedDataPointer<QgsTextBufferSettingsPrivate> d;
};
/**
* \class QgsTextBackgroundSettings
* \ingroup core
* Container for settings relating to a text background object.
* \note QgsTextBackgroundSettings objects are implicitly shared.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsTextBackgroundSettings
{
public:
/**
* Background shape types.
*/
enum ShapeType
{
ShapeRectangle = 0, //!< Rectangle
ShapeSquare, //!< Square - buffered sizes only
ShapeEllipse, //!< Ellipse
ShapeCircle, //!< Circle
ShapeSVG, //!< SVG file
ShapeMarkerSymbol, //!< Marker symbol
};
/**
* Methods for determining the background shape size.
*/
enum SizeType
{
SizeBuffer = 0, //!< Shape size is determined by adding a buffer margin around text
SizeFixed, //!< Fixed size
SizePercent //!< Shape size is determined by percent of text size
};
/**
* Methods for determining the rotation of the background shape.
*/
enum RotationType
{
RotationSync = 0, //!< Shape rotation is synced with text rotation
RotationOffset, //!< Shape rotation is offset from text rotation
RotationFixed //!< Shape rotation is a fixed angle
};
QgsTextBackgroundSettings();
/**
* Copy constructor.
* \param other source QgsTextBackgroundSettings
*/
QgsTextBackgroundSettings( const QgsTextBackgroundSettings &other );
QgsTextBackgroundSettings &operator=( const QgsTextBackgroundSettings &other );
~QgsTextBackgroundSettings();
/**
* Returns whether the background is enabled.
* \see setEnabled()
*/
bool enabled() const;
/**
* Sets whether the text background will be drawn.
* \param enabled set to TRUE to draw background
* \see enabled()
*/
void setEnabled( bool enabled );
/**
* Returns the type of background shape (e.g., square, ellipse, SVG).
* \see setType()
*/
ShapeType type() const;
/**
* Sets the type of background shape to draw (e.g., square, ellipse, SVG).
* \param type shape type
* \see type()
*/
void setType( ShapeType type );
/**
* Returns the absolute path to the background SVG file, if set.
* \see setSvgFile()
*/
QString svgFile() const;
/**
* Sets the path to the background SVG file. This is only used if type() is set to
* QgsTextBackgroundSettings::ShapeSVG. The path must be absolute.
* \param file Absolute SVG file path
* \see svgFile()
*/
void setSvgFile( const QString &file );
/**
* Returns the marker symbol to be rendered in the background. Ownership remains with
* the background settings.
* \note This is only used when the type() is QgsTextBackgroundSettings::ShapeMarkerSymbol.
* \see setMarkerSymbol()
* \since QGIS 3.10
*/
QgsMarkerSymbol *markerSymbol() const;
/**
* Sets the current marker \a symbol for the background shape. Ownership is transferred
* to the background settings.
* \note This is only used when the type() is QgsTextBackgroundSettings::ShapeMarkerSymbol.
* \see markerSymbol()
* \since QGIS 3.10
*/
void setMarkerSymbol( QgsMarkerSymbol *symbol SIP_TRANSFER );
/**
* Returns the method used to determine the size of the background shape (e.g., fixed size or buffer
* around text).
* \see setSizeType()
* \see size()
*/
SizeType sizeType() const;
/**
* Sets the method used to determine the size of the background shape (e.g., fixed size or buffer
* around text).
* \param type size method
* \see sizeType()
* \see setSize()
*/
void setSizeType( SizeType type );
/**
* Returns the size of the background shape. The meaning of the size depends on the current sizeType(),
* e.g., for size types of QgsTextBackgroundSettings::SizeFixed the size will represent the actual width and
* height of the shape, for QgsTextBackgroundSettings::SizeBuffer the size will represent the horizontal
* and vertical margins to add to the text when calculating the size of the shape.
* \see setSize()
* \see sizeType()
*/
QSizeF size() const;
/**
* Sets the size of the background shape. The meaning of the size depends on the current sizeType(),
* e.g., for size types of QgsTextBackgroundSettings::SizeFixed the size will represent the actual width and
* height of the shape, for QgsTextBackgroundSettings::SizeBuffer the size will represent the horizontal
* and vertical margins to add to the text when calculating the size of the shape.
* \param size QSizeF representing horizontal and vertical size components for shape
* \see size()
* \see setSizeType()
*/
void setSize( QSizeF size );
/**
* Returns the units used for the shape's size. This value has no meaning if the sizeType() is set to
* QgsTextBackgroundSettings::SizePercent.
* \see setSizeUnit()
* \see sizeType()
* \see size()
*/
QgsUnitTypes::RenderUnit sizeUnit() const;
/**
* Sets the units used for the shape's size. This value has no meaning if the sizeType() is set to
* QgsTextBackgroundSettings::SizePercent.
* \param unit size units
* \see sizeUnit()
* \see setSizeType()
* \see setSize()
*/
void setSizeUnit( QgsUnitTypes::RenderUnit unit );
/**
* Returns the map unit scale object for the shape size. This is only used if the
* sizeUnit() is set to QgsUnitTypes::RenderMapUnit.
* \see setSizeMapUnitScale()
* \see sizeUnit()
*/
QgsMapUnitScale sizeMapUnitScale() const;
/**
* Sets the map unit scale object for the shape size. This is only used if the
* sizeUnit() is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for shape size
* \see sizeMapUnitScale()
* \see setSizeUnit()
*/
void setSizeMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns the method used for rotating the background shape.
* \see setRotationType()
* \see rotation()
*/
RotationType rotationType() const;
/**
* Sets the method used for rotating the background shape.
* \param type rotation method
* \see rotationType()
* \see setRotation()
*/
void setRotationType( RotationType type );
/**
* Returns the rotation for the background shape, in degrees clockwise.
* \see rotationType()
* \see setRotation()
*/
double rotation() const;
/**
* Sets the \a rotation for the background shape, in degrees clockwise.
* \see rotation()
* \see setRotationType()
*/
void setRotation( double rotation );
/**
* Returns the offset used for drawing the background shape. Units are determined
* via offsetUnit().
* \see setOffset()
* \see offsetUnit()
*/
QPointF offset() const;
/**
* Sets the offset used for drawing the background shape. Units are specified using
* setOffsetUnit().
* \param offset offset for shape
* \see offset()
* \see setOffsetUnit()
*/
void setOffset( QPointF offset );
/**
* Returns the units used for the shape's offset.
* \see setOffsetUnit()
* \see offset()
*/
QgsUnitTypes::RenderUnit offsetUnit() const;
/**
* Sets the units used for the shape's offset.
* \param units offset units
* \see offsetUnit()
* \see setOffset()
*/
void setOffsetUnit( QgsUnitTypes::RenderUnit units );
/**
* Returns the map unit scale object for the shape offset. This is only used if the
* offsetUnit() is set to QgsUnitTypes::RenderMapUnit.
* \see setOffsetMapUnitScale()
* \see offsetUnit()
*/
QgsMapUnitScale offsetMapUnitScale() const;
/**
* Sets the map unit scale object for the shape offset. This is only used if the
* offsetUnit() is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for shape offset
* \see offsetMapUnitScale()
* \see setOffsetUnit()
*/
void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns the radii used for rounding the corners of shapes. Units are retrieved
* through radiiUnit().
* \see setRadii()
* \see radiiUnit()
*/
QSizeF radii() const;
/**
* Sets the radii used for rounding the corners of shapes. This is only used if
* type() is set to QgsTextBackgroundSettings::ShapeRectangle or QgsTextBackgroundSettings::ShapeSquare.
* \param radii QSizeF representing horizontal and vertical radii for rounded corners. Units are
* specified through setRadiiUnit()
* \see radii()
* \see setRadiiUnit()
*/
void setRadii( QSizeF radii );
/**
* Returns the units used for the shape's radii.
* \see setRadiiUnit()
* \see radii()
*/
QgsUnitTypes::RenderUnit radiiUnit() const;
/**
* Sets the units used for the shape's radii.
* \param units radii units
* \see radiiUnit()
* \see setRadii()
*/
void setRadiiUnit( QgsUnitTypes::RenderUnit units );
/**
* Returns the map unit scale object for the shape radii. This is only used if the
* radiiUnit() is set to QgsUnitTypes::RenderMapUnit.
* \see setRadiiMapUnitScale()
* \see radiiUnit()
*/
QgsMapUnitScale radiiMapUnitScale() const;
/**
* Sets the map unit scale object for the shape radii. This is only used if the
* radiiUnit() is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for shape radii
* \see radiiMapUnitScale()
* \see setRadiiUnit()
*/
void setRadiiMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns the background shape's opacity. The opacity is a double value between 0 (fully transparent) and 1 (totally
* opaque).
* \see setOpacity()
*/
double opacity() const;
/**
* Sets the background shape's opacity.
* \param opacity opacity as a double value between 0 (fully transparent) and 1 (totally
* opaque)
* \see opacity()
*/
void setOpacity( double opacity );
/**
* Returns the blending mode used for drawing the background shape.
* \see setBlendMode()
*/
QPainter::CompositionMode blendMode() const;
/**
* Sets the blending mode used for drawing the background shape.
* \param mode blending mode
* \see blendMode()
*/
void setBlendMode( QPainter::CompositionMode mode );
/**
* Returns the color used for filing the background shape.
* \see setFillColor()
* \see strokeColor()
*/
QColor fillColor() const;
/**
* Sets the color used for filing the background shape.
* \param color background color
* \see fillColor()
* \see setStrokeColor()
*/
void setFillColor( const QColor &color );
/**
* Returns the color used for outlining the background shape.
* \see setStrokeColor()
* \see fillColor()
*/
QColor strokeColor() const;
/**
* Sets the color used for outlining the background shape.
* \param color stroke color
* \see strokeColor()
* \see setFillColor()
*/
void setStrokeColor( const QColor &color );
/**
* Returns the width of the shape's stroke (stroke). Units are retrieved through
* strokeWidthUnit().
* \see setStrokeWidth()
* \see strokeWidthUnit()
*/
double strokeWidth() const;
/**
* Sets the width of the shape's stroke (stroke). Units are specified through
* setStrokeWidthUnit().
* \see strokeWidth()
* \see setStrokeWidthUnit()
*/
void setStrokeWidth( double width );
/**
* Returns the units used for the shape's stroke width.
* \see setStrokeWidthUnit()
* \see strokeWidth()
*/
QgsUnitTypes::RenderUnit strokeWidthUnit() const;
/**
* Sets the units used for the shape's stroke width.
* \param units stroke width units
* \see strokeWidthUnit()
* \see setStrokeWidth()
*/
void setStrokeWidthUnit( QgsUnitTypes::RenderUnit units );
/**
* Returns the map unit scale object for the shape stroke width. This is only used if the
* strokeWidthUnit() is set to QgsUnitTypes::RenderMapUnit.
* \see setStrokeWidthMapUnitScale()
* \see strokeWidthUnit()
*/
QgsMapUnitScale strokeWidthMapUnitScale() const;
/**
* Sets the map unit scale object for the shape stroke width. This is only used if the
* strokeWidthUnit() is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for shape stroke width
* \see strokeWidthMapUnitScale()
* \see setStrokeWidthUnit()
*/
void setStrokeWidthMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns the join style used for drawing the background shape.
* \see setJoinStyle
*/
Qt::PenJoinStyle joinStyle() const;
/**
* Sets the join style used for drawing the background shape.
* \param style join style
* \see joinStyle()
*/
void setJoinStyle( Qt::PenJoinStyle style );
/**
* Returns the current paint effect for the background shape.
* \returns paint effect
* \see setPaintEffect()
*/
QgsPaintEffect *paintEffect() const;
/**
* Sets the current paint \a effect for the background shape.
* \param effect paint effect. Ownership is transferred to the background settings.
* \see paintEffect()
*/
void setPaintEffect( QgsPaintEffect *effect SIP_TRANSFER );
/**
* Reads settings from a layer's custom properties (for QGIS 2.x projects).
* \param layer source vector layer
*/
void readFromLayer( QgsVectorLayer *layer );
/**
* Read settings from a DOM element.
* \see writeXml()
*/
void readXml( const QDomElement &elem, const QgsReadWriteContext &context );
/**
* Write settings into a DOM element.
* \see readXml()
*/
QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
/**
* Updates the format by evaluating current values of data defined properties.
* \since QGIS 3.10
*/
void updateDataDefinedProperties( QgsRenderContext &context, const QgsPropertyCollection &properties );
private:
QSharedDataPointer<QgsTextBackgroundSettingsPrivate> d;
};
/**
* \class QgsTextShadowSettings
* \ingroup core
* Container for settings relating to a text shadow.
* \note QgsTextShadowSettings objects are implicitly shared.
* \since QGIS 3.0
*/
class CORE_EXPORT QgsTextShadowSettings
{
public:
/**
* Placement positions for text shadow.
*/
enum ShadowPlacement
{
ShadowLowest = 0, //!< Draw shadow below all text components
ShadowText, //!< Draw shadow under text
ShadowBuffer, //!< Draw shadow under buffer
ShadowShape //!< Draw shadow under background shape
};
QgsTextShadowSettings();
/**
* Copy constructor.
* \param other source QgsTextShadowSettings
*/
QgsTextShadowSettings( const QgsTextShadowSettings &other );
QgsTextShadowSettings &operator=( const QgsTextShadowSettings &other );
~QgsTextShadowSettings();
/**
* Returns whether the shadow is enabled.
* \see setEnabled()
*/
bool enabled() const;
/**
* Sets whether the text shadow will be drawn.
* \param enabled set to TRUE to draw shadow
* \see enabled()
*/
void setEnabled( bool enabled );
/**
* Returns the placement for the drop shadow. The placement determines
* both the z-order stacking position for the shadow and the what shape (e.g., text,
* background shape) is used for casting the shadow.
* \see setShadowPlacement()
*/
QgsTextShadowSettings::ShadowPlacement shadowPlacement() const;
/**
* Sets the placement for the drop shadow. The placement determines
* both the z-order stacking position for the shadow and the what shape (e.g., text,
* background shape) is used for casting the shadow.
* \param placement shadow placement
* \see shadowPlacement()
*/
void setShadowPlacement( QgsTextShadowSettings::ShadowPlacement placement );
/**
* Returns the angle for offsetting the position of the shadow from the text.
* \see setOffsetAngle
* \see offsetDistance()
*/
int offsetAngle() const;
/**
* Sets the angle for offsetting the position of the shadow from the text.
* \param angle offset angle in degrees
* \see offsetAngle()
* \see setOffsetDistance()
*/
void setOffsetAngle( int angle );
/**
* Returns the distance for offsetting the position of the shadow from the text. Offset units
* are retrieved via offsetUnit().
* \see setOffsetDistance()
* \see offsetUnit()
*/
double offsetDistance() const;
/**
* Sets the distance for offsetting the position of the shadow from the text. Offset units
* are specified via setOffsetUnit().
* \param distance offset distance
* \see offsetDistance()
* \see setOffsetUnit()
*/
void setOffsetDistance( double distance );
/**
* Returns the units used for the shadow's offset.
* \see setOffsetUnit()
* \see offsetDistance()
*/
QgsUnitTypes::RenderUnit offsetUnit() const;
/**
* Sets the units used for the shadow's offset.
* \param units shadow distance units
* \see offsetUnit()
* \see setOffsetDistance()
*/
void setOffsetUnit( QgsUnitTypes::RenderUnit units );
/**
* Returns the map unit scale object for the shadow offset distance. This is only used if the
* offsetUnit() is set to QgsUnitTypes::RenderMapUnit.
* \see setOffsetMapUnitScale()
* \see offsetUnit()
*/
QgsMapUnitScale offsetMapUnitScale() const;
/**
* Sets the map unit scale object for the shadow offset distance. This is only used if the
* offsetUnit() is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for shadow offset
* \see offsetMapUnitScale()
* \see setOffsetUnit()
*/
void setOffsetMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns TRUE if the global shadow offset will be used.
* \see setOffsetGlobal()
*/
bool offsetGlobal() const;
/**
* Sets whether the global shadow offset should be used.
* \param global set to TRUE to use global shadow offset.
*/
void setOffsetGlobal( bool global );
/**
* Returns the blur radius for the shadow. Radius units are retrieved via blurRadiusUnits().
* \see setBlurRadius()
* \see blurRadiusUnit()
*/
double blurRadius() const;
/**
* Sets the blur radius for the shadow. Radius units are specified via setBlurRadiusUnits().
* \param blurRadius blur radius
* \see blurRadius()
* \see setBlurRadiusUnit()
*/
void setBlurRadius( double blurRadius );
/**
* Returns the units used for the shadow's blur radius.
* \see setBlurRadiusUnit()
* \see blurRadius()
*/
QgsUnitTypes::RenderUnit blurRadiusUnit() const;
/**
* Sets the units used for the shadow's blur radius.
* \param units shadow blur radius units
* \see blurRadiusUnit()
* \see setBlurRadius()
*/
void setBlurRadiusUnit( QgsUnitTypes::RenderUnit units );
/**
* Returns the map unit scale object for the shadow blur radius. This is only used if the
* blurRadiusUnit() is set to QgsUnitTypes::RenderMapUnit.
* \see setBlurRadiusMapUnitScale()
* \see blurRadiusUnit()
*/
QgsMapUnitScale blurRadiusMapUnitScale() const;
/**
* Sets the map unit scale object for the shadow blur radius. This is only used if the
* blurRadiusUnit() is set to QgsUnitTypes::RenderMapUnit.
* \param scale scale for shadow blur radius
* \see blurRadiusMapUnitScale()
* \see setBlurRadiusUnit()
*/
void setBlurRadiusMapUnitScale( const QgsMapUnitScale &scale );
/**
* Returns whether only the alpha channel for the shadow will be blurred.
* \see setBlurAlphaOnly()
*/
bool blurAlphaOnly() const;
/**
* Sets whether only the alpha channel for the shadow should be blurred.
* \param alphaOnly set to TRUE to blur only the alpha channel. If FALSE, all channels (including
* red, green and blue channel) will be blurred.
* \see blurAlphaOnly()
*/
void setBlurAlphaOnly( bool alphaOnly );
/**
* Returns the shadow's opacity. The opacity is a double value between 0 (fully transparent) and 1 (totally
* opaque).
* \see setOpacity()
*/
double opacity() const;
/**
* Sets the shadow's opacity.
* \param opacity opacity as a double value between 0 (fully transparent) and 1 (totally
* opaque)
* \see opacity()
*/
void setOpacity( double opacity );
/**
* Returns the scaling used for the drop shadow (in percentage of original size).
* \see setScale()
*/
int scale() const;
/**
* Sets the scaling used for the drop shadow (in percentage of original size).
* \param scale scale percent for drop shadow
* \see scale()
*/
void setScale( int scale );
/**
* Returns the color of the drop shadow.
* \see setColor()
*/
QColor color() const;
/**
* Sets the color for the drop shadow.
* \param color shadow color
* \see color()
*/
void setColor( const QColor &color );
/**
* Returns the blending mode used for drawing the drop shadow.
* \see setBlendMode()
*/
QPainter::CompositionMode blendMode() const;
/**
* Sets the blending mode used for drawing the drop shadow.
* \param mode blending mode
* \see blendMode()
*/
void setBlendMode( QPainter::CompositionMode mode );
/**
* Reads settings from a layer's custom properties (for QGIS 2.x projects).
* \param layer source vector layer
*/
void readFromLayer( QgsVectorLayer *layer );
/**
* Read settings from a DOM element.
* \see writeXml()
*/
void readXml( const QDomElement &elem );
/**
* Write settings into a DOM element.
* \see readXml()
*/
QDomElement writeXml( QDomDocument &doc ) const;
/**
* Updates the format by evaluating current values of data defined properties.
* \since QGIS 3.10
*/