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>
12 #include <vcl/gradient.hxx>
16 Bitmap
OutputDeviceTestGradient::setupLinearGradient()
18 initialSetup(12, 12, constBackgroundColor
);
20 Gradient
aGradient(GradientStyle::Linear
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
21 aGradient
.SetAngle(Degree10(900));
22 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
23 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
24 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
26 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
29 Bitmap
OutputDeviceTestGradient::setupLinearGradientAngled()
31 initialSetup(12, 12, constBackgroundColor
);
33 Gradient
aGradient(GradientStyle::Linear
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
34 aGradient
.SetAngle(Degree10(450));
35 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
36 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
37 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
39 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
42 Bitmap
OutputDeviceTestGradient::setupLinearGradientBorder()
44 initialSetup(12, 12, constBackgroundColor
);
46 Gradient
aGradient(GradientStyle::Linear
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
47 aGradient
.SetBorder(50);
48 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
49 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
50 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
52 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
55 Bitmap
OutputDeviceTestGradient::setupLinearGradientIntensity()
57 initialSetup(12, 12, constBackgroundColor
);
59 Gradient
aGradient(GradientStyle::Linear
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
60 aGradient
.SetStartIntensity(50);
61 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
62 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
63 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
65 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
68 Bitmap
OutputDeviceTestGradient::setupLinearGradientSteps()
70 initialSetup(12, 12, constBackgroundColor
);
72 Gradient
aGradient(GradientStyle::Linear
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
73 aGradient
.SetAngle(Degree10(900));
74 aGradient
.SetSteps(4);
75 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
76 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
77 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
79 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
82 Bitmap
OutputDeviceTestGradient::setupAxialGradient()
84 initialSetup(13, 13, constBackgroundColor
);
86 Gradient
aGradient(GradientStyle::Axial
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
87 aGradient
.SetAngle(Degree10(900));
88 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
89 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
90 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
92 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
95 Bitmap
OutputDeviceTestGradient::setupRadialGradient()
97 initialSetup(12, 12, constBackgroundColor
);
99 Gradient
aGradient(GradientStyle::Radial
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
100 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
101 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
102 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
104 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
107 Bitmap
OutputDeviceTestGradient::setupRadialGradientOfs()
109 initialSetup(12, 12, constBackgroundColor
);
111 Gradient
aGradient(GradientStyle::Radial
, Color(0xFF, 0xFF, 0xFF), Color(0x00, 0x00, 0x00));
112 aGradient
.SetOfsX(100); // Move center to the bottom-right corner.
113 aGradient
.SetOfsY(100);
114 tools::Rectangle
aDrawRect(maVDRectangle
.Left() + 1, maVDRectangle
.Top() + 1,
115 maVDRectangle
.Right() - 1, maVDRectangle
.Bottom() - 1);
116 mpVirtualDevice
->DrawGradient(aDrawRect
, aGradient
);
118 return mpVirtualDevice
->GetBitmap(maVDRectangle
.TopLeft(), maVDRectangle
.GetSize());
121 } // end namespace vcl::test
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */