46 const sal_uInt32 nWidth(mnAntiAlialize ? rRaster.
getWidth()/mnAntiAlialize : rRaster.
getWidth());
47 const sal_uInt32 nHeight(mnAntiAlialize ? rRaster.
getHeight()/mnAntiAlialize : rRaster.
getHeight());
51 const Size aDestSize(nWidth, nHeight);
56 const sal_uInt16 nDivisor(mnAntiAlialize * mnAntiAlialize);
58 for(sal_uInt32
y(0);
y < nHeight;
y++)
60 for(sal_uInt32
x(0);
x < nWidth;
x++)
68 for(sal_uInt32 c(0); c < mnAntiAlialize; c++)
70 for(sal_uInt32
d(0);
d < mnAntiAlialize;
d++)
73 nRed += rPixel.getRed();
74 nGreen += rPixel.getGreen();
75 nBlue += rPixel.getBlue();
76 nAlpha += rPixel.getAlpha();
86 aContent.SetPixel(y, x,
Color(ColorAlpha,
89 static_cast<sal_uInt8>(nGreen / nDivisor),
90 static_cast<sal_uInt8>(nBlue / nDivisor) ));
93 aContent.SetPixel(y, x,
Color(ColorAlpha, 0, 0, 0, 0));
101 for(sal_uInt32
y(0);
y < nHeight;
y++)
103 for(sal_uInt32
x(0);
x < nWidth;
x++)
107 if(rPixel.getAlpha())
109 aContent.SetPixel(y, x,
Color(ColorAlpha, rPixel.getAlpha(), rPixel.getRed(), rPixel.getGreen(), rPixel.getBlue()));
112 aContent.SetPixel(y, x,
Color(ColorAlpha, 0, 0, 0, 0));
177 rVisibleDiscreteRange = rDiscreteRange;
184 if(rVisibleDiscreteRange.
isEmpty())
186 rUnitVisibleRange = rVisibleDiscreteRange;
197 : (rVisibleDiscreteRange.
getMinX() - rDiscreteRange.
getMinX()) * fDiscreteScaleFactorX);
200 : (rVisibleDiscreteRange.
getMinY() - rDiscreteRange.
getMinY()) * fDiscreteScaleFactorY);
204 : (rVisibleDiscreteRange.
getMaxX() - rDiscreteRange.
getMinX()) * fDiscreteScaleFactorX);
207 : (rVisibleDiscreteRange.
getMaxY() - rDiscreteRange.
getMinY()) * fDiscreteScaleFactorY);
238 if(aVisibleDiscreteRange.
isEmpty())
242 double fViewSizeX(aVisibleDiscreteRange.
getWidth());
243 double fViewSizeY(aVisibleDiscreteRange.
getHeight());
244 const double fViewVisibleArea(fViewSizeX * fViewSizeY);
246 double fReduceFactor(1.0);
248 if(fViewVisibleArea > fMaximumVisibleArea)
250 fReduceFactor = sqrt(fMaximumVisibleArea / fViewVisibleArea);
251 fViewSizeX *= fReduceFactor;
252 fViewSizeY *= fReduceFactor;
260 const double fArea(fViewSizeX * fViewSizeY);
263 double fReducedVisualisationFactor(1.0 / (sqrt(fArea) * (1.0 / 170.0)));
265 if(fReducedVisualisationFactor > 1.0)
267 fReducedVisualisationFactor = 1.0;
269 else if(fReducedVisualisationFactor < 0.20)
271 fReducedVisualisationFactor = 0.20;
274 if(fReducedVisualisationFactor != 1.0)
276 fReduceFactor *= fReducedVisualisationFactor;
282 static const sal_uInt16 nDefaultOversampleValue(3);
306 if(!aUnitRangeTopLeft.
equal(aStandardNull) || !aUnitRangeXAxis.
equal(aStandardXAxis) || !aUnitRangeYAxis.
equal(aStandardYAxis))
313 aUnitRangeXAxis.
getX(), aUnitRangeYAxis.
getX(), aUnitRangeTopLeft.
getX(),
314 aUnitRangeXAxis.
getY(), aUnitRangeYAxis.
getY(), aUnitRangeTopLeft.
getY());
318 double fRotate, fShearX;
319 aUnitRangeToUser.
decompose(aScale, aTranslate, fRotate, fShearX);
326 aExtendedProjection.
scale(0.5, -0.5, 1.0);
327 aExtendedProjection.
translate(0.5, 0.5, 0.0);
330 aExtendedProjection.
scale(aScale.
getX(), aScale.
getY(), 1.0);
331 aExtendedProjection.
shearXZ(fShearX, 0.0);
332 aExtendedProjection.
rotate(0.0, 0.0, fRotate);
336 aExtendedProjection.
translate(-0.5, -0.5, 0.0);
337 aExtendedProjection.
scale(2.0, -2.0, 1.0);
362 if(!(nRasterWidth && nRasterHeight))
367 nOversampleValue ? nRasterWidth * nOversampleValue : nRasterWidth,
368 nOversampleValue ? nRasterHeight * nOversampleValue : nRasterHeight);
371 static bool bMultithreadAllowed =
false;
372 sal_Int32 nThreadCount(0);
375 if(bMultithreadAllowed)
383 nThreadCount = std::min(nThreadCount, nRasterHeight / 10);
392 std::unique_ptr<processor3d::ZBufferProcessor3D> mpZBufferProcessor3D;
397 std::shared_ptr<comphelper::ThreadTaskTag>
const & rTag,
398 std::unique_ptr<processor3d::ZBufferProcessor3D> pZBufferProcessor3D,
401 mpZBufferProcessor3D(std::move(pZBufferProcessor3D)),
402 mrChildren3D(rChildren3D)
406 virtual void doWork()
override
408 mpZBufferProcessor3D->process(mrChildren3D);
409 mpZBufferProcessor3D->finish();
410 mpZBufferProcessor3D.reset();
414 const sal_uInt32 nLinesPerThread(aBZPixelRaster.
getHeight() / nThreadCount);
417 for(sal_Int32
a(0);
a < nThreadCount;
a++)
429 a + 1 == nThreadCount ? aBZPixelRaster.
getHeight() : nLinesPerThread * (
a + 1)));
430 std::unique_ptr<Executor> pExecutor(
new Executor(aTag, std::move(pNewZBufferProcessor3D),
getChildren3D()));
431 rThreadPool.
pushTask(std::move(pExecutor));
452 aZBufferProcessor3D.
finish();
464 aNew2DTransform.
set(0, 0, aVisibleDiscreteRange.
getWidth());
465 aNew2DTransform.
set(1, 1, aVisibleDiscreteRange.
getHeight());
466 aNew2DTransform.
set(0, 2, aVisibleDiscreteRange.
getMinX());
467 aNew2DTransform.
set(1, 2, aVisibleDiscreteRange.
getMinY());
470 aNew2DTransform *= aInverseOToV;
473 rContainer.push_back(
479 static bool bAddOutlineToCreated3DSceneRepresentation(
false);
481 if(bAddOutlineToCreated3DSceneRepresentation)
531 aInverseSceneTransform.
invert();
570 : mxChildren3D(
std::move(aChildren3D)),
571 maSdrSceneAttribute(
std::move(aSdrSceneAttribute)),
572 maSdrLightingAttribute(
std::move(aSdrLightingAttribute)),
573 maObjectTransformation(
std::move(aObjectTransformation)),
574 maViewInformation3D(
std::move(aViewInformation3D)),
575 mbShadow3DChecked(false),
576 mfOldDiscreteSizeX(0.0),
577 mfOldDiscreteSizeY(0.0)
583 if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
617 aRetval.
expand(aShadow2DRange);
629 bool bNeedNewDecomposition(
false);
630 bool bDiscreteSizesAreCalculated(
false);
636 bDiscreteSizesAreCalculated =
true;
642 bNeedNewDecomposition =
true;
647 if(!bNeedNewDecomposition)
652 bNeedNewDecomposition =
true;
657 if(bNeedNewDecomposition)
665 if(!bDiscreteSizesAreCalculated)
void SetPrefMapMode(const MapMode &rPrefMapMode)
void SetPrefSize(const Size &rPrefSize)
sal_uInt8 GetAlpha(sal_Int32 nX, sal_Int32 nY) const
const Size & GetSizePixel() const
constexpr tools::Long getHeight() const
constexpr tools::Long Height() const
constexpr tools::Long getWidth() const
constexpr tools::Long Width() const
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void set3x2(double f_0x0, double f_0x1, double f_0x2, double f_1x0, double f_1x1, double f_1x2)
void set(sal_uInt16 nRow, sal_uInt16 nColumn, double fValue)
void translate(double fX, double fY)
void scale(double fX, double fY)
void transform(const basegfx::B2DHomMatrix &rMatrix)
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
void rotate(double fAngleX, double fAngleY, double fAngleZ)
void translate(double fX, double fY, double fZ)
void scale(double fX, double fY, double fZ)
void shearXZ(double fSx, double fSz)
sal_uInt32 getIndexFromXY(sal_uInt32 nX, sal_uInt32 nY) const
sal_uInt32 getWidth() const
sal_uInt32 getHeight() const
const BPixel & getBPixel(sal_uInt32 nIndex) const
void expand(const Tuple2D< TYPE > &rTuple)
void intersect(const Range2D &rRange)
bool isInside(const Tuple2D< TYPE > &rTuple) const
bool overlaps(const Range2D &rRange) const
bool equal(const Tuple2D< TYPE > &rTup) const
static ThreadPool & getSharedOptimalPool()
void waitUntilDone(const std::shared_ptr< ThreadTaskTag > &, bool bJoin=true)
static std::shared_ptr< ThreadTaskTag > createThreadTaskTag()
void pushTask(std::unique_ptr< ThreadTask > pTask)
sal_Int32 getWorkerCount() const
const ::std::vector< Sdr3DLightAttribute > & getLightVector() const
const Primitive2DContainer & getBuffered2DDecomposition() const
access methods to maBuffered2DDecomposition.
void setBuffered2DDecomposition(Primitive2DContainer &&rNew)
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
The getDecomposition default implementation will on demand use create2DDecomposition() if maBuffered2...
PolygonHairlinePrimitive2D class.
basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &aViewInformation) const
void append(const Primitive2DReference &)
const attribute::SdrSceneAttribute & getSdrSceneAttribute() const
virtual sal_uInt32 getPrimitive2DID() const override
provide unique ID
const geometry::ViewInformation3D & getViewInformation3D() const
attribute::SdrLightingAttribute maSdrLightingAttribute
lighting attribute set
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &rViewInformation) const override
get range
const primitive3d::Primitive3DContainer & getChildren3D() const
data read access
BitmapEx maOldRenderedBitmap
the last created BitmapEx, e.g.
bool mbShadow3DChecked
flag if given 3D geometry is already checked for shadow definitions and 2d shadows are created in maS...
Primitive2DContainer getGeometry2D() const
public helpers
Primitive2DContainer maShadowPrimitives
the primitiveSequence for on-demand created shadow primitives (see mbShadow3DChecked)
basegfx::B2DRange maOldUnitVisiblePart
bool tryToCheckLastVisualisationDirectHit(const basegfx::B2DPoint &rLogicHitPoint, bool &o_rResult) const
Fast HitTest which uses the last buffered BitmapEx from the last rendered area if available.
ScenePrimitive2D(primitive3d::Primitive3DContainer xChildren3D, attribute::SdrSceneAttribute aSdrSceneAttribute, attribute::SdrLightingAttribute aSdrLightingAttribute, basegfx::B2DHomMatrix aObjectTransformation, geometry::ViewInformation3D aViewInformation3D)
constructor
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
local decomposition.
const basegfx::B2DHomMatrix & getObjectTransformation() const
double mfOldDiscreteSizeX
the last used NewDiscreteSize and NewUnitVisiblePart definitions for decomposition
double mfOldDiscreteSizeY
bool impGetShadow3D() const
private helpers
const attribute::SdrLightingAttribute & getSdrLightingAttribute() const
void calculateDiscreteSizes(const geometry::ViewInformation2D &rViewInformation, basegfx::B2DRange &rDiscreteRange, basegfx::B2DRange &rVisibleDiscreteRange, basegfx::B2DRange &rUnitVisibleRange) const
Primitive2DContainer getShadow2D() const
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
get local decomposition. Override since this decomposition is view-dependent
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
compare operator
void process(const primitive3d::Primitive3DContainer &rSource)
Shadow3DExtractingProcessor class.
const primitive2d::Primitive2DContainer & getPrimitive2DSequence() const
data read access
This 3D renderer derived from DefaultProcessor3D renders all fed primitives to a 2D raster bitmap usi...
#define PRIMITIVE2D_ID_SCENEPRIMITIVE2D
sal_uInt32 GetQuadratic3DRenderLimit()
B2DPolygon const & createUnitPolygon()
B2IRange fround(const B2DRange &rRange)
BitmapEx CreateFromData(sal_uInt8 const *pData, sal_Int32 nWidth, sal_Int32 nHeight, sal_Int32 nStride, sal_Int8 nBitCount, bool bReversColors, bool bReverseAlpha)