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 .
20 #ifndef _BGFX_TOOLS_TOOLS_HXX
21 #define _BGFX_TOOLS_TOOLS_HXX
23 #include <sal/types.h>
24 #include <basegfx/basegfxdllapi.h>
33 /** Expand given parallelogram, such that it extends beyond
34 bound rect in a given direction.
36 This method is useful when e.g. generating one-dimensional
37 gradients, such as linear or axial gradients: those
38 gradients vary only in one direction, the other has
39 constant color. Most of the time, those gradients extends
40 infinitely in the direction with the constant color, but
41 practically, one always has a limiting bound rect into
42 which the gradient is painted. The method at hand now
43 extends a given parallelogram (e.g. the transformed
44 bounding box of a gradient) virtually into infinity to the
45 top and to the bottom (i.e. normal to the line io_rLeftTop
46 io_rRightTop), such that the given rectangle is guaranteed
47 to be covered in that direction.
49 @attention There might be some peculiarities with this
50 method, that might limit its usage to the described
51 gradients. One of them is the fact that when determining
52 how far the parallelogram has to be extended to the top or
53 the bottom, the upper and lower border are assumed to be
57 Left, top edge of the parallelogramm. Note that this need
58 not be the left, top edge geometrically, it's just used
59 when determining the extension direction. Thus, it's
60 perfectly legal to affine-transform a rectangle, and given
61 the transformed point here. On method return, this
62 parameter will contain the adapted output.
65 Left, bottom edge of the parallelogramm. Note that this need
66 not be the left, bottom edge geometrically, it's just used
67 when determining the extension direction. Thus, it's
68 perfectly legal to affine-transform a rectangle, and given
69 the transformed point here. On method return, this
70 parameter will contain the adapted output.
73 Right, top edge of the parallelogramm. Note that this need
74 not be the right, top edge geometrically, it's just used
75 when determining the extension direction. Thus, it's
76 perfectly legal to affine-transform a rectangle, and given
77 the transformed point here. On method return, this
78 parameter will contain the adapted output.
80 @param io_rRightBottom
81 Right, bottom edge of the parallelogramm. Note that this need
82 not be the right, bottom edge geometrically, it's just used
83 when determining the extension direction. Thus, it's
84 perfectly legal to affine-transform a rectangle, and given
85 the transformed point here. On method return, this
86 parameter will contain the adapted output.
89 The rectangle to fit the parallelogram into.
91 BASEGFX_DLLPUBLIC
void infiniteLineFromParallelogram( ::basegfx::B2DPoint
& io_rLeftTop
,
92 ::basegfx::B2DPoint
& io_rLeftBottom
,
93 ::basegfx::B2DPoint
& io_rRightTop
,
94 ::basegfx::B2DPoint
& io_rRightBottom
,
95 const ::basegfx::B2DRange
& rFitTarget
);
100 #endif /* _BGFX_TOOLS_TOOLS_HXX */
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */