Commit Graph
86 Commits
Author SHA1 Message Date
Andrea Gelmini 9c704826bb Fix typos
Change-Id: Ief7455c1b1955c292022f6a6e3b8c601a34bd8a8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210442
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2026-09-03 08:53:27 +02:00
Andrea Gelmini 4f86cfa577 Fix typos
Change-Id: Ic09e8f2877a7106eb074586662d1733828d85197
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209422
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2026-08-21 14:19:46 +02:00
Armin Le Grand (collabora) 52ec9f11d8 CairoSDPR: Improve buffering of huge BitmapData
We already did some improvements, but I wanted to clean
this up somewhat. Reason for the needed corrections was
in principle the sqrt()-based general calculation of
the HoldTime in the default implementation of
calculateCombinedHoldCyclesInSeconds. The original idea
was to hold huge data shorter due to memory constraints.
To solve that we added an adapted version to
CairoPixelProcessor2D.

With lessons learned I decided to remove that and
provide a revised general implementation based on linear
scaling of the HoldTime. Based on assuming the seen
huge Bitmap and estimating 20min for it, just create a
factor and multiply with SizeInBytes.

I checked that and it works as intended. It will spare
us from this problem re-occurring with future SDPRs.

NOTE: This still keeps the CairoSDPR-specific avoiding
of buffering of small Bitmaps when these are available
from Bitmap directly. This stays useful and is
Cairo-specific.

Signed-off-by: Armin Le Grand (collabora) <Armin.LeGrand@collabora.com>
Change-Id: I30c7361c6fbfaf0be90be353091cbaf831db5cd2
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2005
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit a3d3ae5e931a04ff5718382ccffe9f16de336a42)
(cherry picked from commit 7550c6ea0bb82f7574e4b974f8d24bd1662a878b)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205991
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
2026-06-05 08:43:16 +02:00
Armin Le Grand (collabora) 66a0927a68 CairoSDPR: Force keeping CairoSurfaceHelper for huge PixelData
If we have a really 'big' pixel-based graphic the cost for creating
the mip-map entries is high. If that is the case, force keeping this
entry alive and not getting flushed by using a large number of
seconds. In that case the local MipMap is more important than the
memory kept allocated for fast repaints.

To detect 'big' graphics, compare to an assumed ScreenSize (may also
be fetched from real screen if needed). To react, create a buffer
residing time of one hour (increase if needed).

NOTE: This will increase MemoryFootPrint if isCairoCompatible
is false by holding the local cairo_surface_t in CairoSurfaceHelper
longer than before.

Change-Id: I1cf726f00d459bc0cb19bb1d202e64e010061426
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/1134
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 2e1b0a51a745e615ed7e2f22666cc4aa4e005451)
(cherry picked from commit c2c58c177ae822906fe2c558546851643fe54247)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205988
Tested-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-06-05 08:42:55 +02:00
Xisco Fauli cfd3309a5d loplugin:unusedmethods
Check existing ones that can be removed

Change-Id: I6ee6fc1772c620ac5d12fea915681b094b7c3bfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/204583
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
2026-04-30 08:54:45 +02:00
Michael Weghorn c5a36fea6c Don't mark enum classes {SVXCORE,BASEGFX}_DLLPUBLIC
Fixes warnings like this one seen in a clang-cl (21.1.8)
build on Windows:

    C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\basegfx/utils/systemdependentdata.hxx(45,16): warning: 'dllimport' attribute only applies to functions, variables, classes, and Objective-C
          interfaces [-Wignored-attributes]
       45 |     enum class BASEGFX_DLLPUBLIC SDD_Type : sal_uInt16 {
          |                ^
    C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\basegfx/basegfxdllapi.h(33,27):: note: expanded from macro 'BASEGFX_DLLPUBLIC'
       33 | #define BASEGFX_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
          |                           ^
    C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\sal/types.h(210,47): note: expanded from macro 'SAL_DLLPUBLIC_IMPORT'
      210 | #   define SAL_DLLPUBLIC_IMPORT    __declspec(dllimport)
          |                                               ^

and

    In file included from C:/Users/mwegh/development/git/libreoffice-WORKTREE/oox/source/drawingml/diagram/datamodelcontext.cxx:20:
    In file included from C:/Users/mwegh/development/git/libreoffice-WORKTREE/oox/source/drawingml/diagram\datamodelcontext.hxx:24:
    In file included from C:/Users/mwegh/development/git/libreoffice-WORKTREE/oox/source/drawingml/diagram\datamodel_oox.hxx:29:
    In file included from C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\svx/diagram/datamodel_svx.hxx:30:
    C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\svx/diagram/DomMapFlag.hxx(28,12): warning: 'dllimport' attribute only applies to functions, variables, classes, and Objective-C interfaces
          [-Wignored-attributes]
       28 | enum class SVXCORE_DLLPUBLIC DomMapFlag : sal_uInt16
          |            ^
    C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\svx/svxdllapi.h(35,27): note: expanded from macro 'SVXCORE_DLLPUBLIC'
       35 | #define SVXCORE_DLLPUBLIC SAL_DLLPUBLIC_IMPORT
          |                           ^
    C:/Users/mwegh/development/git/libreoffice-WORKTREE/include\sal/types.h(210,47): note: expanded from macro 'SAL_DLLPUBLIC_IMPORT'
      210 | #   define SAL_DLLPUB[build CXX] oox/source/drawingml/diagram/layoutatomvisitorbase.cxx
    LIC_IMPORT    __declspec(dllimport)
          |

Change-Id: Id472eea3ccb9270e87cfce4e5e6761c566fdbdc0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202144
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2026-03-19 17:39:52 +01:00
Noel Grandin 6993d54041 std::lround is unnecessary here
because we are then casting to a type <=32 bits

Change-Id: Ief4a93724ccbae8d697edbd40e4085389d74473f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/202156
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-03-19 15:27:43 +01:00
Noel Grandin 4b10710e09 loplugin:passstuffbyref
Change-Id: I559d246b25c99e5cb7a28ba94e04a2acedd3e720
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200943
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2026-03-04 19:22:19 +01:00
Tomaž Vajngerl d37666e14f basegfx: don't allow in-place changing of BColorStops externally
All the changes should go through BColorStops interface and not
directly.

Change-Id: I4c6dd42f8d6b6c43cdcf9d53557ccb12f8d0507c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195386
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Jenkins
2025-12-15 04:07:44 +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 fd2e467ba3 tdf#146619 Run IWYU in fw decl mode on include/[a-c]*
After recent commit 851fb75779
recheck these directories in include/ again
to test drive the new --headersfwd mode of bin/find-unneeded-includes

Change-Id: I0ede437c4f9958cd98210ed1760a5b98ea8bd1ad
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192377
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <gabor.kelemen@collabora.com>
2025-11-08 09:37:19 +01:00
Noel Grandin 7a1e4bcdbd remove now unused parts of BitmapEx
Change-Id: Ic644e8c4e2dc4e14583e7c633af3dc9b0fe7bce9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190623
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-09-06 09:19:14 +02:00
Noel Grandin bacd1b5dc4 BitmapEx->Bitmap in FillGraphicPrimitive2D
now that Bitmap supports transparency

Change-Id: I9762dadae840e8eaec37526f82068183474c7962
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189069
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2025-08-07 22:04:36 +02:00
Gabor Kelemen 72df5a6fdf Drop unneeded forward declarations from include/
test drive the new bin/find-unneeded-includes --fwdecl mode

Change-Id: I507fa2b172ec9e348d1d91066ea241f02187b5ed
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179321
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2025-01-03 09:32:27 +01: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
Armin Le Grand (allotropia) f74bb604ff Make SystemDependentData mechanism type-based
Up to now that genereal buffering mechanism used
typeid.*hash_code to identify the class. As we
have learned this is not safe. Thus I changed it
to use enum'ed SystemDependentDataType definitions

Change-Id: I803912ec419290db1d40bae0bc41364fad64cbfd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170385
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-12 17:59:50 +02:00
Armin Le Grand (Collabora) 8a6fb1793d SDPRCairo: enhance CairoPixelProcessor2D
Added and corrected quite some stuff to this basic
construct provided by Caolan (thanks again!). No
detailed descriptions here, but it's getting more
complete and faster.

May contain errors and is primitive-complete in the
sense that all gets rendered, but some basic stuff
that should be directly supported is still missing,
e.g. text rendering.

Adding this to allow people to check it out (speed)
also since it's not yet used as default in master,
so it's safe and also safes the changes publically.

To test it, use TEST_SYSTEM_PRIMITIVE_RENDERER as
set EnvVar in linux systems.

Change-Id: I25f795c9ea4ad4f3b99591304f8803dffa499436
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168911
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2024-07-02 20:34:29 +02:00
Noel Grandin 5b2cd79ade loplugin:finalmethods
create a plugin that finds methods we can mark as final because they are
not override in subclasses.

Which is useful both as documentation (telling you that you don't need
to worry about subclasses changing the implementation under you),
and for performance, letting the compiler elide virtual calls in many
cases.

Apply the results to a subset of stuff in /include

Change-Id: I7b5cc893ec2f343bc356bfc338e4cf531ffba1e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165054
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-03-26 17:16:47 +01:00
RMZeroFour 64a55911ea tdf#157664 Drop redundant operator != in basegfx module
As part of the efforts in #157664 to remove redundant definitions of
operator!=, to upgrade the codebase to C++20, this commit removes the
remaining definitions in the basegfx module.

Change-Id: I19f2b9ddf42185435313445c8395a851030e2149
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165199
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Tested-by: Jenkins
2024-03-23 11:17:06 +01:00
Noel Grandin 34a09df2d1 fix windows --enable-mergelibs build
after
    commit b663d94cf6
    Author: Noel Grandin <noel.grandin@collabora.co.uk>
    Date:   Mon Feb 5 08:50:24 2024 +0200
    create --enable-mergelibs=more

Change-Id: Ib9f0b3b28df70a9bab10d9bb0aa77a2b2decc616
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163308
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-13 18:53:21 +01:00
Noel Grandin 033aaeec9e use more UNLESS_MERGELIBS
Change-Id: I351a9127fb26369d8f598b6d6519d7e490fa476b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163190
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2024-02-12 20:25:54 +01:00
Gabor Kelemen 7ac978c4d1 tdf#146619 Recheck include/basegfx with IWYU
Change-Id: I08dad6ceeaa9e5470491c09f06d819c4c27ec5f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156983
Tested-by: Jenkins
Reviewed-by: Gabor Kelemen <kelemeng@ubuntu.com>
2023-09-21 08:53:31 +02:00
Tomaž Vajngerl 242bb3fdda move BGradient to awt::Gradient2 UNO conversion into docmodel
This is needed because the module dependencies are an issues if
the conversion is done in basegfx. The bigger issue will come when
the ComplexColor conversion will be done as basegfx can't depend on
docmodel because of circular dependencies.

The BGradient is also more suitable for docmodel anyway as the
previously it was part of the model and is not a basic (gfx)
type - however this doesn't move the whole BGradient into docmodel
yet.

Change-Id: Id91ce52232f89f00e09b451c13da36e2854ae14b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155674
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-08-21 09:27:12 +02:00
Tomaž Vajngerl f896bbcffe basegfx: replace typedef with a class B2ISize based on Size2D
Change-Id: Iaf7d02bb236f81a38a67a1430a718b6c3c78efae
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139708
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
2023-07-13 13:19:00 +02:00
Armin Le Grand (allotropia) a6e72e2b31 MCGR: tdf#155479 repair gradient SVG export for MCGR
Unfortunately SVG export is based on metafiles and thus there
is (in principle) no way to get the BGradient/ColorStop/MCGR
data transfered as needed. For that, using UNO API to read the
model or using B2DPrimitives would help - as is better for the
export respectively.

Since there is not the time to re-design SVG export I added
this 'compromize' as a fix. It gets the needed data transported
over the metafile (that part is the compromize). It then
exports the MCGR data to SVG (at least - as was already there -
if it's a linear/axial gradient). This happens now with all
Gradient Stops when there is a MCGR gradient. That part is/will
hopefully be re-usable if SVG export  gets redesigned.

I also added a handling for StepCount feature, so when used (in
LO, others do not have that) 'hard' color stops get generated
to make the gradient look identical for SVG export.

Had to make adding of that extra-information in metafiles
dependent on exporting really to SVG. There are 51 cases which
use 'MetaActionType::COMMENT' which would potentially have
to be adapted.

Also added code to solve the problem for TransparencePrimitive2D
at VclMetafileProcessor2D::processTransparencePrimitive2D. This
will now - also only for SVG export - directly create the needed
MetaFloatTransparentAction and add additional MCGR information.
This will be used on SVG export to write a 'Mask' as was done
before. This is now capable of creating fill MCGR-Masks in
the sense that any number of TransparencyStops will be supported.

Change-Id: Ic6d022714eae96b8fbc09e60652851ac5799b757
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152623
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-06-09 10:17:07 +02:00
Regina Henschel 6c49886ab4 tdf#155549 MCGR: Recreate 'axial' from symmetric 'linear'
When exporting a shape with an axial gradient fill to OOXML, it is
converted to a linear gradient with multiple color stops. Versions
before MCGR had recreated it as axial gradient on import from OOXML.
But now LO is able to handle multiple color stops and so the linear
gradient from OOXML is imported as linear gradient in LO.

When such file is then written as ODF, the multiple color stops are
in elements in extended namespace and versions before MCGR do not
understand them. They show only the first and last color (which are
equal) and the gradient is lost.

With this patch LO converts the linear gradient back to an axial gradient
on export to ODF. The exported axial gradient is rendered in a version
with MCGR same as the linear gradient when opening the OOXML file. The
difference is, that versions without MCGR now render an axial gradient
with two colors.

Change-Id: I2b416b4cdca75d8327107a4f259d63c2e6e97ac3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152574
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
2023-06-05 17:34:57 +02:00
Armin Le Grand (allotropia) 8259a99f41 MCGR: Use tryToRecreateBorder for better BW comp with LO
For better compatibility with LO versions before MCGR, try
to re-create a 'border' value based on the existing GradientSteps.

With MCGR we do not need 'border' anymore in quite some cases since
no Start/EndColor at 0.0 resp. 1.0 is explicitely needed. Since we
(unfortunately need to) internally continue to support border
anyways it does no harm to fallback to use the border value - if
there is an equivalent representation as this helper checks for.

For exports that do not support 'border' this will be adapted as
needed (see tryToApplyBorder())

Change-Id: If98c64039ff97143d4b5c92ac2a950e70f5bb70a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152395
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-31 11:03:34 +02:00
Andrea Gelmini 75cca3bdea Fix typo
Change-Id: I7d6dd38b15df7e18775bc94a64aec215d2106c46
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152307
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-26 22:43:17 +02:00
Armin Le Grand (allotropia) c2bea1bedd MCGR: Border restoration support
Due to tdf#155362 I added code to be able in case we
would need it to convert a BGradient using added
tooling from having offsets in the GradientSteps
and no border to adapted GradientSteps and border.

This is preferrable due to our GradientStyle_RECT
(and GradientStyle_ELLIPTICAL too) use that 'non-
linear' paint aka move-two-pixels-inside, someone
else called it 'frame-paint'. This does not bode
well with the border being applied 'linear' at the
same time (argh). Thus - while in principle all is
correct when re-importing a GradientStyle_RECT
with a border after export to pptx, it looks
slightly better ('correcter') wen doing so. That is
because when being able to and restoring a border
at least that border part *is* applied linearly.

I took the chance to further apply tooling, move
it to classes involved and instead of awt::Gradient2
use more basegfx::BGradient since it can and does
host tooling. This is also a preparation to be
able to adapt (restore) border in case of turn-
around in ODF where the importing instance is before
MCGR existance and has to handle Start/EndColor.

Needed to take more care with using BGradient instead
of awt::Gradient2 for initialization, also better
dividing/organization of tooling, already preparation
to use for other purposes.

Change-Id: I2d3a4240a5ac6fff9211b46642ee80366dc09e3d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152194
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-26 10:08:52 +02:00
Armin Le Grand (allotropia) 428b8a8d23 MCGR: Adaptions to WriteGradientFill and BGradient
Added code to make WriteGradientFill directly use the
available BGradient implementation. The goal is to
never directly work on awt::Gradient2, but use
BGradient & it's tooling methods.

Added constructors and tooling to BGradient and
BColorStops to make that easier (single line
conversions between uno::Any, basesgfx classes
and awt:: incarnations). Directly handle uno::Any
and awt:: classes, changed stuff to make use of
this.

Change-Id: I083a323b9efee8ca4f3becb2966aac0a294b9a60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151842
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-05-19 10:09:11 +02:00
Andrea Gelmini ef1982d633 Fix typo
Change-Id: Ibbf9a267bbfba02c119fa1995c6b2ae90f391031
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151813
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-16 09:47:46 +02:00
Andrea Gelmini 92159c4b2e Fix typo
Change-Id: Ibb3cbd37e04beed410c61f93f35be51a59bdc10b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151808
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-16 09:46:54 +02:00
Andrea Gelmini bb0edd05b5 Fix typo
Change-Id: I126f38c126c3f541d451cdafa074d2b8c0248d05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151815
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-05-16 09:41:12 +02: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) 4409cd197d MCGR: 2nd corrections/adaptions to MCGR
Adapted handling of 'border' argument from our gradients
for oox export, so that it looks the same.

Also added quite some cases to peserve in-between
GradientStops for current UI implementations to be
able to edit the gradients as usual without losing
the in-between GradientStops.

While we will not be able to modify these, we are
at least able to modify all the other gradient
attributes, including start/endColor.

Done this for TransparencyGradients, too.

Also moved more stuff to the gradient tooling in
basegfx.

Change-Id: I6e94011bbf3715baa1401ab97e5b59811298342f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150577
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-19 20:43:45 +02:00
Andrea Gelmini 4256a9cf64 Fix typo
Change-Id: I59de66225912c4a5ebf257ee47b29d20c23649af
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150402
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:26:20 +02:00
Andrea Gelmini c1f7b5e8fc Fix typos
Change-Id: Id3dd5a8386906b0b17a0c5934381782ecb7cd25a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150404
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:25:29 +02:00
Andrea Gelmini 9fa1eb12d8 Fix typo
Change-Id: I9ba81b030e6ed0ebb6207a0124a52ec8a38de832
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150405
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:25:05 +02:00
Andrea Gelmini ac9cdc995b Fix typos
Change-Id: I2b087d0f97c675cfedd4e2e78c7f827df4605fb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150407
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-14 14:24:39 +02:00
Armin Le Grand (allotropia) 70684ab604 MCGR: Adaptions to oox export
This is a 1st version and might need more fine-tuning,
so it is still 'hidden' behind the MCGR_TEST env var
being set (as the import is, too).
Still, when used, it can now import a MCGR with
transparence and export it again. I will now do extended
testing/experimenting, fine-tuning where needed and
prepare final change/drive forward.
The current state in master should not be changed as
long as the mentioned env var is not set, but this
will need to be checked, too, due to changes to the
export api in oox.
Corrected an error in GetAlphaFromTransparenceGradient
method(s), css::rendering::RGBColor is [0.0 .. 1.0]
Corercted an error in WriteSolidFill where transparence
gradient gets checked. This should really check if
TrGr is used, but only checks for 'empty/unused'
color instead (assuming COL_BLACK is 'unused').
All usages of GetAlphaFromTransparenceGradient should
be checked and adapted.
Change-Id: If59d7a06b9207e2efe9e71f3f8ddeca4476408f3

Change-Id: If97f8abdd0e1597aa1fd865b7e884e06a22b71f5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150391
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-14 11:56:46 +02:00
Armin Le Grand (allotropia) 4b5203ebf4 MCGR: Improve performance for texture-mapped MCGR processing
Change-Id: I20b32e7c272112c6c3d9f7ee0ef59c6d4d006d94
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150020
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-04 18:55:49 +02:00
Andrea Gelmini c2cc3e696e Fix typo
Change-Id: I49fe9dbdc11291c02be1dd5e41171a987d896008
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149997
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-04-03 20:32:21 +02:00
Armin Le Grand (allotropia) 64007cb308 MCGR: Unify Gradient intensity handling in tooling
Moved the Gradient intensity handling to tooling since
it is also needed for TransparencyGradients. Added
missing use of GradientStepCount for transparency.

Change-Id: I63ae6683fa0131be7faadc8572e19f5c43bf27e3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149957
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-03 17:16:48 +02:00
Armin Le Grand (allotropia) ce86e5b4a8 MCGR: 1st additions to OOXML MCGR import
This change provides 1st changes to get Gradients with
muti color stops imported from MSO in the oox import
filter. It supports currently multiple ColorStops and
transparency. Also 'border'(s) should work, but
-remember- this is work in progress.

Since it is work in progress it is currently and
temporaily secured by ENV VAR "MCGR_TEST=0", so when
not using this the master version will not be touched
at all.

The number defines various ColorStop tests, 0 for none,
but some changes are active, e.g. MSO import. You may
try 1 or 16 to see all your Gradients hard replaced by
something using that feature.
I will take care fo cleaning this up again when the
feature progresses/gets complete.

Change-Id: I92e10d8cd5150733741a6def20a542abf97bd903
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149682
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-04-02 13:19:27 +02:00
Armin Le Grand (allotropia) 808c5bf663 MCGR: Model data changes for ColorSteps (II)
The biggest change here is to allow multiple ColorStops
with the same Offset. That allows to define gradients
with 'hard' color changes at any place using two
ColorStops with the same Offset and different Colors.
This required quite some adaptions, but works well.

Also removed in this context checking for all Colors
being the same to not mix up things. Also works well.

Also changed the need for having Start/EndColors AKA
ColorStops for 0.0 and 1.0 in place, instead 'imply'
the 1st ColorStop to also define the StartColor and
the last one the EndColor. This allows e.g. Gradient
definitions with two GradientStops at the same
Offset e.g. 0.5 with different colors to already
define a full Gradient.

Also added a tooling method to reverse ColorSteps,
which changes the order and mirrors the Offsets
(what even keeps an existing sort valid).
This is useful e.g. for GradientAxial which is the
only one where for decomposition the Gradient had
to be interpreted 'reverse' since it's defined
from center to edge, but for creating correct filled
polygons to represent this the inverse order had to
be used, creating polygons from edge to center.
This led to 'wild' code for this one of six cases
and prevented unifications with the other cases
(also made your brain flip).
Thus I adapted this now to use the reversed
ColorSteps consequently, and the same principle
loops than the other implementations to make things
easier for the future and to use common tooling.

Change-Id: If2943348d17d5b9cd165f4d78f22638a1dff5237
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149208
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
2023-03-21 15:53:06 +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
Andrea Gelmini 08ae7b4cc0 Fix typo
Change-Id: I1392e8e20e42b13a28b13bd611eedccf7b9c088f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148262
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
2023-03-05 08:45:47 +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
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