2003-04-25 12:29:49 +00:00
|
|
|
// FbPixmap.hh for FbTk - Fluxbox ToolKit
|
2005-01-24 18:02:34 +00:00
|
|
|
// Copyright (c) 2003 Henrik Kinnunen (fluxgen at fluxbox dot org)
|
2003-04-25 12:29:49 +00:00
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
|
|
|
|
#ifndef FBTK_FBPIXMAP_HH
|
|
|
|
#define FBTK_FBPIXMAP_HH
|
|
|
|
|
2003-04-29 08:53:24 +00:00
|
|
|
#include "FbDrawable.hh"
|
2008-01-15 07:45:57 +00:00
|
|
|
#include "Orientation.hh"
|
2003-04-29 08:53:24 +00:00
|
|
|
|
2003-04-25 12:29:49 +00:00
|
|
|
namespace FbTk {
|
|
|
|
|
|
|
|
/// a wrapper for X Pixmap
|
2003-04-29 08:53:24 +00:00
|
|
|
class FbPixmap:public FbDrawable {
|
2008-01-14 22:27:00 +00:00
|
|
|
public:
|
2003-04-25 12:29:49 +00:00
|
|
|
FbPixmap();
|
2008-01-14 22:27:00 +00:00
|
|
|
/// copy pixmap
|
2004-04-26 21:57:32 +00:00
|
|
|
FbPixmap(const FbPixmap ©);
|
2003-04-27 00:12:17 +00:00
|
|
|
/// creates a FbPixmap from X pixmap
|
|
|
|
explicit FbPixmap(Pixmap pm);
|
2008-01-14 22:27:00 +00:00
|
|
|
FbPixmap(const FbDrawable &src,
|
2004-01-11 12:48:46 +00:00
|
|
|
unsigned int width, unsigned int height,
|
2006-04-16 11:18:22 +00:00
|
|
|
unsigned int depth);
|
2008-01-14 22:27:00 +00:00
|
|
|
FbPixmap(Drawable src,
|
2003-04-25 12:29:49 +00:00
|
|
|
unsigned int width, unsigned int height,
|
2006-04-16 11:18:22 +00:00
|
|
|
unsigned int depth);
|
2003-04-27 00:12:17 +00:00
|
|
|
|
2004-01-11 12:48:46 +00:00
|
|
|
virtual ~FbPixmap();
|
2003-04-27 00:12:17 +00:00
|
|
|
|
2003-04-25 12:29:49 +00:00
|
|
|
void copy(const FbPixmap &the_copy);
|
2006-04-16 11:18:22 +00:00
|
|
|
void copy(Pixmap pixmap, unsigned int depth_convert, int screen_num);
|
2006-03-26 04:02:30 +00:00
|
|
|
/// rotates the pixmap to specified orientation (assumes ROT0 now)
|
|
|
|
void rotate(FbTk::Orientation orient);
|
2003-04-27 23:55:08 +00:00
|
|
|
/// scales the pixmap to specified size
|
|
|
|
void scale(unsigned int width, unsigned int height);
|
2003-09-10 21:28:13 +00:00
|
|
|
void resize(unsigned int width, unsigned int height);
|
2004-07-05 23:51:57 +00:00
|
|
|
/// tiles the pixmap to specified size
|
|
|
|
void tile(unsigned int width, unsigned int height);
|
2003-04-27 23:55:08 +00:00
|
|
|
/// drops pixmap and returns it
|
|
|
|
Pixmap release();
|
2003-04-27 00:12:17 +00:00
|
|
|
|
2003-04-25 12:29:49 +00:00
|
|
|
FbPixmap &operator = (const FbPixmap ©);
|
2003-04-27 00:12:17 +00:00
|
|
|
/// sets new pixmap
|
|
|
|
FbPixmap &operator = (Pixmap pm);
|
2003-04-25 12:29:49 +00:00
|
|
|
|
2007-12-29 21:38:53 +00:00
|
|
|
Drawable drawable() const { return m_pm; }
|
|
|
|
unsigned int width() const { return m_width; }
|
|
|
|
unsigned int height() const { return m_height; }
|
|
|
|
unsigned int depth() const { return m_depth; }
|
2003-04-25 12:29:49 +00:00
|
|
|
|
2006-02-12 08:04:31 +00:00
|
|
|
static Pixmap getRootPixmap(int screen_num, bool force_update=false);
|
2007-07-03 18:50:53 +00:00
|
|
|
static bool setRootPixmap(int screen_num, Pixmap pm);
|
|
|
|
static bool rootwinPropertyNotify(int screen_num, Atom atom);
|
2003-04-27 23:55:08 +00:00
|
|
|
|
2003-04-25 12:29:49 +00:00
|
|
|
void create(Drawable src,
|
|
|
|
unsigned int width, unsigned int height,
|
2006-04-16 11:18:22 +00:00
|
|
|
unsigned int depth);
|
2005-04-02 14:59:38 +00:00
|
|
|
|
2006-06-24 13:11:27 +00:00
|
|
|
/* Will be reset to false whenever this pixmap is reassigned */
|
|
|
|
void dontFree() { m_dont_free = true; }
|
|
|
|
|
2005-04-02 14:59:38 +00:00
|
|
|
private:
|
|
|
|
void free();
|
2006-06-24 13:11:27 +00:00
|
|
|
|
2003-04-25 12:29:49 +00:00
|
|
|
Pixmap m_pm;
|
|
|
|
unsigned int m_width, m_height;
|
2006-04-16 11:18:22 +00:00
|
|
|
unsigned int m_depth;
|
2005-05-10 16:29:00 +00:00
|
|
|
|
2006-06-24 13:11:27 +00:00
|
|
|
// if pixmap not *owned* by this object (eg assigned from cache object)
|
|
|
|
bool m_dont_free;
|
|
|
|
|
2003-04-25 12:29:49 +00:00
|
|
|
};
|
|
|
|
|
2003-12-16 17:06:52 +00:00
|
|
|
} // end namespace FbTk
|
2003-04-25 12:29:49 +00:00
|
|
|
|
|
|
|
#endif // FBTK_FBPIXMAP_HH
|
|
|
|
|