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;
102 alphaType = Graphics::ALPHA_OPAQUE;
104 autoWidth = autoHeight =
false;
107 xAlign = yAlign = kVectorAlignManual;
108 shadow = stroke = factor = radius = bevel = 0;
113 shadowIntensity = 1 << 16;
140 VectorRenderer() : _activeSurface(NULL), _fillMode(kFillDisabled), _shadowOffset(0), _shadowFillMode(kShadowExponential),
141 _disableShadows(
false), _strokeWidth(1), _gradientFactor(1), _bevel(0), _dynamicData(0) {
155 enum TriangleOrientation {
163 enum ShadowFillMode {
165 kShadowExponential = 1
176 virtual void drawLine(
int x1,
int y1,
int x2,
int y2) = 0;
185 virtual void drawCircle(
int x,
int y,
int r) = 0;
195 virtual void drawSquare(
int x,
int y,
int w,
int h) = 0;
207 virtual void drawRoundedSquare(
int x,
int y,
int r,
int w,
int h) = 0;
220 virtual void drawTriangle(
int x,
int y,
int base,
int height, TriangleOrientation orient) = 0;
233 virtual void drawBeveledSquare(
int x,
int y,
int w,
int h) = 0;
247 virtual void drawTab(
int x,
int y,
int r,
int w,
int h,
int s) = 0;
253 drawLine(x, y, x + w, y + w);
254 drawLine(x + w, y, x, y + h);
268 virtual void setFgColor(uint8 r, uint8 g, uint8 b) = 0;
281 virtual void setBgColor(uint8 r, uint8 g, uint8 b) = 0;
283 virtual void setBevelColor(uint8 r, uint8 g, uint8 b) = 0;
296 virtual void setGradientColors(uint8 r1, uint8 g1, uint8 b1, uint8 r2, uint8 g2, uint8 b2) = 0;
305 _activeSurface = surface;
312 return _activeSurface;
319 virtual void fillSurface() = 0;
325 byte *src = (byte *)_activeSurface->getPixels();
326 memset(src, 0, _activeSurface->pitch * _activeSurface->h);
339 virtual void setShadowFillMode(ShadowFillMode mode) {
340 _shadowFillMode = mode;
350 _strokeWidth = width;
363 _shadowOffset = offset;
366 virtual void setBevel(
int amount) {
379 _gradientFactor = factor;
388 if (shadowIntensity > 0)
391 warning(
"setShadowIntensity(): zero intensity");
402 virtual void setClippingRect(
const Common::Rect &clippingArea) = 0;
408 void stepGetPositions(
const DrawStep &step,
const Common::Rect &area, uint16 &in_x, uint16 &in_y, uint16 &in_w, uint16 &in_h);
414 int stepGetRadius(
const DrawStep &step,
const Common::Rect &area);
419 Common::Rect applyStepClippingRect(
const Common::Rect &area,
const Common::Rect &
clip,
const DrawStep &step);
425 uint16 x, y, w,
h, radius;
427 radius = stepGetRadius(step, area);
428 stepGetPositions(step, area, x, y, w, h);
430 drawCircle(x + radius, y + radius, radius);
433 void drawCallback_SQUARE(
const Common::Rect &area,
const DrawStep &step) {
435 stepGetPositions(step, area, x, y, w, h);
436 drawSquare(x, y, w, h);
439 void drawCallback_LINE(
const Common::Rect &area,
const DrawStep &step) {
441 stepGetPositions(step, area, x, y, w, h);
442 drawLine(x, y, x + w, y + h);
445 void drawCallback_ROUNDSQ(
const Common::Rect &area,
const DrawStep &step) {
447 stepGetPositions(step, area, x, y, w, h);
448 drawRoundedSquare(x, y, stepGetRadius(step, area), w, h);
451 void drawCallback_FILLSURFACE(
const Common::Rect &area,
const DrawStep &step) {
455 void drawCallback_TRIANGLE(
const Common::Rect &area,
const DrawStep &step) {
457 stepGetPositions(step, area, x, y, w, h);
458 drawTriangle(x, y, w, h, (TriangleOrientation)step.
extraData);
461 void drawCallback_BEVELSQ(
const Common::Rect &area,
const DrawStep &step) {
463 stepGetPositions(step, area, x, y, w, h);
464 drawBeveledSquare(x, y, w, h);
467 void drawCallback_TAB(
const Common::Rect &area,
const DrawStep &step) {
469 stepGetPositions(step, area, x, y, w, h);
470 drawTab(x, y, stepGetRadius(step, area), w, h, step.shadow);
473 void drawCallback_BITMAP(
const Common::Rect &area,
const DrawStep &step) {
475 stepGetPositions(step, area, x, y, w, h);
476 blitManagedSurface(step.blitSrc.
get(),
Common::Point(x, y), step.alphaType);
479 void drawCallback_CROSS(
const Common::Rect &area,
const DrawStep &step) {
481 stepGetPositions(step, area, x, y, w, h);
482 drawCross(x, y, w, h);
485 void drawCallback_VOID(
const Common::Rect &area,
const DrawStep &step) {}
494 virtual void drawStep(
const Common::Rect &area,
const Common::Rect &clip,
const DrawStep &step, uint32 extra = 0);
502 virtual void copyFrame(
OSystem *sys,
const Common::Rect &r) = 0;
509 virtual void copyWholeFrame(
OSystem *sys) = 0;
542 virtual void enableShadows() { _disableShadows =
false; }
554 ShadowFillMode _shadowFillMode;
Definition: managed_surface.h:51
uint32 _dynamicData
Definition: VectorRenderer.h:560
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:559
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
ManagedSurface * _activeSurface
Definition: VectorRenderer.h:551
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:361
virtual void setGradientFactor(int factor)
Definition: VectorRenderer.h:377
virtual void setFillMode(FillMode mode)
Definition: VectorRenderer.h:335
DrawingFunctionCallback drawingCall
Definition: VectorRenderer.h:52
Definition: VectorRenderer.h:138
FillMode
Definition: VectorRenderer.h:148
uint32 extraData
Definition: VectorRenderer.h:92
PointerType get() const
Definition: ptr.h:229
FillMode _fillMode
Definition: VectorRenderer.h:553
uint32 scale
Definition: VectorRenderer.h:94
int _gradientFactor
Definition: VectorRenderer.h:562
virtual void drawCross(int x, int y, int w, int h)
Definition: VectorRenderer.h:252
virtual void setShadowIntensity(uint32 shadowIntensity)
Definition: VectorRenderer.h:387
virtual ManagedSurface * getActiveSurface()
Definition: VectorRenderer.h:311
Definition: formatinfo.h:28
virtual void setStrokeWidth(int width)
Definition: VectorRenderer.h:349
Use image dimensions.
Definition: ThemeEngine.h:305
virtual void setSurface(ManagedSurface *surface)
Definition: VectorRenderer.h:304
uint32 _shadowIntensity
Definition: VectorRenderer.h:563
uint8 shadowFillMode
Definition: VectorRenderer.h:90
bool _disableShadows
Definition: VectorRenderer.h:558
void drawCallback_CIRCLE(const Common::Rect &area, const DrawStep &step)
Definition: VectorRenderer.h:424
virtual void clearSurface()
Definition: VectorRenderer.h:324
Color fgColor
Definition: VectorRenderer.h:62
int _shadowOffset
Definition: VectorRenderer.h:556
virtual void disableShadows()
Definition: VectorRenderer.h:541
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:557