summaryrefslogtreecommitdiff
path: root/offapi
diff options
context:
space:
mode:
authorArmin Le Grand (allotropia) <armin.le.grand.extern@allotropia.de>2023-03-13 19:39:34 +0100
committerArmin Le Grand <Armin.Le.Grand@me.com>2023-03-19 17:38:38 +0000
commit01d0019c851b9e942f9a3b94d6dd554fb1adb40c (patch)
tree201cb6d13f57f8fa06128785c1ddb330eeacc349 /offapi
parentfd299d209d82495eb6528fb444e0b68f41c8ae0d (diff)
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>
Diffstat (limited to 'offapi')
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/awt/ColorStop.idl32
-rw-r--r--offapi/com/sun/star/awt/ColorStopSequence.idl17
-rw-r--r--offapi/com/sun/star/awt/Gradient2.idl26
4 files changed, 78 insertions, 0 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 5a592600797e..bdae567ce601 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1714,6 +1714,8 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/awt,\
AdjustmentEvent \
AdjustmentType \
CharSet \
+ ColorStop \
+ ColorStopSequence \
Command \
DeviceCapability \
DeviceInfo \
@@ -1737,6 +1739,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/awt,\
FontWeight \
FontWidth \
Gradient \
+ Gradient2 \
GradientStyle \
ImageDrawMode \
ImageAlign \
diff --git a/offapi/com/sun/star/awt/ColorStop.idl b/offapi/com/sun/star/awt/ColorStop.idl
new file mode 100644
index 000000000000..7b67aa20547d
--- /dev/null
+++ b/offapi/com/sun/star/awt/ColorStop.idl
@@ -0,0 +1,32 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+
+ module com { module sun { module star { module awt {
+
+
+/** defines a Color-Stop entry for a gradient definition
+ */
+struct ColorStop
+{
+ /** specifies the offset.
+ */
+ double StopOffset;
+
+ /** contains the color value.
+ */
+ // com::sun::star::util::Color StopColor;
+ com::sun::star::rendering::RGBColor StopColor;
+};
+
+
+}; }; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/ColorStopSequence.idl b/offapi/com/sun/star/awt/ColorStopSequence.idl
new file mode 100644
index 000000000000..05d3e6110156
--- /dev/null
+++ b/offapi/com/sun/star/awt/ColorStopSequence.idl
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+module com { module sun { module star { module awt {
+
+typedef sequence<com::sun::star::awt::ColorStop> ColorStopSequence;
+
+}; }; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/awt/Gradient2.idl b/offapi/com/sun/star/awt/Gradient2.idl
new file mode 100644
index 000000000000..c9d38657f47d
--- /dev/null
+++ b/offapi/com/sun/star/awt/Gradient2.idl
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+
+module com { module sun { module star { module awt {
+
+/** This struct extends the Gradient definition by adding a sequence
+ of ColorStops to allow definition of multi-color gradients.
+ */
+struct Gradient2 : Gradient
+{
+ /** contains the full multi-color gradient definition.
+ */
+ com::sun::star::awt::ColorStopSequence ColorStops;
+};
+
+
+}; }; }; };
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */