diff options
author | Armin Le Grand <alg@apache.org> | 2012-07-23 15:40:53 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-05-02 14:16:14 +0100 |
commit | 8f43c78e9a607df8c72232f03be4f9a7c80538de (patch) | |
tree | 37ff71299880163017f5513c76177365f926ddfd /include/drawinglayer | |
parent | e1ffd555b5c70e4bdc693711917ebffbb2423579 (diff) |
Resolves: #i120230# Adapt hatch processing for a more pleasant visualisation
Adapt hatch processing to keep a view-dependent minimal distance for a more
pleasant visualisation
(cherry picked from commit 6a036e7ac17a1d4394d60471bd8931d9b16b7bb4)
Conflicts:
drawinglayer/inc/drawinglayer/attribute/fillhatchattribute.hxx
drawinglayer/inc/drawinglayer/primitive2d/fillhatchprimitive2d.hxx
drawinglayer/inc/drawinglayer/primitive2d/primitivetools2d.hxx
drawinglayer/source/attribute/fillhatchattribute.cxx
Change-Id: I15cd784ef7d3e47a20308f16d370c24ef46d2f22
Diffstat (limited to 'include/drawinglayer')
3 files changed, 31 insertions, 1 deletions
diff --git a/include/drawinglayer/attribute/fillhatchattribute.hxx b/include/drawinglayer/attribute/fillhatchattribute.hxx index 7e6244be090b..30e054085815 100644 --- a/include/drawinglayer/attribute/fillhatchattribute.hxx +++ b/include/drawinglayer/attribute/fillhatchattribute.hxx @@ -69,6 +69,7 @@ namespace drawinglayer double fDistance, double fAngle, const basegfx::BColor& rColor, + sal_uInt32 nMinimalDiscreteDistance, bool bFillBackground); FillHatchAttribute(); FillHatchAttribute(const FillHatchAttribute& rCandidate); @@ -86,6 +87,19 @@ namespace drawinglayer double getDistance() const; double getAngle() const; const basegfx::BColor& getColor() const; + + // #i120230# If a minimal discrete distance is wanted (VCL used 3, + // this is the default for the global instance, too), set this + // unequal to zero. Zero means not to use it. If set bigger zero + // (should be at least two, one leads to a full plane filled with + // lines when Distance in discrete views is smaller than one) this + // will be used when the discrete value is less than the given one. + // This is used to 'emulate' old VCL behaviour which makes hatches + // look better by not making distances as small as needed, but + // keeping them on a minimal discrete value for more appealing + // visualisation. + sal_uInt32 getMinimalDiscreteDistance() const; + bool isFillBackground() const; }; } // end of namespace attribute diff --git a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx index b0c27ba89107..f8e52c27d951 100644 --- a/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/fillhatchprimitive2d.hxx @@ -23,6 +23,7 @@ #include <drawinglayer/drawinglayerdllapi.h> #include <drawinglayer/primitive2d/baseprimitive2d.hxx> +#include <drawinglayer/primitive2d/primitivetools2d.hxx> #include <drawinglayer/attribute/fillhatchattribute.hxx> #include <basegfx/color/bcolor.hxx> @@ -40,9 +41,14 @@ namespace drawinglayer If the background is to be filled, a flag in FillHatchAttribute is set and the BColor defines the background color. + #i120230# This primitive is now evtl. metric dependent due to the value + MinimalDiscreteDistance in the FillHatchAttribute if the value is not zero. + This is used for a more appealing, VCL-like visualisation by not letting the + distances get too small between lines. + The decomposition will deliver the hatch lines. */ - class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public BufferedDecompositionPrimitive2D + class DRAWINGLAYER_DLLPUBLIC FillHatchPrimitive2D : public DiscreteMetricDependentPrimitive2D { private: /// the geometric definition @@ -76,6 +82,9 @@ namespace drawinglayer /// get range virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + /// get local decomposition. Overloaded since this decomposition is view-dependent + virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + /// provide unique ID DeclPrimitrive2DIDBlock() }; diff --git a/include/drawinglayer/primitive2d/primitivetools2d.hxx b/include/drawinglayer/primitive2d/primitivetools2d.hxx index 6ef63f1e916b..3d208231b7ea 100644 --- a/include/drawinglayer/primitive2d/primitivetools2d.hxx +++ b/include/drawinglayer/primitive2d/primitivetools2d.hxx @@ -47,6 +47,13 @@ namespace drawinglayer */ double mfDiscreteUnit; + protected: + /// helper to update discrete unit + void updateDiscreteUnit(double fNew) + { + mfDiscreteUnit = fNew; + } + public: /// constructor DiscreteMetricDependentPrimitive2D() |