1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <sal/types.h>
23 #include <basegfx/basegfxdllapi.h>
32 namespace basegfx::utils
34 /** Expand given parallelogram, such that it extends beyond
35 bound rect in a given direction.
37 This method is useful when e.g. generating one-dimensional
38 gradients, such as linear or axial gradients: those
39 gradients vary only in one direction, the other has
40 constant color. Most of the time, those gradients extends
41 infinitely in the direction with the constant color, but
42 practically, one always has a limiting bound rect into
43 which the gradient is painted. The method at hand now
44 extends a given parallelogram (e.g. the transformed
45 bounding box of a gradient) virtually into infinity to the
46 top and to the bottom (i.e. normal to the line io_rLeftTop
47 io_rRightTop), such that the given rectangle is guaranteed
48 to be covered in that direction.
50 @attention There might be some peculiarities with this
51 method, that might limit its usage to the described
52 gradients. One of them is the fact that when determining
53 how far the parallelogram has to be extended to the top or
54 the bottom, the upper and lower border are assumed to be
58 Left, top edge of the parallelogramm. Note that this need
59 not be the left, top edge geometrically, it's just used
60 when determining the extension direction. Thus, it's
61 perfectly legal to affine-transform a rectangle, and given
62 the transformed point here. On method return, this
63 parameter will contain the adapted output.
66 Left, bottom edge of the parallelogramm. Note that this need
67 not be the left, bottom edge geometrically, it's just used
68 when determining the extension direction. Thus, it's
69 perfectly legal to affine-transform a rectangle, and given
70 the transformed point here. On method return, this
71 parameter will contain the adapted output.
74 Right, top edge of the parallelogramm. Note that this need
75 not be the right, top edge geometrically, it's just used
76 when determining the extension direction. Thus, it's
77 perfectly legal to affine-transform a rectangle, and given
78 the transformed point here. On method return, this
79 parameter will contain the adapted output.
81 @param io_rRightBottom
82 Right, bottom edge of the parallelogramm. Note that this need
83 not be the right, bottom edge geometrically, it's just used
84 when determining the extension direction. Thus, it's
85 perfectly legal to affine-transform a rectangle, and given
86 the transformed point here. On method return, this
87 parameter will contain the adapted output.
90 The rectangle to fit the parallelogram into.
92 BASEGFX_DLLPUBLIC
void infiniteLineFromParallelogram( ::basegfx::B2DPoint
& io_rLeftTop
,
93 ::basegfx::B2DPoint
& io_rLeftBottom
,
94 ::basegfx::B2DPoint
& io_rRightTop
,
95 ::basegfx::B2DPoint
& io_rRightBottom
,
96 const ::basegfx::B2DRange
& rFitTarget
);
98 /** Creates polypolygon with the given number as seven-segment
105 Total number of digits to display. If less is needed for
106 given number, fill space with blanks.
109 Decimal places to show. When 0, display as integer. When
110 negative, fill given number of before-the-decimal point
114 When true, return a polygon containing the segments that
115 are 'lit' for the given number. Return un-lit segments
118 BASEGFX_DLLPUBLIC B2DPolyPolygon
number2PolyPolygon(double fVal
,
119 sal_Int32 nTotalDigits
,
120 sal_Int32 nDecPlaces
,
121 bool bLitSegments
=true);
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */