[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Enigma-cvs] enigma/src/px video.hh,1.7,1.8
From: |
Daniel Heck <address@hidden> |
Subject: |
[Enigma-cvs] enigma/src/px video.hh,1.7,1.8 |
Date: |
Wed, 26 Nov 2003 08:21:50 +0000 |
Update of /cvsroot/enigma/enigma/src/px
In directory subversions:/tmp/cvs-serv10777/src/px
Modified Files:
video.hh
Log Message:
- px::Grab returns grabbed area.
- Added MakeSurfaceLike()
Index: video.hh
===================================================================
RCS file: /cvsroot/enigma/enigma/src/px/video.hh,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** video.hh 19 Nov 2003 16:22:38 -0000 1.7
--- video.hh 26 Nov 2003 08:21:48 -0000 1.8
***************
*** 26,34 ****
#include "SDL.h"
- //----------------------------------------
- // Colors
- //----------------------------------------
namespace px
{
struct RGBA_Mask
{
--- 26,34 ----
#include "SDL.h"
namespace px
{
+
+ /* -------------------- Colors -------------------- */
+
struct RGBA_Mask
{
***************
*** 56,64 ****
typedef Uint32 PackedColor;
- }
- namespace px
- {
enum GS_Flags {
GS_DEFAULT = 0,
--- 56,63 ----
typedef Uint32 PackedColor;
+
+ /* -------------------- Graphics State (GS) -------------------- */
enum GS_Flags {
GS_DEFAULT = 0,
***************
*** 80,90 ****
typedef GraphicsState GS;
- }
! //----------------------------------------
! // Graphics contexts / drawables
! //----------------------------------------
! namespace px
! {
class Drawable {
public:
--- 79,86 ----
typedef GraphicsState GS;
!
! /* -------------------- Drawable -------------------- */
!
class Drawable {
public:
***************
*** 123,133 ****
virtual Rect size() const = 0;
};
- }
! //----------------------------------------
! // Surface
! //----------------------------------------
! namespace px
! {
class Surface : public Drawable {
public:
--- 119,126 ----
virtual Rect size() const = 0;
};
!
! /* -------------------- Surface -------------------- */
!
class Surface : public Drawable {
public:
***************
*** 161,165 ****
SDL_Surface *get_surface() const { return m_surface; }
! void save_surface (const std::string& filename) const;
/*
--- 154,158 ----
SDL_Surface *get_surface() const { return m_surface; }
! void save_surface (const std::string& filename) const;
/*
***************
*** 198,208 ****
~SurfaceLock() { s->unlock(); }
};
- }
! //----------------------------------------
! // Screen
! //----------------------------------------
! namespace px
! {
class Screen {
public:
--- 191,198 ----
~SurfaceLock() { s->unlock(); }
};
!
! /* -------------------- Screen -------------------- */
!
class Screen {
public:
***************
*** 230,330 ****
Screen& operator=(const Screen&);
};
- }
- namespace px
- {
struct GC : public GraphicsState {
! GC(Drawable* d) :GraphicsState (d->size()) { drawable = d; }
Drawable *drawable;
};
- }
! //----------------------------------------
! // Graphics primitives
! //----------------------------------------
! namespace px
! {
! inline void set_color (GC &gc, int r, int g, int b, int a)
! {
gc.pcolor = gc.drawable->map_color(r, g, b, a);
}
! inline void set_color (GC &gc, int r, int g, int b)
! {
gc.pcolor = gc.drawable->map_color(r, g, b);
}
! inline void set_color (GC &gc, const RGB &c)
! {
set_color (gc, c.r, c.g, c.b);
}
! inline void set_color (GS &gs, PackedColor c)
! {
gs.pcolor=c;
}
! inline void enable_clipping(GS &gs)
! {
clear_flags (gs.flags, GS_NOCLIP);
}
! inline void disable_clipping (GS &gs)
! {
set_flags (gs.flags, GS_NOCLIP);
}
! inline void clip (GS &gs, const Rect& r)
! {
gs.cliprect = r;
enable_clipping(gs);
}
! inline void clip (GC &gc, const Rect& r)
! {
gc.cliprect = intersect (r, gc.drawable->size());
enable_clipping(gc);
}
! inline void clip (GC &gc)
! {
clip (gc, gc.drawable->size());
}
! inline void blit (const GC &gc, int x, int y, const Surface *s)
! {
gc.drawable->blit (gc, x, y, s);
}
! inline void blit(const GC &gc, int x, int y, const Surface *s, const Rect
&r)
! {
gc.drawable->blit (gc, x, y, s, r);
}
! inline void set_pixel(const GC &gc, int x, int y)
! {
gc.drawable->set_pixel (gc, x, y);
}
! inline void hline (const GC & gc, int x, int y, int w)
! {
gc.drawable->hline (gc, x, y, w);
}
! inline void vline (const GC & gc, int x, int y, int h)
! {
gc.drawable->vline (gc, x, y, h);
}
! inline void box (const GC &gc, const Rect& r)
! {
gc.drawable->box(gc, r.x, r.y, r.w, r.h);
}
! inline void box (const GC &gc, int x, int y, int w, int h)
! {
gc.drawable->box (gc, x, y, w, h);
}
--- 220,301 ----
Screen& operator=(const Screen&);
};
+
+ /* -------------------- Graphics Context (GC) -------------------- */
struct GC : public GraphicsState {
! GC(Drawable* d) :GraphicsState (d->size()) {
! drawable = d;
! }
Drawable *drawable;
};
!
! /* -------------------- Graphics primitives -------------------- */
! inline void set_color (GC &gc, int r, int g, int b, int a) {
gc.pcolor = gc.drawable->map_color(r, g, b, a);
}
! inline void set_color (GC &gc, int r, int g, int b) {
gc.pcolor = gc.drawable->map_color(r, g, b);
}
! inline void set_color (GC &gc, const RGB &c) {
set_color (gc, c.r, c.g, c.b);
}
! inline void set_color (GS &gs, PackedColor c) {
gs.pcolor=c;
}
! inline void enable_clipping(GS &gs) {
clear_flags (gs.flags, GS_NOCLIP);
}
! inline void disable_clipping (GS &gs) {
set_flags (gs.flags, GS_NOCLIP);
}
! inline void clip (GS &gs, const Rect& r) {
gs.cliprect = r;
enable_clipping(gs);
}
! inline void clip (GC &gc, const Rect& r) {
gc.cliprect = intersect (r, gc.drawable->size());
enable_clipping(gc);
}
! inline void clip (GC &gc) {
clip (gc, gc.drawable->size());
}
! inline void blit (const GC &gc, int x, int y, const Surface *s) {
gc.drawable->blit (gc, x, y, s);
}
! inline void blit(const GC &gc, int x, int y, const Surface *s, const Rect
&r) {
gc.drawable->blit (gc, x, y, s, r);
}
! inline void set_pixel(const GC &gc, int x, int y) {
gc.drawable->set_pixel (gc, x, y);
}
! inline void hline (const GC & gc, int x, int y, int w) {
gc.drawable->hline (gc, x, y, w);
}
! inline void vline (const GC & gc, int x, int y, int h) {
gc.drawable->vline (gc, x, y, h);
}
! inline void box (const GC &gc, const Rect& r) {
gc.drawable->box(gc, r.x, r.y, r.w, r.h);
}
! inline void box (const GC &gc, int x, int y, int w, int h) {
gc.drawable->box (gc, x, y, w, h);
}
***************
*** 333,372 ****
void frame (const GC & gc, int x, int y, int w, int h);
! inline void frame (const GC &gc, const Rect& r)
! {
frame (gc, r.x, r.y, r.w, r.h);
}
- }
- //----------------------------------------
- // Functions
- //----------------------------------------
- namespace px
- {
Screen *OpenScreen (int w, int h, int bipp);
Screen* DisplayFormat(Screen* s);
Surface *MakeSurface(int w, int h, int bipp,
const RGBA_Mask &mask = RGBA_Mask());
!
! void TintRect(Surface *s, Rect rect, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
!
! /** Create a surface from image data that is already somewhere in
! memory. */
Surface * MakeSurface(void* data, int w, int h, int bipp, int pitch,
const RGBA_Mask &mask = RGBA_Mask());
! /** Create a copy of a surface. */
Surface *Duplicate(const Surface *s);
! /** Create a new surface from a selection of an old one. */
! Surface *Grab(const Surface *s, Rect r);
! /** Convert a surface to the current screen's native format. */
Surface* DisplayFormat(Surface* s);
Surface* LoadImage(const char* filename);
}
--- 304,350 ----
void frame (const GC & gc, int x, int y, int w, int h);
! inline void frame (const GC &gc, const Rect& r) {
frame (gc, r.x, r.y, r.w, r.h);
}
+
+ /* -------------------- Functions -------------------- */
Screen *OpenScreen (int w, int h, int bipp);
Screen* DisplayFormat(Screen* s);
+
+ /*! Create a new surface. */
Surface *MakeSurface(int w, int h, int bipp,
const RGBA_Mask &mask = RGBA_Mask());
! /*! Create a surface from image data that is already somewhere in
! memory. */
Surface * MakeSurface(void* data, int w, int h, int bipp, int pitch,
const RGBA_Mask &mask = RGBA_Mask());
! /*! Create a new surface with the same image format as
! `surface'. */
! Surface *MakeSurfaceLike (int w, int h, Surface *surface);
!
! /*! Create a copy of a surface. */
Surface *Duplicate(const Surface *s);
! /*! Create a new surface from a selection of an old one. Performs
! proper clipping and returns a surface of the appropriate size
! (this may be smaller than the original size given in `r'.) The
! function stores the real region in `r'. */
! Surface *Grab(const Surface *s, Rect &r);
! /*! Convert a surface to the current screen's native format. */
Surface* DisplayFormat(Surface* s);
+ /*! Load an image using SDL_image and convert it to an optimized
+ format. */
Surface* LoadImage(const char* filename);
+
+ /*! Overlay a rectangle `rect' in `s' with a transparent colored
+ box. */
+ void TintRect(Surface *s, Rect rect, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Enigma-cvs] enigma/src/px video.hh,1.7,1.8,
Daniel Heck <address@hidden> <=