LibreOffice Module vcl (master) 1
background.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <vcl/virdev.hxx>
21
23{
24 return GetBackground().GetColor();
25}
26
28{
29
31 mbBackground = false;
32
33 if( mpAlphaVDev )
35}
36
37void OutputDevice::SetBackground( const Wallpaper& rBackground )
38{
39
40 maBackground = rBackground;
41
42 if( rBackground.GetStyle() == WallpaperStyle::NONE )
43 mbBackground = false;
44 else
45 mbBackground = true;
46
47 if( !mpAlphaVDev )
48 return;
49
50 // Some of these are probably wrong (e.g. if the gradient has transparency),
51 // but hopefully nobody uses that. If you do, feel free to implement it properly.
52 if( rBackground.GetStyle() == WallpaperStyle::NONE )
53 {
54 mpAlphaVDev->SetBackground( rBackground );
55 }
56 else if( rBackground.IsBitmap())
57 {
58 BitmapEx bitmap = rBackground.GetBitmap();
59 if( bitmap.IsAlpha())
61 else
63 }
64 else if( rBackground.IsGradient())
65 {
67 }
68 else
69 {
70 // Color background.
71 int transparency = 255 - rBackground.GetColor().GetAlpha();
72 mpAlphaVDev->SetBackground( Wallpaper( Color( transparency, transparency, transparency )));
73 }
74}
75
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
AlphaMask GetAlpha() const
Definition: BitmapEx.cxx:215
bool IsAlpha() const
Definition: BitmapEx.cxx:193
sal_uInt8 GetAlpha() const
virtual Color GetBackgroundColor() const
Definition: background.cxx:22
const Wallpaper & GetBackground() const
Definition: outdev.hxx:524
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:197
bool mbBackground
Definition: outdev.hxx:243
void SetBackground()
Definition: background.cxx:27
Wallpaper maBackground
Definition: outdev.hxx:234
const BitmapEx & GetBitmap() const
Definition: wall.cxx:184
const Color & GetColor() const
Definition: wall.hxx:71
bool IsBitmap() const
Definition: wall.cxx:189
WallpaperStyle GetStyle() const
Definition: wall.hxx:74
bool IsGradient() const
Definition: wall.cxx:213
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)