vclprocessor2d.cxx (7be6ee6d) vclprocessor2d.cxx (025b0597)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 1390 unchanged lines hidden (view full) ---

1399 {
1400 const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
1401 const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
1402 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1403
1404 // use color distance and discrete lengths to calculate step count
1405 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDelta, fDiscreteUnit));
1406
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 1390 unchanged lines hidden (view full) ---

1399 {
1400 const basegfx::BColor aColorA(maBColorModifierStack.getModifiedColor(rCandidate.getColorA()));
1401 const basegfx::BColor aColorB(maBColorModifierStack.getModifiedColor(rCandidate.getColorB()));
1402 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1403
1404 // use color distance and discrete lengths to calculate step count
1405 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDelta, fDiscreteUnit));
1406
1407 // prepare loop and polygon
1408 double fStart(0.0);
1409 double fStep(fDelta / nSteps);
1407 // switch off line painting
1408 mpOutputDevice->SetLineColor();
1409
1410 // prepare polygon in needed width at start position (with discrete overlap)
1410 const basegfx::B2DPolygon aPolygon(
1411 basegfx::tools::createPolygonFromRect(
1412 basegfx::B2DRange(
1413 rCandidate.getOffsetA() - fDiscreteUnit,
1414 0.0,
1411 const basegfx::B2DPolygon aPolygon(
1412 basegfx::tools::createPolygonFromRect(
1413 basegfx::B2DRange(
1414 rCandidate.getOffsetA() - fDiscreteUnit,
1415 0.0,
1415 rCandidate.getOffsetA() + fStep + fDiscreteUnit,
1416 rCandidate.getOffsetA() + (fDelta / nSteps) + fDiscreteUnit,
1416 1.0)));
1417
1417 1.0)));
1418
1418 // switch off line painting
1419 mpOutputDevice->SetLineColor();
1420
1419
1420 // prepare loop ([0.0 .. 1.0[)
1421 double fUnitScale(0.0);
1422 const double fUnitStep(1.0 / nSteps);
1423
1421 // loop and paint
1424 // loop and paint
1422 for(sal_uInt32 a(0); a < nSteps; a++, fStart += fStep)
1425 for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep)
1423 {
1424 basegfx::B2DPolygon aNew(aPolygon);
1425
1426 {
1427 basegfx::B2DPolygon aNew(aPolygon);
1428
1426 aNew.transform(maCurrentTransformation * basegfx::tools::createTranslateB2DHomMatrix(fStart, 0.0));
1427 mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorA, aColorB, fStart/fDelta)));
1429 aNew.transform(maCurrentTransformation * basegfx::tools::createTranslateB2DHomMatrix(fDelta * fUnitScale, 0.0));
1430 mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorA, aColorB, fUnitScale)));
1428 mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1429 }
1430 }
1431 }
1432
1433 void VclProcessor2D::RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate)
1434 {
1435 const double fDeltaScale(rCandidate.getScaleB() - rCandidate.getScaleA());

--- 5 unchanged lines hidden (view full) ---

1441 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1442
1443 // use color distance and discrete lengths to calculate step count
1444 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDeltaScale, fDiscreteUnit));
1445
1446 // switch off line painting
1447 mpOutputDevice->SetLineColor();
1448
1431 mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1432 }
1433 }
1434 }
1435
1436 void VclProcessor2D::RenderSvgRadialAtomPrimitive2D(const primitive2d::SvgRadialAtomPrimitive2D& rCandidate)
1437 {
1438 const double fDeltaScale(rCandidate.getScaleB() - rCandidate.getScaleA());

--- 5 unchanged lines hidden (view full) ---

1444 const double fDiscreteUnit((getViewInformation2D().getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength());
1445
1446 // use color distance and discrete lengths to calculate step count
1447 const sal_uInt32 nSteps(calculateStepsForSvgGradient(aColorA, aColorB, fDeltaScale, fDiscreteUnit));
1448
1449 // switch off line painting
1450 mpOutputDevice->SetLineColor();
1451
1449 // prepare loop (outside to inside)
1450 double fEndScale(rCandidate.getScaleB());
1451 double fStepScale(fDeltaScale / nSteps);
1452 // prepare loop ([0.0 .. 1.0[, full polygons, no polypolygons with holes)
1453 double fUnitScale(0.0);
1454 const double fUnitStep(1.0 / nSteps);
1452
1455
1453 for(sal_uInt32 a(0); a < nSteps; a++, fEndScale -= fStepScale)
1456 for(sal_uInt32 a(0); a < nSteps; a++, fUnitScale += fUnitStep)
1454 {
1457 {
1455 const double fUnitScale(fEndScale/fDeltaScale);
1456 basegfx::B2DHomMatrix aTransform;
1458 basegfx::B2DHomMatrix aTransform;
1459 const double fEndScale(rCandidate.getScaleB() - (fDeltaScale * fUnitScale));
1457
1458 if(rCandidate.isTranslateSet())
1459 {
1460 const basegfx::B2DVector aTranslate(
1461 basegfx::interpolate(
1460
1461 if(rCandidate.isTranslateSet())
1462 {
1463 const basegfx::B2DVector aTranslate(
1464 basegfx::interpolate(
1462 rCandidate.getTranslateA(),
1463 rCandidate.getTranslateB(),
1465 rCandidate.getTranslateB(),
1466 rCandidate.getTranslateA(),
1464 fUnitScale));
1465
1466 aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(
1467 fEndScale,
1468 fEndScale,
1469 aTranslate.getX(),
1470 aTranslate.getY());
1471 }
1472 else
1473 {
1474 aTransform = basegfx::tools::createScaleB2DHomMatrix(
1475 fEndScale,
1476 fEndScale);
1477 }
1478
1479 basegfx::B2DPolygon aNew(basegfx::tools::createPolygonFromUnitCircle());
1480
1481 aNew.transform(maCurrentTransformation * aTransform);
1467 fUnitScale));
1468
1469 aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix(
1470 fEndScale,
1471 fEndScale,
1472 aTranslate.getX(),
1473 aTranslate.getY());
1474 }
1475 else
1476 {
1477 aTransform = basegfx::tools::createScaleB2DHomMatrix(
1478 fEndScale,
1479 fEndScale);
1480 }
1481
1482 basegfx::B2DPolygon aNew(basegfx::tools::createPolygonFromUnitCircle());
1483
1484 aNew.transform(maCurrentTransformation * aTransform);
1482 mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorA, aColorB, fUnitScale)));
1485 mpOutputDevice->SetFillColor(Color(basegfx::interpolate(aColorB, aColorA, fUnitScale)));
1483 mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1484 }
1485 }
1486 }
1487
1488 void VclProcessor2D::adaptLineToFillDrawMode() const
1489 {
1490 const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());

--- 152 unchanged lines hidden ---
1486 mpOutputDevice->DrawPolyPolygon(basegfx::B2DPolyPolygon(aNew));
1487 }
1488 }
1489 }
1490
1491 void VclProcessor2D::adaptLineToFillDrawMode() const
1492 {
1493 const sal_uInt32 nOriginalDrawMode(mpOutputDevice->GetDrawMode());

--- 152 unchanged lines hidden ---