138 Commits
Author SHA1 Message Date
Andreas Heinisch e1fe3c74f9 tdf#152997 - Duplicate an odd length dash array to meet the spec
An odd-length array will be drawn as one dash spanning the entire path.
The specifications under
https://www.w3.org/TR/svg-strokes/#StrokeDashing state: "If the list has
an odd number of values, then it is repeated to yield an even number of
values. Thus, the rendering behaviour of stroke-array: 5,4,2 is
equivalent to stroke-dasharray: 5,4,2,5,4,2."

Change-Id: I8f233c4cec5c85f5ab1096b032cbb8743715f14d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211062
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
Tested-by: Jenkins
2026-09-21 12:28:00 +02:00
Gabor Kelemen eb087d25b3 tdf#146619 Use more forward declarations in include/drawinglayer
Change-Id: I5911dfb1cfc2bfd291758334b69123cfbce559a5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199387
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
Tested-by: Jenkins
2026-02-22 12:08:33 +01:00
Gabor Kelemen b63115f3fa tdf#146619 Use more forward declarations in include/vcl/[d-g]*
Found after running bin/find-unneeded-includes --headersfwd include/vcl/[d-g]*

This shaves off about 150M input

Change-Id: I2b15257451d4b392dca3e5d07f4a443ee653b04c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196395
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2026-01-11 21:38:37 +01:00
Tomaž Vajngerl 959decdcda basegfx: BColorStops shouldn't derive from std::vector
Change-Id: I9f246c0d9a5ddc7f8cf428bf7fc8c8957e8584b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158710
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-12-08 13:40:28 +01:00
Gabor Kelemen cf1403343d tdf#146619 Run IWYU on drawinglayer/
Change-Id: I0cdefb89bedfbe4d733edb89c9ed2e7a9b37c947
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190907
Reviewed-by: Gabor Kelemen <gabor.kelemen.extern@allotropia.de>
Tested-by: Jenkins
2025-09-17 19:23:05 +02:00
Noel Grandin 4c85558251 BitmapEx->Bitmap in drawinglayer
now that Bitmap supports transparency

Change-Id: I1894a0187d6f661ad10aa631c55fc3ea66ff1d3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190224
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-08-26 17:33:59 +02:00
Xisco Fauli 295e103964 tdf#161724: Revert "tdf#153008 svx: impl crop for stretched bitmap fill"
This reverts commit c30c1d12f2.

it even broke the original sample file reported in tdf#153008
See https://bug-attachments.documentfoundation.org/attachment.cgi?id=196248
The original issue was reported in tdf#95165 but it doesn't work
in all cases, making it much worse in some cases where images
become very stretched
Reverting for now, specially towards libreoffice-24-8 and
libreoffice-24-8-1

Change-Id: Ib94d2784d701d37853ce9b17135b36f26a5c084b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172913
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2024-09-05 16:17:57 +02:00
Balazs Varga 3eac847927 tdf#161826 - Add uniform Glow effect for texts in shapes
- Add new text Glow effect properties for shapes

- Using TextGlowPrimitive for rendering uniform text glow in shapes

- Add/allow new UI Glow Effect for texts in shapes on sidebar
  (Only for Impress/Draw and Calc)

- Import/Export ooxml files with Glow effect on texts in shapes
  (Only PPTX/XLSX)

- Import/Export odf files with Glow effect on texts in shapes

- Add unit test for glow text attributes in ODF

- Add uni tests for OOXML import/export

Note: Also this patch effects on
tdf#144061 - Effects: Allow GLOW to apply to Text (as we have for shapes)

Change-Id: I16586c01654f197f532129e4e06aa2ef9f214395
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172216
Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de>
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2024-08-29 19:59:24 +02:00
Armin Le Grand (Collabora) 1b74b95bba CairoSDPR: Improve animated tiled fills
Up to now these needed to be decomposed to be
rendered and did not support animation. I already
added animation, but that was a compromize.
Done that now in the correct way, so that animation
is possible and can be directly rendered using
a FillGraphicPrimitive2D if wanted, including one
extra layer of alpha, too.
This will also enhance other primitive processors,
but of course most those that do handle that now
directly, so CairoPixelProcessor2D does that.
Note that it does not need to support animation
in any way (that is part of the primitive stack),
but just direct tiled rendering.

Change-Id: I8860098dfb3f2369e361579cf1deea7c67b662b9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170937
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-24 17:00:56 +02:00
Armin Le Grand (Collabora) a073b61339 CairoSDPR: Direct support for RGBA Gradients (I)
Detect where created when a RGBA gradient could be
used directly and create a primitive representing
that, a PolyPolygonRGBAGradientPrimitive2D.
That primitive decomposes to what was created before,
so no primitive renderer has to be touched, all will
work as before.
NOTE: That helper primitive just holds references to
what would be created anyways, so one depth step
added but not really any additional data.
This is the 1st step for direct support, the 2nd is
to then detect and use that primitive in SDPR
implementations directly.

Change-Id: I4f247636ce58a8a1fd1e0df32dabed0d6cc10d0e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170527
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-16 13:10:10 +02:00
Attila Szűcs c30c1d12f2 tdf#153008 svx: impl crop for stretched bitmap fill
The ticket had a pptx with a:
<a:blipFill> <a:stretch> <a:fillRect ...>
Impress loaded the fillRect as a crop, but never used.

Implemented a crop in
SdrFillGraphicAttribute::createFillGraphicAttribute
because in the case of stretching, it blindly used the whole picture.

Cropping data was not available there so it is copied
into OffsetPosition, and Size

Change-Id: I195cc40a35dc24c708e7c0e3cdbe40d6e47b8ce5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168391
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
2024-06-06 10:03:14 +02:00
Bogdan Buzea d396aa36b0 tdf#160084 Simplify comparison for basegfx::fTools
Change-Id: I853cab70d24e4813d979f507dc5b66049cbca53b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165316
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-27 14:27:14 +01:00
Armin Le Grand (allotropia) 438f0752de MCGR: consolidations/cleanups for changes so far
Change-Id: I85cf40e4803b0485bb40349d8e81adc8123666c4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151706
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-15 15:19:53 +02:00
Armin Le Grand (allotropia) dccd82b5ac MCGR: Reduce diverse GradientStyle enums to single UNO API one
Change-Id: Ie0cd26a308a75ddead9451c53e874a39cc6eeb63
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150705
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-21 15:03:14 +02:00
Sarper Akdemir c27946fb15 tdf#150020 pptx import: handle algn for outerShdw
Introduces RectangleAlignmentItem that holds a value of the enum
model::RectangleAlignment.

Introduces SDRATTR_SHADOWALIGNMENT that holds alignment for a shadow.

Implements import of algn for outerShdw.

Makes the alignment considered while the shadow is being scaled.
Also adds a unit test that covers this.

Change-Id: I8f4eaed5f0d9428a7f405c65f19237f9e70ca151
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148934
Tested-by: Jenkins
Reviewed-by: Sarper Akdemir <sarper.akdemir@collabora.com>
2023-04-18 17:43:18 +02:00
Armin Le Grand (allotropia) 9331d2d333 MCGR: Corrected error with Case16 wrong gradient shortcut
Also simplified using the test cases, these now depend on
an ENV VAR called MCGR_TEST. Fallback is no test. For
seeing a multi-color gradient use 1, for Case16 use 16.
If active, all gradients are replaced with the one active
for the test, 2D and 3D. This is temporary but also for
pro build to check for speed there.

Change-Id: I90f3c7e59d9d0a3e070a849af3f9ea1c9e5462a0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149316
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-03-22 14:28:19 +00:00
Armin Le Grand (allotropia) 01d0019c85 MCGR: Model data changes for ColorSteps
Added tooling replaceStart/EndColor to allow simple
transition for code that does not immediately adapt
to multi color gradients. Also added
createColorStepsFromStartEndColor for the same
purpose.

Adapted XGradient to no longer have Start/EndColor
at all, but only use ColorSteps.

Adapted all usages of XGradient to no longer use
Get/Set/Start/EndColor, but access the ColorSteps
instead.

Replaced quite some XGradient constructors that
used XGradient() as Start/EndColor since this is
already the default.

Adapted ColorBlending to black AKA Start/EndIntens
in XGradient to work now on all ColorSteps in the
required linearly-scaled manner.

UNO API changes:

Added com::sun::star::awt::ColorStep as basic data
element that holds a pair of Offset and Color.

Added com::sun::star::awt::ColorStepSequence to
handle an array of sorted entries.

Added com::sun::star::awt::Gradient2 derived from
com::sun::star::awt::Gradient, extended by the
needed com::sun::star::awt::ColorStepSequence.

Added MID_GRADIENT_COLORSTEPSEQUENCE to UNO API
to provide access to ColorSteps directly.

Adapted XFillGradientItem::QueryValue/PutValue to
make use of new UNO API data structures. To do so,
added tooling methods for data transition:
    - fillColorStepSequenceFromColorSteps
    - fillGradient2FromXGradient
    - fillColorStepsFromAny
    - fillXGradientFromAny
and adapted
    - case '0' (all data)
    - MID_FILLGRADIENT
    - MID_GRADIENT_COLORSTEPSEQUENCE
    - MID_GRADIENT_START/ENDCOLOR
to make use of these.

Tested usage of these in the office.

Renamed from GradientStep to GradientStop after
discussions with members on the list to make this
closer related to other norms/definitions.

Also renamed classes and class members to better
reflect to GradientStop, so grepping/finding will
be easier (e.g. 'Color' just exists pretty often,
but 'StopColor' is more precise).

Changed the used UNO API class for reprsenting the
Color to better reflect to ranges [0.0 .. 1.0] and
usage of RGB.

Change-Id: I1eeb3e97e81d6785967615d1ff256551fc3b882d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148849
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-03-19 17:38:38 +00:00
Armin Le Grand (allotropia) ecae66c41d MCGR: ColorSteps handling moved to tooling
Due to the fact that handling of a vector GradientSteps
will get used more often with ongoing changes I moved
some handling to tooling, see sortAndCorrectColorSteps.
That method sorts and corrects a vector of ColorSteps
so that only valid entreis remain in a sorted order,
for details please refer to the docu at function
definition. I took the occasion to rearrange that to
work on the single provided vector which is better for
speed & ressources.

Also changed the ColorStep constructor to not
automatically correct constructed entries: While that
is formally correct, it moves an invalid entry to 0.0
or 1.0, thus creating additional wrong Start/EndColor
entries. Those may then 'overlay' the correct entry
when corrections are applied to the vector of entries
which leads to getting the wanted Start/EndColor to be
factically deleted, what is an error.

Also rearranged FillGradientAttribute to now work
initially with ColorSteps, no longer requires the
Start/EndColor, also adapted all usages. This securely
allows start/end and in-between single-color sections
in gradients.

Also needed to re-formulate GradientRect &
GradientElliptical ::appendTransformationsAndColors
method for correct 2D mapping(s) - always incrementing
from the start to end conflicts with the adaption of
the start value for the inner loop mainly because
increment is at start of inner loop (pre-increment).

Corrected errors from clang plugin, but also some
wrong initialiations for basegfx::ColorSteps.

Change-Id: I292592ed9abcfa591f68a680479f4fcdda46cbeb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148196
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-03-04 16:32:16 +00:00
Andrea Gelmini 894b1a8b22 Fix typo
Change-Id: Ibb51b7ea2a404156459fb7454e5260d0375fc842
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147472
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-22 14:04:03 +00:00
Armin Le Grand (allotropia) c4f252035c MCGR: Adapted GradientLinear to make use of MCGR
Added to make GradientLinear work using the MCGR
as 1st of six types. Had to do quite some tickeling
to get it all work, but looks good.

Five more to go, already started to put some things
to tooling to make re-usable for the other types.

Besides adapting this the main change is that the
adaption of defined step-count (versus automatic)
has to be done in modifyBColor now instead of the
back-mapping methods (e.g. getLinearGradientAlpha).

It is still 100% backward-compatible, so as long
as there is no source using this it will stay
invisible - by purpose.

I started to do quite some tests (and fixes/
adaptions in consequence), see the static variable
nUseGradientSteps. If you want to play with this,
you might set it to '1' instead of '0' and use a
linear gradient on an object.

Change-Id: I9d61934defb0674456247f2879f0a89b6a5e50f7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147413
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-22 09:13:20 +00:00
Armin Le Grand (allotropia) ea1d3d11ca MCGR: Add GradientSteps to GeoTexSvxGradient
Move GradientSteps data to GeoTexSvxGradient and adapt
interfaces. Also move tooling to more isolated place
in gradienttools in basegfx.

Keep everything still compatible, the work will be now
to adapt all six different derivations of
GeoTexSvxGradient to make use of the evtl. given
GradientSteps.

Change-Id: Iaa212763c603d46de0a94b1b203b979bb7ce359d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147050
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-15 14:46:11 +00:00
Andrea Gelmini 7e1a4a518e Fix typos
Change-Id: I7c755b2099c3607fece3442269ff3a806b196f1f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146836
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-02-12 21:27:13 +00:00
Armin Le Grand (allotropia) 43de98fb59 MCGR: Add/Provide GradientSteps to FillGradientAttribute
MCGR stands for MultiColorGRadient. This change allows/
prepares adding multiple color steps to gradient rendering.

This is preparation work to allow rendering MCGRs in the
future. All places are adapted in a way that currently
no change of behaviour will happen. It will be the base
to get MCGR rendering/decompose for Primitives and our
internal/existing gradients working.

Change-Id: I28bbd7d10b8670042343ada2a66b5909d3d31bbd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146748
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-02-12 10:54:06 +00:00
Armin Le Grand (Allotropia) 50394abcc3 tdf#128150 Implement/add SlideBackgroundFill visualization
React/interpret new SlideBackgroundFill mode for SdrObjects/
XShapes, defined by drawing::FillStyle_NONE and usage of
XFillUseSlideBackgroundItem as (true).

Do so by adding a detection, a mode to SdrFillAttribute,
reacting on it by creating a new implemented  B2DPrimitive:

SlideBackgroundFillPrimitive2D provides a Primitive2D for
the SlideBackgroundFill mode. It is capable of expressing
that state of fill and it's decomposition implements all
needed preparation/creation/collecting of the geometry
in an isolated and controllable space and way - the
B2DPrimitive way. It does so based on the given
ViewInformation2D, reacing out for all needed data/
geometry from this.
It clips & transforms/combines as needed, providing the
necessary visualization of the MasterPage content *over*
other objects on the Page/Slide. It is currently simple
buffered (due to being derived from
BufferedDecompositionPrimitive2D) and detects if
MasterPage changes. Still, more may be needed.

Change-Id: Ie11403c0b705fc2ecdfd7eb2fa5ae1a93a21b460
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135971
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de>
2022-06-20 10:36:15 +02:00
Noel Grandin dcb36da295 clang-tidy modernize-pass-by-value in drawinglayer
Change-Id: I8a3245c6a4d687edbc95cf28b2932d80c86a7b65
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/135828
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-06-15 09:24:47 +02:00
Noel Grandin 7002caa97e new loplugin:trivialdestructor
look for potentially trivial destructors that can then be elided

Change-Id: I435c251bd4291b5864c20d68f88676faac7c43fb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131318
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2022-03-11 09:06:06 +01:00
Noel Grandin 151316b601 rtl::Static to thread-safe static
Change-Id: Iff3489ee171cf2eaecbd1aad6f942a1468f76512
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124928
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-11-09 20:42:24 +01:00
Tomaž Vajngerl a2fa768b73 extend XML dumpig for primitives to support fontwork objects
This adds support for 3D drawinglayer primitive XML dumping and
adds dumping support for many more primitives and attributes that
were missing before. This is needed to be able to check the
fontwork objects, which can be rendered in 3D.

Change-Id: I0e78be4d4030a0cae3d2b952a1a38de8940ee310
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124804
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2021-11-08 13:52:31 +01:00
Noel Grandin cf739db1d6 loplugin:moveparam in drawinglayer
Change-Id: I428116d96a011b061dda8376b6f27fb135a62964
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/123114
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-10-06 07:13:56 +02:00
Noel Grandin d8910519f1 clang:optin.performance.Padding
Excessive padding in 'struct ValueSetItem' (8 padding bytes, where 0 is
optimal).
Excessive padding in 'struct framework::CommandInfo' (12 padding bytes,
where 4 is optimal). Optimal fields order: aIds, nId, nImageInfo,
consider reordering the fields or adding explicit padding members
[optin.performance.Padding]
Excessive padding in 'class
drawinglayer::attribute::ImpFillGradientAttribute' (10 padding bytes,
where 2 is optimal).
Excessive padding in 'class
drawinglayer::attribute::ImpSdrLineAttribute' (8 padding bytes, where 0
is optimal).

Change-Id: I606f2bfc2c0c51b386182b900401dd15b5404451
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121938
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-09-11 14:59:36 +02:00
Noel Grandin 21dbf18064 clang-tidy:readability-redundant-member-init
Change-Id: I95918275653714577e2d6728dd3947c7fbb66d8f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121360
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-08-31 14:30:43 +02:00
Tomaž Vajngerl b576ca8d23 remove fontattribute.cxx from clang-format excludelist
Change-Id: I3720692af45920a4d084fe6ca4dd08bc0598ac13
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106385
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-11-23 10:35:51 +01:00
Gabor Kelemen 433e60eb52 tdf#42949 Fix new IWYU warnings in directories d*
Found with bin/find-unneeded-includes
Only removal proposals are dealt with here.

Change-Id: I8f3cd05dbd86bd22fd84d767adc44fc2b0c89404
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105468
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-09 16:04:18 +01:00
Noel Grandin 1ebe85bc1f compact namespace: drawinglayer
Change-Id: I32648ae81c4a06f944b70c0cca1694333ec02859
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98916
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-07-16 20:36:17 +02:00
A_GAN 4c48de44ad Add blur attributies and definitons into shadow classes and properities
Change-Id: I365f4bcfc8d772ea77cec1e4ce139b9fc16d9d7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95000
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2020-05-29 09:09:58 +02:00
Mike Kaganski 08ebcff89f tdf#101181: improve glow effect
The shadow of objects must not be scaled: this displaces any internal
areas that need blur, e.g. holes. Instead, it needs to dilate the
shadow using kernel with radius equal to blur radius: this allows the
borders of dilated objects to be in the middle of the blur area. The
following blur makes those new margin points to have 50% intensity,
and full glow intensity at the point of old object margins. This also
removed artifacts when moving objects with glow effect caused by
mismatch between scaling and D2D range calculation.

The D2D range therefore is not calculated by scaling, but using grow.
Blur filter's "extend bitmap by blur radius" option got obsoleted and
removed.

There's no need to blur the glow color (24-bit RGB). Instead, glow
bitmap must be filled by glow color, and have an alpha mask that is
blurred accordingly. This makes the glow properly transparent, and
also reduces the blur complexity which now only needs to process 8
bits of alpha channel.

The object shadow is created using basegfx::BColorModifier_replace
inserted into the 2d decomposition of the effect, as before. To make
sure that any non-fully-transparent pixel will become black pixel in
the shadow, black color is used, and the result is further processed
in VclPixelProcessor2D::processGlowPrimitive2D with monochrome filter
using threshold 255.

Glow transparency attribute is taken into account: the initial value
at the margins of the objects. Color replacement filter is used to
replace the object shadow with the attribute value before blur pass.

Correct blur radius is used, calculated from glow effect radius,
instead of hardcoded value of 5 pixels. This makes the glow to fade
gradually along the full width of the effect, instead of only fading
in narrow outer border previously.

Since blur filter is only implemented for radius up to 254 pixels,
and since downsampling the shadow before blur increases performance
without noticeable quality loss, the image is downsampled before
filtering.

It should be noted that the glow effect is almost identical to soft
shadow effect, likely with the only difference of using dilation in
the former, but not in the latter. The code might be reused later to
implement soft shadow as well.

Change-Id: I728c532f9df7ccf85f353c23c6c7d8352d7b2086
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93235
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-05-07 21:57:37 +02:00
Mike Kaganski 3e131bffde This comparison is redundant, radiuses are compared below
Change-Id: Idb98314877518beefdd12dd95bbbb055f3aa429d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93549
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-05-06 12:36:21 +02:00
Mike Kaganski 11ee7f6598 Use default ctor
Change-Id: I1f692f706f2e688384c01e99c14307190bf70104
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93548
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2020-05-06 12:35:11 +02:00
Gülşah Köse 6454b6336b tdf#130058 Import shadow size.
Change-Id: Ie1cee377a33567088fb76ea47f0e6fc51d47f0fa
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92188
Tested-by: Jenkins
Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
2020-04-23 10:07:13 +02:00
Tamas Bunth f9fc420dce tdf#101181 Implement glow effect on shapes
Glow effect is a color-blurred outline outside of the shape. In ooxml
document it is specified with the <a:glow> element.

The commit contains the following:
- Add support for importing and exporting <a:glow> from ooxml documents.
- Assign new properties to XShape which stores glow-related attributes.
- A new 2D primitive is introduced in module 'drawinglayer' which is
  responsible for representing the glow primitive which is to be rendered.
  + A glow primitive is a clone of the original shape which has been
    scaled up slightly and a new color has been assigned to it. The
    radius of the glow effect and the color is defined in the <a:glow>
    element being imported.
- A blur algorithm is introduced in module 'vcl', which is called during
  rendering the primitive.
  + The blur algorithm works on a bitmap.
  + Since the algorithm is CPU-intensive, the result is cached in the
    processor and it is recalculated only if needed.
- Add support for importing and exporting glow effect to ODF format. For
  that, new attributes of element <style:graphic-properties> has been
  added:
  + loext:glow, which can have the values "visible" or "hidden"
  + loext:glow-radius: which holds the radius of the glow effect in cm.
  + loext:glow-color: holds the color of the glow effect
- Tests have been added to assert properties after pptx import and
export.

Change-Id: I836aeb5e0f24e2c8d5725834c8c0f98083bc82e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89125
Tested-by: Jenkins
Reviewed-by: Tamás Bunth <btomi96@gmail.com>
2020-03-03 15:52:47 +01:00
Noel Grandin aee42a7bf1 clang-tidy modernize-concat-nested-namespace in drawinglayer
Change-Id: If2644743ab0d9b78d42d1d2fe6fa22c83472d2c1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87065
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-01-20 13:47:45 +01:00
Andrea Gelmini 051f0dca87 Fix typo
Change-Id: I1e3ce93fb4aa475fb73a2521a0127d37a5b84dc1
Reviewed-on: https://gerrit.libreoffice.org/72326
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
2019-05-15 07:07:43 +02:00
Stephan Bergmann 27cd397b1a Drop o3tl/clamp.hxx, use C++17 std::clamp instead
Change-Id: I5043c787dcc3b78bc7fdff130564801194e39f46
Reviewed-on: https://gerrit.libreoffice.org/66177
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2019-01-11 20:25:08 +01:00
Noel Grandin e4472d3c13 loplugin:unnecessaryparen include more assignments
Change-Id: I9fb8366634b31230b732dd38a98f800075529714
Reviewed-on: https://gerrit.libreoffice.org/64510
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-12-05 07:49:30 +01:00
Caolán McNamara 4219853f73 clarify this code a bit
Change-Id: I44066ad4f2e2374e87771de89bdefdbccc816302
Reviewed-on: https://gerrit.libreoffice.org/62095
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-10-21 16:48:51 +02:00
Noel Grandin 2c1b7e8d6a clang-tidy readability-container-size-empty
Change-Id: I1df70b7dff5ebb6048f7fc618789faa15ca5d422
Reviewed-on: https://gerrit.libreoffice.org/61967
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-19 10:02:39 +02:00
Stephan Bergmann f4351535f3 Consolidate: basegfx::clamp -> o3tl::clamp
Change-Id: Iffd8b0a19d4479b6c70dc834c6f64499e87e01b1
Reviewed-on: https://gerrit.libreoffice.org/59265
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
2018-08-17 20:13:21 +02:00
Mike Kaganski 8c48d69f06 Use more basegfx deg<->rad functions, instead of direct formulas
Also make the functions constexpr.

Due to slight changes in floating-point arithmetics (90.0 instead of
180.0, M_PI2 instead of M_PI resp.), results might differ in last
digits (usually 17th decimal digit). This has lead to need to tweak
char2dump's PieChartTest unit test.

Change-Id: I20323dd7dab27e4deb408ea4181e390cc05e7cd3
Reviewed-on: https://gerrit.libreoffice.org/58583
Tested-by: Jenkins
Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2018-08-04 20:51:27 +02:00
Jochen Nitschke 8010abe4ab clang-tidy modernize-use-equals-default in drawinglayer
Change-Id: I2fbcac7a22a881681bc8b84274e7d39f1cec18bf
Reviewed-on: https://gerrit.libreoffice.org/48800
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-29 07:32:42 +01:00
Stephan Bergmann 6e8765b161 More loplugin:cstylecast: drawinglayer
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files

Change-Id: I38baea4d1dd354e48eb90fc2fc385ef60485b5e3
2018-01-12 20:25:28 +01:00