Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
81
Src/Wasabi/api/wnd/platform/win32/bitmap.h
Normal file
81
Src/Wasabi/api/wnd/platform/win32/bitmap.h
Normal file
|
@ -0,0 +1,81 @@
|
|||
//NONPORTABLE
|
||||
#ifndef _BITMAP_H
|
||||
#define _BITMAP_H
|
||||
|
||||
//#include <wasabicfg.h>
|
||||
//#include <bfc/common.h>
|
||||
#include <bfc/string/string.h>
|
||||
#include <bfc/string/StringW.h>
|
||||
|
||||
class ifc_canvas; // see canvas.h
|
||||
|
||||
//#define NO_MMX
|
||||
|
||||
class api_region;
|
||||
|
||||
// a skinnable bitmap
|
||||
class SkinBitmap
|
||||
{
|
||||
public:
|
||||
#ifndef _NOSTUDIO
|
||||
#ifdef WASABI_COMPILE_IMGLDR
|
||||
#ifdef _WIN32
|
||||
SkinBitmap(HINSTANCE hInst, int _id, const wchar_t *colorgroup = NULL); //NONPORTABLE
|
||||
#endif
|
||||
SkinBitmap(const wchar_t *elementname, int cached = 1);
|
||||
#endif
|
||||
#endif
|
||||
// SkinBitmap(SkinBitmap *source, int w, int h);
|
||||
SkinBitmap(int w, int h, ARGB32 bgcolor = RGBA(255,255,255,255)); //untested --BU
|
||||
#ifdef _WIN32
|
||||
SkinBitmap(HBITMAP bitmap);
|
||||
SkinBitmap(HBITMAP bitmap, HDC dc, int has_alpha = 0, void *bits = NULL);
|
||||
#endif
|
||||
SkinBitmap(ARGB32 *bits, int w, int h); // added by benski, use if you have raw image bits
|
||||
~SkinBitmap();
|
||||
|
||||
int getWidth() const { return subimage_w == -1 ? fullimage_w : subimage_w; };
|
||||
int getHeight() const { return subimage_h == -1 ? fullimage_h : subimage_h; };
|
||||
int getFullWidth() const { return fullimage_w; };
|
||||
int getFullHeight() const { return fullimage_h; };
|
||||
int getX() const { return x_offset == -1 ? 0 : x_offset; };
|
||||
int getY() const { return y_offset == -1 ? 0 : y_offset; };
|
||||
int getBpp() const { return 32; };
|
||||
int getAlpha() const { return has_alpha; };
|
||||
void setHasAlpha(int ha);
|
||||
virtual void *getBits();
|
||||
int isInvalid();
|
||||
|
||||
const wchar_t *getBitmapName();
|
||||
|
||||
void blit(ifc_canvas *canvas, int x, int y);
|
||||
void blitAlpha(ifc_canvas *canvas, int x, int y, int alpha = 255);
|
||||
// blits a chunk of source into dest rect
|
||||
void blitToRect(ifc_canvas *canvas, RECT *src, RECT *dst, int alpha = 255);
|
||||
void blitTile(ifc_canvas *canvas, RECT *dest, int xoffs = 0, int yoffs = 0, int alpha = 255);
|
||||
void blitRectToTile(ifc_canvas *canvas, RECT *dest, RECT *src, int xoffs = 0, int yoffs = 0, int alpha = 255);
|
||||
void stretch(ifc_canvas *canvas, int x, int y, int w, int h);
|
||||
void stretchToRect(ifc_canvas *canvas, RECT *r);
|
||||
void stretchRectToRect(ifc_canvas *canvas, RECT *src, RECT *dst);
|
||||
|
||||
void stretchToRectAlpha(ifc_canvas *canvas, RECT *r, int alpha = 255);
|
||||
void stretchToRectAlpha(ifc_canvas *canvas, RECT *src, RECT *dst, int alpha = 255);
|
||||
ARGB32 getPixel(int x, int y);
|
||||
|
||||
private:
|
||||
#ifdef _WIN32
|
||||
void bmpToBits(HBITMAP hbmp, HDC defaultDC = NULL);
|
||||
#endif
|
||||
|
||||
int has_alpha;
|
||||
|
||||
int x_offset, y_offset, subimage_w, subimage_h, fullimage_w, fullimage_h;
|
||||
|
||||
ARGB32 *bits;
|
||||
int ownbits;
|
||||
int last_failed;
|
||||
StringW bitmapname;
|
||||
int fromskin;
|
||||
};
|
||||
|
||||
#endif
|
1
Src/Wasabi/api/wnd/platform/win32/canvas.h
Normal file
1
Src/Wasabi/api/wnd/platform/win32/canvas.h
Normal file
|
@ -0,0 +1 @@
|
|||
#include <tataki/canvas/win/canvas.h>
|
135
Src/Wasabi/api/wnd/platform/win32/region.h
Normal file
135
Src/Wasabi/api/wnd/platform/win32/region.h
Normal file
|
@ -0,0 +1,135 @@
|
|||
#ifndef __REGION_H
|
||||
#define __REGION_H
|
||||
|
||||
#include <api/wnd/bitmap.h>
|
||||
#include <bfc/dispatch.h>
|
||||
|
||||
class BaseWnd;
|
||||
class Canvas;
|
||||
class api_region;
|
||||
class RegionServer;
|
||||
|
||||
#include "api_region.h"
|
||||
|
||||
class RegionI : public api_region
|
||||
{
|
||||
public:
|
||||
RegionI();
|
||||
RegionI(const RegionI *copy);
|
||||
RegionI(const RECT *r);
|
||||
RegionI(int l, int t, int r, int b);
|
||||
RegionI(OSREGIONHANDLE region);
|
||||
RegionI(SkinBitmap *bitmap, RECT *r=NULL, int xoffset=0, int yoffset=0, bool inverted=false, int dothreshold=0, __int8 threshold=0, int threversed=0, int minalpha=1);
|
||||
RegionI(Canvas *c, RECT *defboundbox=NULL);
|
||||
virtual ~RegionI();
|
||||
|
||||
api_region *clone();
|
||||
void disposeClone(api_region *r);
|
||||
bool ptInRegion(const POINT *pt);
|
||||
void offset(int x, int y);
|
||||
void getBox(RECT *r);
|
||||
void subtractRegion(const api_region *reg);
|
||||
void subtractRect(const RECT *r);
|
||||
void addRect(const RECT *r);
|
||||
void addRegion(const api_region *r);
|
||||
void andRegion(const api_region *r);
|
||||
void setRect(const RECT *r);
|
||||
void empty();
|
||||
int isEmpty();
|
||||
int equals(const api_region *r);
|
||||
int enclosed(const api_region *r, api_region *outside=NULL);
|
||||
int intersectRgn(const api_region *r, api_region *intersection);
|
||||
int doesIntersectRgn(const api_region *r);
|
||||
int intersectRect(const RECT *r, api_region *intersection);
|
||||
int doesIntersectRect(const RECT *r);
|
||||
int isRect();
|
||||
void scale(double sx, double sy, bool round=0);
|
||||
void debug(int async=0);
|
||||
|
||||
// NONPORTABLE
|
||||
|
||||
OSREGIONHANDLE makeWindowRegion(); // gives you a handle to a clone of the OSREGION object so you can insert it into a window's region with SetWindowRgn. ANY other use is prohibited
|
||||
OSREGIONHANDLE getOSHandle(); // avoid as much as you can, should be used only by WIN32-dependant classes
|
||||
|
||||
// END NONPORTABLE
|
||||
|
||||
int getNumRects();
|
||||
int enumRect(int n, RECT *r);
|
||||
|
||||
OSREGIONHANDLE alphaToRegionRect(void *pbits32, int bmX, int bmY, int bmWidth, int bmHeight, int fullw, int fullh, int xoffset, int yoffset, bool portion, int _x, int _y, int _w, int _h, bool inverted, int dothreshold, unsigned __int8 threshold, int thinverse, int minalpha);
|
||||
|
||||
private:
|
||||
|
||||
inline void init();
|
||||
void optimize();
|
||||
void deoptimize();
|
||||
|
||||
OSREGIONHANDLE hrgn;
|
||||
OSREGIONHANDLE alphaToRegionRect(SkinBitmap *bitmap, int xoffset, int yoffset, bool portion, int _x, int _y, int _w, int _h, bool inverted=false, int dothreshold=0, unsigned __int8 threshold=0, int thinverse=0, int minalpha=1/* 1..255*/);
|
||||
RECT overlay;
|
||||
int clonecount;
|
||||
RegionI *lastdebug;
|
||||
RegionServer *srv;
|
||||
RECT optrect;
|
||||
int optimized;
|
||||
|
||||
protected:
|
||||
|
||||
RECVS_DISPATCH;
|
||||
};
|
||||
|
||||
class RegionServer : public Dispatchable {
|
||||
|
||||
protected:
|
||||
RegionServer() {}
|
||||
virtual ~RegionServer() {}
|
||||
|
||||
public:
|
||||
|
||||
void addRef(void *client);
|
||||
void delRef(void *client);
|
||||
api_region *getRegion();
|
||||
|
||||
enum {
|
||||
REGIONSERVER_ADDREF = 500,
|
||||
REGIONSERVER_DELREF = 550,
|
||||
REGIONSERVER_GETREGION = 600,
|
||||
};
|
||||
};
|
||||
|
||||
inline void RegionServer::addRef(void *client) {
|
||||
_voidcall(REGIONSERVER_ADDREF, (api_region *)NULL, client);
|
||||
}
|
||||
|
||||
inline void RegionServer::delRef(void *client) {
|
||||
_voidcall(REGIONSERVER_DELREF, client);
|
||||
}
|
||||
|
||||
inline api_region * RegionServer::getRegion() {
|
||||
return _call(REGIONSERVER_GETREGION, (api_region *)NULL);
|
||||
}
|
||||
|
||||
class RegionServerI : public RegionServer {
|
||||
public :
|
||||
|
||||
RegionServerI() { numrefs = 0; }
|
||||
virtual ~RegionServerI() {}
|
||||
|
||||
virtual void addRef(void *client) { numrefs++; }
|
||||
virtual void delRef(void *client) { numrefs--; }
|
||||
virtual api_region *getRegion()=0;
|
||||
|
||||
virtual int getNumRefs() { return numrefs; }
|
||||
|
||||
protected:
|
||||
|
||||
RECVS_DISPATCH;
|
||||
|
||||
private:
|
||||
|
||||
int numrefs;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue