From 327996d801c740334e90a33af21759e0efcc8ec5 Mon Sep 17 00:00:00 2001 From: bergmann Date: Tue, 17 Jan 2017 18:08:07 +0100 Subject: [PATCH] * fixed offset buf in TtsPostProcessorShadow --- utsPostProcessor.pas | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/utsPostProcessor.pas b/utsPostProcessor.pas index f613988..4c9359c 100644 --- a/utsPostProcessor.pas +++ b/utsPostProcessor.pas @@ -177,6 +177,7 @@ type implementation uses + Math, utsConstants; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -557,7 +558,7 @@ end; function TtsPostProcessorShadow.Execute(const aChar: TtsChar; const aImage: TtsImage): Boolean; var orig: TtsImage; - tmpX, tmpY: Integer; + tmpX, tmpY, w, h: Integer; m: TtsGlyphMetric; begin result := inherited Execute(aChar, aImage); @@ -567,19 +568,20 @@ begin try orig.Assign(aImage); aImage.Resize( - aImage.Width + 2 * fKernel.Size, - aImage.Height + 2 * fKernel.Size, - fKernel.Size, fKernel.Size); + aImage.Width + 2 * fKernel.Size + abs(fOffset.x), + aImage.Height + 2 * fKernel.Size + abs(fOffset.y), + fKernel.Size + max(0, fOffset.x), + fKernel.Size + max(0, fOffset.y)); aImage.FillColor(fColor, TS_COLOR_CHANNELS_RGBA, TS_IMAGE_MODES_MODULATE_ALPHA); aImage.Blur(fKernel, fKernel, [tsChannelAlpha]); - tmpX := fKernel.Size - fOffset.x; - tmpY := fKernel.Size - fOffset.y; + tmpX := fKernel.Size + max(0, -fOffset.x); //fKernel.Size - fOffset.x; + tmpY := fKernel.Size + max(0, -fOffset.y); //fKernel.Size - fOffset.y; aImage.Blend(orig, tmpX, tmpY, @tsBlendColorAlpha); m := aChar.GlyphMetric; - m.GlyphRect.Right := m.GlyphRect.Right + 2 * fKernel.Size; - m.GlyphRect.Bottom := m.GlyphRect.Bottom + 2 * fKernel.Size; + m.GlyphRect.Right := m.GlyphRect.Right + 2 * fKernel.Size + abs(fOffset.x); + m.GlyphRect.Bottom := m.GlyphRect.Bottom + 2 * fKernel.Size + abs(fOffset.y); m.GlyphOrigin.x := m.GlyphOrigin.x - tmpX; m.GlyphOrigin.y := m.GlyphOrigin.y + tmpX; aChar.GlyphMetric := m;