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/.
11 #include <test/outputdevice.hxx>
19 void drawLineOffset(OutputDevice
& rDevice
, tools::Rectangle
const & rRect
, int nOffset
)
21 Point
aLeftTop (rRect
.Left() + nOffset
, rRect
.Top() + nOffset
);
22 Point
aRightTop (rRect
.Right() - nOffset
, rRect
.Top() + nOffset
);
23 Point
aLeftBottom (rRect
.Left() + nOffset
, rRect
.Bottom() - nOffset
);
24 Point
aRightBottom (rRect
.Right() - nOffset
, rRect
.Bottom() - nOffset
);
26 rDevice
.DrawLine(aLeftTop
, aRightTop
);
27 rDevice
.DrawLine(aRightTop
, aRightBottom
);
28 rDevice
.DrawLine(aRightBottom
, aLeftBottom
);
29 rDevice
.DrawLine(aLeftBottom
, aLeftTop
);
32 } // end anonymous namespace
34 Bitmap
OutputDeviceTestLine::setupRectangle(bool bEnableAA
)
36 initialSetup(13, 13, constBackgroundColor
, bEnableAA
);
38 mpVirtualDevice
->SetLineColor(constLineColor
);
39 mpVirtualDevice
->SetFillColor();
41 drawLineOffset(*mpVirtualDevice
, maVDRectangle
, 2);
42 drawLineOffset(*mpVirtualDevice
, maVDRectangle
, 5);
44 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
47 Bitmap
OutputDeviceTestLine::setupDiamond()
49 initialSetup(11, 11, constBackgroundColor
);
51 mpVirtualDevice
->SetLineColor(constFillColor
);
52 mpVirtualDevice
->SetFillColor();
54 Point aPoint1
, aPoint2
, aPoint3
, aPoint4
;
55 OutputDeviceTestCommon::createDiamondPoints(maVDRectangle
, 4, aPoint1
, aPoint2
, aPoint3
, aPoint4
);
57 mpVirtualDevice
->DrawLine(aPoint1
, aPoint2
);
58 mpVirtualDevice
->DrawLine(aPoint2
, aPoint3
);
59 mpVirtualDevice
->DrawLine(aPoint3
, aPoint4
);
60 mpVirtualDevice
->DrawLine(aPoint4
, aPoint1
);
62 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
65 Bitmap
OutputDeviceTestLine::setupLines()
67 initialSetup(13, 13, constBackgroundColor
);
69 mpVirtualDevice
->SetLineColor(constLineColor
);
70 mpVirtualDevice
->SetFillColor();
72 Point aHorizontalLinePoint1
, aHorizontalLinePoint2
;
73 Point aVerticalLinePoint1
, aVerticalLinePoint2
;
74 Point aDiagonalLinePoint1
, aDiagonalLinePoint2
;
76 OutputDeviceTestCommon::createHorizontalVerticalDiagonalLinePoints(
77 maVDRectangle
, aHorizontalLinePoint1
, aHorizontalLinePoint2
,
78 aVerticalLinePoint1
, aVerticalLinePoint2
,
79 aDiagonalLinePoint1
, aDiagonalLinePoint2
);
81 mpVirtualDevice
->DrawLine(aHorizontalLinePoint1
, aHorizontalLinePoint2
);
82 mpVirtualDevice
->DrawLine(aVerticalLinePoint1
, aVerticalLinePoint2
);
83 mpVirtualDevice
->DrawLine(aDiagonalLinePoint1
, aDiagonalLinePoint2
);
85 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
88 Bitmap
OutputDeviceTestLine::setupAALines()
90 initialSetup(13, 13, constBackgroundColor
);
92 mpVirtualDevice
->SetAntialiasing(AntialiasingFlags::EnableB2dDraw
);
93 mpVirtualDevice
->SetLineColor(constLineColor
);
94 mpVirtualDevice
->SetFillColor();
96 Point aHorizontalLinePoint1
, aHorizontalLinePoint2
;
97 Point aVerticalLinePoint1
, aVerticalLinePoint2
;
98 Point aDiagonalLinePoint1
, aDiagonalLinePoint2
;
100 OutputDeviceTestCommon::createHorizontalVerticalDiagonalLinePoints(
101 maVDRectangle
, aHorizontalLinePoint1
, aHorizontalLinePoint2
,
102 aVerticalLinePoint1
, aVerticalLinePoint2
,
103 aDiagonalLinePoint1
, aDiagonalLinePoint2
);
105 mpVirtualDevice
->DrawLine(aHorizontalLinePoint1
, aHorizontalLinePoint2
);
106 mpVirtualDevice
->DrawLine(aVerticalLinePoint1
, aVerticalLinePoint2
);
107 mpVirtualDevice
->DrawLine(aDiagonalLinePoint1
, aDiagonalLinePoint2
);
109 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
112 }} // end namespace vcl::test
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */