22 #ifndef PARALLACTION_GRAPHICS_H 23 #define PARALLACTION_GRAPHICS_H 25 #include "common/list.h" 26 #include "common/rect.h" 27 #include "common/hashmap.h" 28 #include "common/hash-str.h" 29 #include "common/str.h" 30 #include "common/stream.h" 31 #include "common/array.h" 33 #include "graphics/surface.h" 39 #include "common/pack-start.h" 51 #include "common/pack-end.h" 63 virtual void setColor(byte color) {
66 virtual uint32 getStringWidth(
const char *s) = 0;
67 virtual uint16 height() = 0;
75 virtual uint16 getNum() = 0;
76 virtual byte* getData(uint16 index) = 0;
78 virtual uint getRawSize(uint16 index) = 0;
79 virtual uint getSize(uint16 index) = 0;
99 uint16 getNum()
override {
102 byte* getData(uint16 index)
override {
113 uint getRawSize(uint16 index)
override {
115 return getSize(index);
117 uint getSize(uint16 index)
override {
119 return _surf->
w * _surf->
h;
135 _width = _height = _count = 0;
142 Cnv(uint16 numFrames, uint16 width, uint16 height, byte *data,
bool freeData =
false)
143 : _count(numFrames), _width(width), _height(height), _data(data), _freeData(freeData), field_8(0), _surf(NULL) {
147 : _count(numFrames), _width(width), _height(height), _data(NULL), _freeData(
true), field_8(0), _surf(surf) {
162 byte* getFramePtr(uint16 index) {
165 return &_data[index * _width * _height];
168 uint16 getNum()
override {
172 byte *getData(uint16 index)
override {
173 return getFramePtr(index);
182 uint getRawSize(uint16 index)
override {
183 assert(index < _count);
184 return getSize(index);
186 uint getSize(uint16 index)
override {
187 assert(index < _count);
188 return _width * _height;
198 uint16 internalWidth;
204 byte* getPtr(uint16 x, uint16 y)
const;
205 void bltOr(uint16 dx, uint16 dy,
const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
206 void bltCopy(uint16 dx, uint16 dy,
const MaskBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
213 void create(uint16 width, uint16 height);
216 byte getValue(uint16 x, uint16 y)
const;
224 uint16 internalWidth;
230 byte* getPtr(uint16 x, uint16 y)
const;
231 void bltCopy(uint16 dx, uint16 dy,
const PathBuffer &src, uint16 sx, uint16 sy, uint width, uint height);
238 void create(uint16 width, uint16 height);
240 byte getValue(uint16 x, uint16 y)
const;
255 void clone(
const Palette &pal);
258 void setEntries(byte* data, uint first, uint num);
259 void getEntry(uint index,
int &red,
int &green,
int &blue);
260 void setEntry(uint index,
int red,
int green,
int blue);
261 void makeGrayscale();
262 void fadeTo(
const Palette& target, uint step);
263 uint fillRGB(byte *rgb);
265 void rotate(uint first, uint last,
bool forward);
269 #define CENTER_LABEL_HORIZONTAL -1 270 #define CENTER_LABEL_VERTICAL -1 274 #define MAX_BALLOON_WIDTH 130 289 kGfxObjTypeLabel = 3,
290 kGfxObjTypeBalloon = 4,
291 kGfxObjTypeCharacter = 8,
324 GfxObj(uint type,
Frames *frames,
const char *name = NULL);
327 const char *getName()
const;
331 byte *getData(uint frame);
332 uint getRawSize(uint frame);
333 uint getSize(uint frame);
336 void setFlags(uint32 flags);
337 void clearFlags(uint32 flags);
339 return (_flags & kGfxObjVisible) == kGfxObjVisible;
345 #define LAYER_FOREGROUND 3 355 MaskPatches _maskPatches;
357 void clearMaskData();
360 PathPatches _pathPatches;
362 void clearPathData();
387 void toggleMaskPatch(uint
id,
int x,
int y,
bool apply);
388 uint16 getMaskLayer(uint16 z)
const;
395 void togglePathPatch(uint
id,
int x,
int y,
bool apply);
404 kBackgroundLocation = 1,
413 kUnselectedColor = 1,
419 virtual void reset() = 0;
420 virtual int setLocationBalloon(
const Common::String &text,
bool endGame) = 0;
421 virtual int setDialogueBalloon(
const Common::String &text, uint16 winding, TextColor textColor) = 0;
422 virtual int setSingleBalloon(
const Common::String &text, uint16 x, uint16 y, uint16 winding, TextColor textColor) = 0;
423 virtual void setBalloonText(uint
id,
const Common::String &text, TextColor textColor) = 0;
424 virtual int hitTestDialogueBalloon(
int x,
int y) = 0;
429 #define SCENE_DRAWLIST_SIZE 100 435 void resetSceneDrawList();
441 void addObjectToScene(
GfxObj *obj);
442 GfxObjArray _sceneObjects;
443 GfxObj* loadAnim(
const char *name);
444 GfxObj* loadGet(
const char *name);
445 GfxObj* loadDoor(
const char *name);
446 GfxObj* loadCharacterAnim(
const char *name);
448 void freeCharacterObjects();
449 void freeLocationObjects();
450 void showGfxObj(
GfxObj* obj,
bool visible);
455 void showFloatingLabel(
GfxObj *label);
456 void hideFloatingLabel();
458 GfxObj *renderFloatingLabel(
Font *font,
char *text);
459 GfxObj *createLabel(
Font *font,
const char *text, byte color);
460 void showLabel(
GfxObj *label, int16 x, int16 y);
461 void hideLabel(
GfxObj *label);
463 void unregisterLabel(
GfxObj *label);
466 GfxObj* registerBalloon(
Frames *frames,
const char *text);
467 int setItem(
GfxObj* obj, uint16 x, uint16 y, byte transparentColor = 0);
468 void setItemFrame(uint item, uint16 f);
469 void freeDialogueObjects();
474 void patchBackground(
Graphics::Surface &surf, int16 x, int16 y,
bool mask =
false);
480 void setPalette(
Palette &palette);
481 void setBlackPalette();
482 void animatePalette();
486 void setHalfbriteMode(
bool enable);
487 void setProjectorPos(
int x,
int y);
488 void setProjectorProgram(int16 *data);
489 int16 *_nextProjectorPos;
492 void initiateScroll(
int deltaX,
int deltaY);
494 void setScrollPosX(
int scrollX);
495 void setScrollPosY(
int scrollY);
509 byte *_unpackedBitmap;
523 void updateScreenIntern();
525 bool _doubleBuffering;
528 void copyRectToScreen(
const byte *buf,
int pitch,
int x,
int y,
int w,
int h);
530 int _scrollPosX, _scrollPosY;
531 int _minScrollX, _maxScrollX, _minScrollY, _maxScrollY;
533 uint32 _requestedHScrollSteps;
534 uint32 _requestedVScrollSteps;
535 int32 _requestedHScrollDir;
536 int32 _requestedVScrollDir;
538 #define NO_FLOATING_LABEL 1000 548 GfxObjArray _balloons;
556 void drawInventory();
559 void updateFloatingLabel();
561 void drawText(
Font *font,
Graphics::Surface* surf, uint16 x, uint16 y,
const char *text, byte color);
Definition: graphics.h:244
void setHeight(int16 aHeight)
Definition: rect.h:198
int16 h
Definition: surface.h:76
Definition: graphics.h:431
Definition: graphics.h:194
Graphics::Surface * scale(const Graphics::Surface &srcImage, int xSize, int ySize)
const void * getBasePtr(int x, int y) const
Definition: surface.h:138
Definition: graphics.h:41
void setWidth(int16 aWidth)
Definition: rect.h:194
Definition: graphics.h:86
int16 left
Definition: rect.h:145
Definition: graphics.h:352
Definition: graphics.h:220
Definition: graphics.h:124
int16 w
Definition: surface.h:71
Definition: graphics.h:53
Definition: graphics.h:540
Definition: graphics.h:409
Definition: graphics.h:300
Definition: graphics.h:73