(I'll reply there, but maybe you should consider moving to SMP, which is faster and offer more possibilites.)
You need to create an image with this shadow, and then you draw the shadow image below/before the final image. Here is a function which create such image:
function createShadow(width, height, color){
var shadow = gdi.CreateImage(width, height);
var gb = shadow.GetGraphics();
gb.FillSolidRect(10, 10, width-20, height-20, color);
shadow.ReleaseGraphics(gb);
shadow = shadow.Resize(width*1/10, height*1/10,2);
shadow = shadow.Resize(width, height, 2);
return shadow;
};
And then using this function, it's quite easy:
cover_shadow = createShadow(image_width, image_height, RGB(0,0,0));
gr.DrawImage(cover_shadow, 0, 0, image_width+20, image_height+20, 0, 0, cover_shadow.Width, cover_shadow.Height);
To achieve the desired effect (shadow blur radius/position), you need to play mostly with the values in DrawImage
function createShadow(width, height, color){
let shadow = gdi.CreateImage(width, height);
let gb = shadow.GetGraphics();
gb.FillSolidRect(0, 0, width, height, color);
shadow.ReleaseGraphics(gb);
shadow = shadow.Resize(width / 128, height / 128, 2);
shadow = shadow.Resize(width, height, 2);
return shadow;
}
if (this.img) {
let cover_shadow = createShadow(this.img.Width, this.img.Height, _RGBA(0, 0, 0, 128));
_drawImage(gr, cover_shadow, this.x, this.y, this.w, this.h, this.properties.aspect.value);
_drawImage(gr, this.img, this.x + 10, this.y + 10, this.w - 20, this.h - 20, this.properties.aspect.value);
}
Thanks for the tip.
So, what the script is doing is that resize the image to a smaller size and then resize it back to original dimension so that it can be generated with blurred border? If so, what I don't get is the resized shadow image has blurred edge only on right and bottom, but no blurred effect on left and top. Is this a rendering bug from resize()?