2007-12-30 16:41:49 +00:00
|
|
|
#ifndef __GPICTURE_H
|
|
|
|
#define __GPICTURE_H
|
|
|
|
|
|
|
|
#include "widgets.h"
|
|
|
|
#include "gshare.h"
|
|
|
|
#include "gcolor.h"
|
|
|
|
#include "gtag.h"
|
|
|
|
|
|
|
|
class alphaCache;
|
|
|
|
|
|
|
|
class gPicture : public gShare
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum gPictureType
|
|
|
|
{
|
|
|
|
VOID,
|
|
|
|
MEMORY,
|
|
|
|
SERVER
|
|
|
|
};
|
|
|
|
|
|
|
|
gPicture();
|
|
|
|
gPicture(gPictureType type, int w, int h, bool trans);
|
|
|
|
~gPicture();
|
|
|
|
gPicture *copy();
|
|
|
|
|
|
|
|
bool isVoid() { return _type == VOID; }
|
|
|
|
|
|
|
|
static void assign(gPicture **dst, gPicture *src = 0) { gShare::assign((gShare **)dst, src); }
|
|
|
|
|
2008-01-23 19:56:18 +00:00
|
|
|
gPictureType type() const { return _type; }
|
|
|
|
int width() const { return _width; }
|
|
|
|
int height() const { return _height; }
|
2007-12-30 16:41:49 +00:00
|
|
|
int depth();
|
2008-01-23 19:56:18 +00:00
|
|
|
bool isTransparent() const { return _transparent; }
|
2007-12-30 16:41:49 +00:00
|
|
|
unsigned char *data();
|
|
|
|
|
|
|
|
void setTransparent(bool vl);
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
void resize(int width,int height);
|
[DEVELOPMENT ENVIRONMENT]
* BUG: Use TextEdit.RichText insted of TextEdit.Text.
* BUG: END SUB can be the end of a method. The class analyze now takes
that into account.
[HELP]
* BUG: Fixed the generated treeview.
[COMPILER]
* OPT: The NOT operator used just at the beginning of a conditional
expression is optimized. Consequently, an expression like 'IF NOT 2' is
now equivalent to 'IF 2 = 0' and not to 'IF (NOT 2) <> 0' as before. In
other words, the boolean conversion is now done before the NOT, and not
after. The following instructions are concerned: IF, WHILE, UNTIL.
* NEW: BYREF is new keyword that is a more readable synonymous of '@'.
[GB.DB.FORM]
* BUG: Correctly manage data controls inside TabStrip-like containers.
* BUG: Setting the focus on a non-initialized DataControl does not raise
an error anymore.
[GB.GTK]
* BUG: HSplitter.Layout and VSplitter.Layout now work correctly. It is a
list of children widths, hidden children having a zero width.
* BUG: Window arrangement is done before the Open event is raised, as in
gb.qt.
* BUG: Keyboard, focus and mouse events now work correctly on Window and
DrawingArea controls.
[GB.QT]
* BUG: HSplitter.Layout and VSplitter.Layout now work correctly. It is a
list of children widths, hidden children having a zero width.
* BUG: Many warning fixes.
* BUG: Now the Control.Visible property works like in gb.gtk, i.e. it
returns if the control was not explicitely hidden.
git-svn-id: svn://localhost/gambas/trunk@1060 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-02-06 00:25:48 +00:00
|
|
|
int save(const char *path, int quality = -1);
|
2007-12-30 16:41:49 +00:00
|
|
|
void fill(gColor col);
|
|
|
|
gPicture *copy(int x, int y, int w, int h);
|
|
|
|
|
|
|
|
gPicture *flip(bool mirror = false);
|
|
|
|
gPicture *mirror() { return flip(true); }
|
|
|
|
gPicture *rotate(double ang);
|
|
|
|
gPicture *stretch(int w, int h, bool smooth);
|
|
|
|
|
|
|
|
gColor getPixel(int x, int y);
|
|
|
|
void putPixel(int x, int y, gColor col);
|
|
|
|
void replace(gColor src, gColor dst, bool noteq = false);
|
|
|
|
void draw(gPicture *src, int x, int y, int w = -1, int h = -1, int sx = 0, int sy = 0, int sw = -1, int sh = -1);
|
2008-04-11 22:36:53 +00:00
|
|
|
void makeGray();
|
|
|
|
void makeTransparent(gColor color);
|
2007-12-30 16:41:49 +00:00
|
|
|
|
[DEVELOPMENT ENVIRONMENT]
* BUG: Use TextEdit.RichText insted of TextEdit.Text.
* BUG: END SUB can be the end of a method. The class analyze now takes
that into account.
[HELP]
* BUG: Fixed the generated treeview.
[COMPILER]
* OPT: The NOT operator used just at the beginning of a conditional
expression is optimized. Consequently, an expression like 'IF NOT 2' is
now equivalent to 'IF 2 = 0' and not to 'IF (NOT 2) <> 0' as before. In
other words, the boolean conversion is now done before the NOT, and not
after. The following instructions are concerned: IF, WHILE, UNTIL.
* NEW: BYREF is new keyword that is a more readable synonymous of '@'.
[GB.DB.FORM]
* BUG: Correctly manage data controls inside TabStrip-like containers.
* BUG: Setting the focus on a non-initialized DataControl does not raise
an error anymore.
[GB.GTK]
* BUG: HSplitter.Layout and VSplitter.Layout now work correctly. It is a
list of children widths, hidden children having a zero width.
* BUG: Window arrangement is done before the Open event is raised, as in
gb.qt.
* BUG: Keyboard, focus and mouse events now work correctly on Window and
DrawingArea controls.
[GB.QT]
* BUG: HSplitter.Layout and VSplitter.Layout now work correctly. It is a
list of children widths, hidden children having a zero width.
* BUG: Many warning fixes.
* BUG: Now the Control.Visible property works like in gb.gtk, i.e. it
returns if the control was not explicitely hidden.
git-svn-id: svn://localhost/gambas/trunk@1060 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-02-06 00:25:48 +00:00
|
|
|
static gPicture *fromNamedIcon(const char *name, int len = -1);
|
2007-12-30 16:41:49 +00:00
|
|
|
static gPicture *fromMemory(char *addr, unsigned int len);
|
|
|
|
|
|
|
|
//"Private"
|
|
|
|
GdkPixmap *pic;
|
|
|
|
GdkBitmap *mask;
|
|
|
|
GdkPixbuf *img;
|
|
|
|
|
|
|
|
gPictureType _type;
|
|
|
|
bool _transparent;
|
|
|
|
int _width;
|
|
|
|
int _height;
|
|
|
|
|
|
|
|
gPicture(GdkPixbuf *image, bool trans = true);
|
|
|
|
gPicture(GdkPixmap *pixmap);
|
|
|
|
void initialize();
|
|
|
|
GdkPixbuf *getPixbuf();
|
|
|
|
GdkPixmap *getPixmap();
|
|
|
|
GdkBitmap *getMask();
|
|
|
|
|
|
|
|
static gPicture* fromPixbuf(GdkPixbuf *buf) { return new gPicture(buf); }
|
|
|
|
|
|
|
|
// "Private"
|
|
|
|
void invalidate();
|
|
|
|
void createMask(bool white);
|
|
|
|
};
|
|
|
|
|
|
|
|
class gPictureCache
|
|
|
|
{
|
|
|
|
public:
|
[DEVELOPMENT ENVIRONMENT]
* BUG: Use TextEdit.RichText insted of TextEdit.Text.
* BUG: END SUB can be the end of a method. The class analyze now takes
that into account.
[HELP]
* BUG: Fixed the generated treeview.
[COMPILER]
* OPT: The NOT operator used just at the beginning of a conditional
expression is optimized. Consequently, an expression like 'IF NOT 2' is
now equivalent to 'IF 2 = 0' and not to 'IF (NOT 2) <> 0' as before. In
other words, the boolean conversion is now done before the NOT, and not
after. The following instructions are concerned: IF, WHILE, UNTIL.
* NEW: BYREF is new keyword that is a more readable synonymous of '@'.
[GB.DB.FORM]
* BUG: Correctly manage data controls inside TabStrip-like containers.
* BUG: Setting the focus on a non-initialized DataControl does not raise
an error anymore.
[GB.GTK]
* BUG: HSplitter.Layout and VSplitter.Layout now work correctly. It is a
list of children widths, hidden children having a zero width.
* BUG: Window arrangement is done before the Open event is raised, as in
gb.qt.
* BUG: Keyboard, focus and mouse events now work correctly on Window and
DrawingArea controls.
[GB.QT]
* BUG: HSplitter.Layout and VSplitter.Layout now work correctly. It is a
list of children widths, hidden children having a zero width.
* BUG: Many warning fixes.
* BUG: Now the Control.Visible property works like in gb.gtk, i.e. it
returns if the control was not explicitely hidden.
git-svn-id: svn://localhost/gambas/trunk@1060 867c0c6c-44f3-4631-809d-bfa615b0a4ec
2008-02-06 00:25:48 +00:00
|
|
|
static void put(const char *key, gPicture *img);
|
|
|
|
static gPicture *get(const char *key);
|
2007-12-30 16:41:49 +00:00
|
|
|
static void flush();
|
|
|
|
static void init();
|
|
|
|
static void exit();
|
|
|
|
private:
|
|
|
|
static GHashTable *cache;
|
|
|
|
};
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
|
|
|
class gPicture
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
gPicture(int w,int h,bool trans);
|
|
|
|
~gPicture();
|
|
|
|
|
|
|
|
int width();
|
|
|
|
int height();
|
|
|
|
int depth();
|
|
|
|
bool transparent();
|
|
|
|
|
|
|
|
void setTransparent(bool vl);
|
|
|
|
|
|
|
|
void resize(int width,int height);
|
|
|
|
int save(char *path);
|
|
|
|
void fromMemory(char *addr,unsigned int len);
|
|
|
|
static gPicture* fromNamedIcon(char* name);
|
|
|
|
void Fill(int col);
|
|
|
|
gPicture* getImage();
|
|
|
|
gPicture* copy(int x,int y,int w,int h);
|
|
|
|
|
|
|
|
void ref();
|
|
|
|
void unref();
|
|
|
|
|
|
|
|
//"Private"
|
|
|
|
GdkDrawable *pic;
|
|
|
|
alphaCache *cache;
|
|
|
|
int _transparent;
|
|
|
|
GdkPixbuf* getPixbuf();
|
|
|
|
static gPicture* fromPixbuf(GdkPixbuf *buf);
|
|
|
|
int refcount;
|
|
|
|
};
|
|
|
|
|
|
|
|
class gPictureCache
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
static void save(char *key,gPicture *img);
|
|
|
|
static gPicture* load(char *key);
|
|
|
|
static void flush();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|