From 53a42ececfff48b93cef414bc2762806786da8d5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 2 May 2014 23:36:03 +0300 Subject: GUI: Added new alphabitmap image type --- graphics/VectorRendererSpec.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index fc741f6e77..a50bb27c1a 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -25,6 +25,7 @@ #include "common/frac.h" #include "graphics/surface.h" +#include "graphics/transparent_surface.h" #include "graphics/colormasks.h" #include "gui/ThemeEngine.h" @@ -848,8 +849,8 @@ blitSubSurfaceClip(const Graphics::Surface *source, const Common::Rect &r, const } template -void VectorRendererSpec:: -blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r) { +void VectorRendererSpec:: +blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { int16 x = r.left; int16 y = r.top; @@ -885,7 +886,7 @@ blitAlphaBitmap(const Graphics::Surface *source, const Common::Rect &r) { template void VectorRendererSpec:: -blitAlphaBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) { +blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) { if (clipping.isEmpty() || clipping.contains(r)) { blitAlphaBitmap(source, r); return; @@ -942,6 +943,12 @@ blitAlphaBitmapClip(const Graphics::Surface *source, const Common::Rect &r, cons } } +template +void VectorRendererSpec:: +blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r) { + source->blit(*_activeSurface, r.left, r.top); +} + template void VectorRendererSpec:: applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { -- cgit v1.2.3 From f0c52096f3e9215cb584b3862f2cd4b9632761d5 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 3 May 2014 02:50:47 +0300 Subject: GUI: Implemented possibility to use alphabitmaps in GraphicsWidget --- graphics/VectorRendererSpec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index a50bb27c1a..e87397b349 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -888,7 +888,7 @@ template void VectorRendererSpec:: blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) { if (clipping.isEmpty() || clipping.contains(r)) { - blitAlphaBitmap(source, r); + blitKeyBitmap(source, r); return; } -- cgit v1.2.3 From 4474ccf8144563c4bacbb060c943c0f68e317cea Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 5 May 2014 00:52:56 +0300 Subject: GUI: Implemented alphabitmap autoscale --- graphics/VectorRendererSpec.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index e87397b349..1fdd0fc4eb 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -884,6 +884,17 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { } } +template +void VectorRendererSpec:: +blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, bool autoscale) { + if (autoscale) + source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, + nullptr, TS_ARGB(255, 255, 255, 255), + r.width(), r.height()); + else + source->blit(*_activeSurface, r.left, r.top); +} + template void VectorRendererSpec:: blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const Common::Rect &clipping) { @@ -943,12 +954,6 @@ blitKeyBitmapClip(const Graphics::Surface *source, const Common::Rect &r, const } } -template -void VectorRendererSpec:: -blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r) { - source->blit(*_activeSurface, r.left, r.top); -} - template void VectorRendererSpec:: applyScreenShading(GUI::ThemeEngine::ShadingStyle shadingStyle) { -- cgit v1.2.3 From ec7312ac13ce19f64b2b453b43e2c37235dcbe7a Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 5 May 2014 21:36:16 +0300 Subject: GUI: Implemented more modes to autoscale --- graphics/VectorRendererSpec.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 1fdd0fc4eb..68b77d20ee 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -886,13 +886,25 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { template void VectorRendererSpec:: -blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, bool autoscale) { - if (autoscale) +blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Graphics::DrawStep::AutoScaleMode autoscale) { + if (autoscale == Graphics::DrawStep::kAutoScaleStretch) { source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255, 255, 255), r.width(), r.height()); - else + } else if (autoscale == Graphics::DrawStep::kAutoScaleFit) { + double ratio = (double)r.width() / source->w; + double ratio2 = (double)r.height() / source->h; + + if (ratio2 < ratio) + ratio = ratio2; + + source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, + nullptr, TS_ARGB(255, 255, 255, 255), + (int)(source->w * ratio), (int)(source->h * ratio)); + + } else { source->blit(*_activeSurface, r.left, r.top); + } } template -- cgit v1.2.3 From 38114eb760f842eb3145c9d1af62366cf2fab8ca Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Wed, 7 May 2014 13:12:59 +0300 Subject: GUI: Plug NinePatch bitmaps into parser --- graphics/VectorRendererSpec.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 68b77d20ee..f3e496af70 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -26,6 +26,7 @@ #include "graphics/surface.h" #include "graphics/transparent_surface.h" +#include "graphics/nine_patch.h" #include "graphics/colormasks.h" #include "gui/ThemeEngine.h" @@ -902,6 +903,9 @@ blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Gra nullptr, TS_ARGB(255, 255, 255, 255), (int)(source->w * ratio), (int)(source->h * ratio)); + } else if (autoscale == Graphics::DrawStep::kAutoScaleNinePatch) { + Graphics::NinePatchBitmap nine(source, false); + nine.blit(*_activeSurface, r.left, r.top, r.width(), r.height()); } else { source->blit(*_activeSurface, r.left, r.top); } -- cgit v1.2.3 From 75f9b099dc3e198c7a1750a6e26ac4945719492f Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Fri, 9 May 2014 19:00:49 +0300 Subject: GUI: Added possibility to specify scale mode for AlphaBitmaps --- graphics/VectorRendererSpec.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index f3e496af70..0b947e4a0f 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -887,12 +887,12 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { template void VectorRendererSpec:: -blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Graphics::DrawStep::AutoScaleMode autoscale) { - if (autoscale == Graphics::DrawStep::kAutoScaleStretch) { +blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI::ThemeEngine::AutoScaleMode autoscale) { + if (autoscale == GUI::ThemeEngine::kAutoScaleStretch) { source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255, 255, 255), - r.width(), r.height()); - } else if (autoscale == Graphics::DrawStep::kAutoScaleFit) { + r.width(), r.height()); + } else if (autoscale == GUI::ThemeEngine::kAutoScaleFit) { double ratio = (double)r.width() / source->w; double ratio2 = (double)r.height() / source->h; @@ -903,7 +903,7 @@ blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, Gra nullptr, TS_ARGB(255, 255, 255, 255), (int)(source->w * ratio), (int)(source->h * ratio)); - } else if (autoscale == Graphics::DrawStep::kAutoScaleNinePatch) { + } else if (autoscale == GUI::ThemeEngine::kAutoScaleNinePatch) { Graphics::NinePatchBitmap nine(source, false); nine.blit(*_activeSurface, r.left, r.top, r.width(), r.height()); } else { -- cgit v1.2.3 From 94bc75ae464dc37d2a4dee0ac6fb69e75b265413 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sun, 11 May 2014 22:40:35 +0300 Subject: GUI: Implemented centering of dialog background --- graphics/VectorRendererSpec.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 0b947e4a0f..8af6594fd4 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -887,7 +887,8 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { template void VectorRendererSpec:: -blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI::ThemeEngine::AutoScaleMode autoscale) { +blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI::ThemeEngine::AutoScaleMode autoscale, + Graphics::DrawStep::VectorAlignment xAlign, Graphics::DrawStep::VectorAlignment yAlign) { if (autoscale == GUI::ThemeEngine::kAutoScaleStretch) { source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255, 255, 255), @@ -899,9 +900,16 @@ blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI if (ratio2 < ratio) ratio = ratio2; - source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, + int offx = 0, offy = 0; + if (xAlign == Graphics::DrawStep::kVectorAlignCenter) + offx = (r.width() - (int)(source->w * ratio)) >> 1; + + if (yAlign == Graphics::DrawStep::kVectorAlignCenter) + offy = (r.height() - (int)(source->h * ratio)) >> 1; + + source->blit(*_activeSurface, r.left + offx, r.top + offy, Graphics::FLIP_NONE, nullptr, TS_ARGB(255, 255, 255, 255), - (int)(source->w * ratio), (int)(source->h * ratio)); + (int)(source->w * ratio), (int)(source->h * ratio)); } else if (autoscale == GUI::ThemeEngine::kAutoScaleNinePatch) { Graphics::NinePatchBitmap nine(source, false); -- cgit v1.2.3 From 6524a8d103c87def348b9560418850cb48d24ce4 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Mon, 4 Aug 2014 01:12:49 +0200 Subject: GUI: Added transparency to PicWidgets --- graphics/VectorRendererSpec.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'graphics/VectorRendererSpec.cpp') diff --git a/graphics/VectorRendererSpec.cpp b/graphics/VectorRendererSpec.cpp index 8af6594fd4..9aed3301fa 100644 --- a/graphics/VectorRendererSpec.cpp +++ b/graphics/VectorRendererSpec.cpp @@ -888,11 +888,11 @@ blitKeyBitmap(const Graphics::Surface *source, const Common::Rect &r) { template void VectorRendererSpec:: blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI::ThemeEngine::AutoScaleMode autoscale, - Graphics::DrawStep::VectorAlignment xAlign, Graphics::DrawStep::VectorAlignment yAlign) { + Graphics::DrawStep::VectorAlignment xAlign, Graphics::DrawStep::VectorAlignment yAlign, int alpha) { if (autoscale == GUI::ThemeEngine::kAutoScaleStretch) { source->blit(*_activeSurface, r.left, r.top, Graphics::FLIP_NONE, - nullptr, TS_ARGB(255, 255, 255, 255), - r.width(), r.height()); + nullptr, TS_ARGB(alpha, 255, 255, 255), + r.width(), r.height()); } else if (autoscale == GUI::ThemeEngine::kAutoScaleFit) { double ratio = (double)r.width() / source->w; double ratio2 = (double)r.height() / source->h; @@ -908,7 +908,7 @@ blitAlphaBitmap(Graphics::TransparentSurface *source, const Common::Rect &r, GUI offy = (r.height() - (int)(source->h * ratio)) >> 1; source->blit(*_activeSurface, r.left + offx, r.top + offy, Graphics::FLIP_NONE, - nullptr, TS_ARGB(255, 255, 255, 255), + nullptr, TS_ARGB(alpha, 255, 255, 255), (int)(source->w * ratio), (int)(source->h * ratio)); } else if (autoscale == GUI::ThemeEngine::kAutoScaleNinePatch) { -- cgit v1.2.3