2
* Copyright 2007 Simone Della Longa <simonedll@yahoo.it>
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
#include "background.h"
22
//get the currently used background
23
wxBitmap* getRootWallpaper()
25
wxBitmap* backImage = new wxBitmap();
26
WnckScreen *screen = wnck_screen_get_default ();
28
Pixmap pm = wnck_screen_get_background_pixmap(screen);
36
pm = wnck_screen_get_background_pixmap(screen);
42
gdk_pixmap_foreign_new(
47
wxSize sz = wxGetDisplaySize();
48
backImage = new wxBitmap (sz.GetWidth(), sz.GetHeight());
50
dc.SelectObject(*backImage);
51
dc.SetBackground(*wxTRANSPARENT_BRUSH);
53
dc.SelectObject(*backImage);
58
wxBitmap *fixImage (wxString url, int type, wxColour c)
63
wxImage img = wxImage (url);
64
wxSize sz = wxGetDisplaySize();
65
int w = sz.GetWidth();
66
int h = sz.GetHeight();
67
printf ("Image size:%d,%d Screen size:%d,%d\n", img.GetWidth (),
68
img.GetHeight (), w, h);
69
// cout << wx2std(c.GetAsString(wxC2S_HTML_SYNTAX)) <<endl;
73
return new wxBitmap (img.Scale (w, h, wxIMAGE_QUALITY_HIGH));
77
if (img.GetWidth () > w)
80
x = (w - img.GetWidth ()) / 2;
81
if (img.GetHeight () > h)
84
y = (h - img.GetHeight ()) / 2;
87
img.Resize (wxSize (w, h), wxPoint (x, y), c.Red (), c.Green (),
89
return new wxBitmap (img);
92
return new wxBitmap (img);