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 
37 void 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  {
49  // Some of these are probably wrong (e.g. if the gradient has transparency),
50  // but hopefully nobody uses that. If you do, feel free to implement it properly.
51  if( rBackground.GetStyle() == WallpaperStyle::NONE )
52  {
53  mpAlphaVDev->SetBackground( rBackground );
54  }
55  else if( rBackground.IsBitmap())
56  {
57  BitmapEx bitmap = rBackground.GetBitmap();
58  if( bitmap.IsAlpha())
60  else
62  }
63  else if( rBackground.IsGradient())
64  {
66  }
67  else
68  {
69  // Color background.
70  int transparency = 255 - rBackground.GetColor().GetAlpha();
71  mpAlphaVDev->SetBackground( Wallpaper( Color( transparency, transparency, transparency )));
72  }
73  }
74 }
75 
76 
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
const Wallpaper & GetBackground() const
Definition: outdev.hxx:518
sal_uInt8 GetAlpha() const
WallpaperStyle GetStyle() const
Definition: wall.hxx:74
void SetBackground()
Definition: background.cxx:27
bool IsAlpha() const
Definition: BitmapEx.cxx:193
bool mbBackground
Definition: outdev.hxx:240
Wallpaper maBackground
Definition: outdev.hxx:231
const Color & GetColor() const
Definition: wall.hxx:71
virtual Color GetBackgroundColor() const
Definition: background.cxx:22
VclPtr< VirtualDevice > mpAlphaVDev
Definition: outdev.hxx:194
bool IsGradient() const
Definition: wall.cxx:213
AlphaMask GetAlpha() const
Definition: BitmapEx.cxx:215
const BitmapEx & GetBitmap() const
Definition: wall.cxx:184
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
bool IsBitmap() const
Definition: wall.cxx:189