22 #ifndef VECTOR_RENDERER_H 23 #define VECTOR_RENDERER_H 25 #include "common/rect.h" 26 #include "common/scummsys.h" 27 #include "common/str.h" 29 #include "graphics/managed_surface.h" 31 #include "gui/ThemeEngine.h" 54 Graphics::AlphaType alphaType;
60 Color () : r(0), g(0), b(0),
set(
false) {}
68 bool autoWidth, autoHeight;
75 enum VectorAlignment {
84 VectorAlignment xAlign;
85 VectorAlignment yAlign;
87 uint8 shadow, stroke, factor, radius,
bevel;
101 drawingCall =
nullptr;
103 alphaType = Graphics::ALPHA_OPAQUE;
105 autoWidth = autoHeight =
false;
108 xAlign = yAlign = kVectorAlignManual;
109 shadow = stroke = factor = radius = bevel = 0;
114 shadowIntensity = 1 << 16;
141 VectorRenderer() : _activeSurface(NULL), _fillMode(kFillDisabled), _shadowOffset(0), _shadowFillMode(kShadowExponential),
142 _disableShadows(
false), _strokeWidth(1), _gradientFactor(1), _bevel(0), _dynamicData(0) {
156 enum TriangleOrientation {
164 enum ShadowFillMode {
166 kShadowExponential = 1
177 virtual void drawLine(
int x1,
int y1,
int x2,
int y2) = 0;
186 virtual void drawCircle(
int x,
int y,
int r) = 0;
196 virtual void drawSquare(
int x,
int y,
int w,
int h) = 0;
208 virtual void drawRoundedSquare(
int x,
int y,
int r,
int w,
int h) = 0;
221 virtual void drawTriangle(
int x,
int y,
int base,
int height, TriangleOrientation orient) = 0;
234 virtual void drawBeveledSquare(
int x,
int y,
int w,
int h) = 0;
248 virtual void drawTab(
int x,
int y,
int r,
int w,
int h,
int s) = 0;
254 drawLine(x, y, x + w, y + w);
255 drawLine(x + w, y, x, y + h);
269 virtual void setFgColor(uint8 r, uint8 g, uint8 b) = 0;
282 virtual void setBgColor(uint8 r, uint8 g, uint8 b) = 0;
284 virtual void setBevelColor(uint8 r, uint8 g, uint8 b) = 0;
297 virtual void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2) = 0;
306 _activeSurface = surface;
313 return _activeSurface;
320 virtual void fillSurface() = 0;
326 byte *src = (byte *)_activeSurface->getPixels();
327 memset(src, 0, _activeSurface->pitch * _activeSurface->h);
340 virtual void setShadowFillMode(ShadowFillMode mode) {
341 _shadowFillMode = mode;
351 _strokeWidth = width;
364 _shadowOffset = offset;
367 virtual void setBevel(
int amount) {
380 _gradientFactor = factor;
389 if (shadowIntensity > 0)
392 warning(
"setShadowIntensity(): zero intensity");
403 virtual void setClippingRect(
const Common::Rect &clippingArea) = 0;
409 void stepGetPositions(
const DrawStep &step,
const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h);
415 int stepGetRadius(
const DrawStep &step,
const Common::Rect &area);
420 Common::Rect applyStepClippingRect(
const Common::Rect &area,
const Common::Rect &
clip,
const DrawStep &step);
426 uint16 x, y, w,
h, radius;
428 radius = stepGetRadius(step, area);
429 stepGetPositions(step, area, x, y, w, h);
431 drawCircle(x + radius, y + radius, radius);
434 void drawCallback_SQUARE(
const Common::Rect &area,
const DrawStep &step) {
436 stepGetPositions(step, area, x, y, w, h);
437 drawSquare(x, y, w, h);
440 void drawCallback_LINE(
const Common::Rect &area,
const DrawStep &step) {
442 stepGetPositions(step, area, x, y, w, h);
443 drawLine(x, y, x + w, y + h);
446 void drawCallback_ROUNDSQ(
const Common::Rect &area,
const DrawStep &step) {
448 stepGetPositions(step, area, x, y, w, h);
449 drawRoundedSquare(x, y, stepGetRadius(step, area), w, h);
452 void drawCallback_FILLSURFACE(
const Common::Rect &area,
const DrawStep &step) {
456 void drawCallback_TRIANGLE(
const Common::Rect &area,
const DrawStep &step) {
458 stepGetPositions(step, area, x, y, w, h);
459 drawTriangle(x, y, w, h, (TriangleOrientation)step.
extraData);
462 void drawCallback_BEVELSQ(
const Common::Rect &area,
const DrawStep &step) {
464 stepGetPositions(step, area, x, y, w, h);
465 drawBeveledSquare(x, y, w, h);
468 void drawCallback_TAB(
const Common::Rect &area,
const DrawStep &step) {
470 stepGetPositions(step, area, x, y, w, h);
471 drawTab(x, y, stepGetRadius(step, area), w, h, step.shadow);
474 void drawCallback_BITMAP(
const Common::Rect &area,
const DrawStep &step) {
476 stepGetPositions(step, area, x, y, w, h);
477 blitManagedSurface(step.blitSrc,
Common::Point(x, y), step.alphaType);
480 void drawCallback_CROSS(
const Common::Rect &area,
const DrawStep &step) {
482 stepGetPositions(step, area, x, y, w, h);
483 drawCross(x, y, w, h);
486 void drawCallback_VOID(
const Common::Rect &area,
const DrawStep &step) {}
495 virtual void drawStep(
const Common::Rect &area,
const Common::Rect &clip,
const DrawStep &step, uint32 extra = 0);
503 virtual void copyFrame(
OSystem *sys,
const Common::Rect &r) = 0;
510 virtual void copyWholeFrame(
OSystem *sys) = 0;
543 virtual void enableShadows() { _disableShadows =
false; }
555 ShadowFillMode _shadowFillMode;
Definition: managed_surface.h:51
uint32 _dynamicData
Definition: VectorRenderer.h:561
Color gradColor1
Definition: VectorRenderer.h:64
Definition: VectorRenderer.h:51
TextAlign
Definition: font.h:48
ShadingStyle
Function used to process areas other than the current dialog.
Definition: ThemeEngine.h:297
Definition: VectorRenderer.h:56
uint8 bevel
Definition: VectorRenderer.h:87
AutoScaleMode
AlphaBitmap scale mode selector.
Definition: ThemeEngine.h:304
Color bgColor
Definition: VectorRenderer.h:63
int _strokeWidth
Definition: VectorRenderer.h:560
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
ManagedSurface * _activeSurface
Definition: VectorRenderer.h:552
TextAlignVertical
Vertical alignment of the text.
Definition: ThemeEngine.h:218
GUI::ThemeEngine::AutoScaleMode autoscale
Definition: VectorRenderer.h:98
virtual void setShadowOffset(int offset)
Definition: VectorRenderer.h:362
virtual void setGradientFactor(int factor)
Definition: VectorRenderer.h:378
virtual void setFillMode(FillMode mode)
Definition: VectorRenderer.h:336
DrawingFunctionCallback drawingCall
Definition: VectorRenderer.h:52
Definition: VectorRenderer.h:139
FillMode
Definition: VectorRenderer.h:149
uint32 extraData
Definition: VectorRenderer.h:92
FillMode _fillMode
Definition: VectorRenderer.h:554
uint32 scale
Definition: VectorRenderer.h:94
int _gradientFactor
Definition: VectorRenderer.h:563
virtual void drawCross(int x, int y, int w, int h)
Definition: VectorRenderer.h:253
virtual void setShadowIntensity(uint32 shadowIntensity)
Definition: VectorRenderer.h:388
virtual ManagedSurface * getActiveSurface()
Definition: VectorRenderer.h:312
Definition: formatinfo.h:28
virtual void setStrokeWidth(int width)
Definition: VectorRenderer.h:350
Use image dimensions.
Definition: ThemeEngine.h:305
virtual void setSurface(ManagedSurface *surface)
Definition: VectorRenderer.h:305
uint32 _shadowIntensity
Definition: VectorRenderer.h:564
uint8 shadowFillMode
Definition: VectorRenderer.h:90
bool _disableShadows
Definition: VectorRenderer.h:559
void drawCallback_CIRCLE(const Common::Rect &area, const DrawStep &step)
Definition: VectorRenderer.h:425
virtual void clearSurface()
Definition: VectorRenderer.h:325
Color fgColor
Definition: VectorRenderer.h:62
int _shadowOffset
Definition: VectorRenderer.h:557
virtual void disableShadows()
Definition: VectorRenderer.h:542
uint32 shadowIntensity
Definition: VectorRenderer.h:96
int16 h
Definition: VectorRenderer.h:69
Color gradColor2
Definition: VectorRenderer.h:65
uint8 fillMode
Definition: VectorRenderer.h:89
Common::Rect clip
Definition: VectorRenderer.h:73
int _bevel
Definition: VectorRenderer.h:558