Hmmm... it doesn't work on BlitzPlus.
First: you are writing on the img, it is better to create a copy.
Second: you should set the buffer back to the original Buffer, not to BackBuffer().
Third: you can't use Plot on a locked buffer, you must unlock it first.
Use WritePixelFast would be much better than Plot of course, just let me find some time to code it.
This is more a grayscale converter than a real shadow... but it is easier to convert it into a shadow, you must use always the same r g b gray value instead of converting each rgb color to a different grayscale level.
First: you are writing on the img, it is better to create a copy.
Second: you should set the buffer back to the original Buffer, not to BackBuffer().
Third: you can't use Plot on a locked buffer, you must unlock it first.
; SHADOW GENERATOR, the mask color is not affected Function GenerateShadow(sourceImg, r = 0, g = 0, b =0) img=CopyImage(sourceImg) originalBuffer=GraphicsBuffer() SetBuffer ImageBuffer(img) LockBuffer For x = 0 To ImageWidth(img) - 1 For y = 0 To ImageHeight(img) - 1 col = ReadPixelFast (x, y) ; convert to rgb values r1=(col Shl 8)Shr 24 g1=(col Shl 16)Shr 24 b1=(col Shl 24)Shr 24 If Not (r1 = r And g1 = g And b1 = b) UnlockBuffer Color r1,r1,r1 Plot x,y ;WritePixelFast x,y,calculatenewcolor LockBuffer EndIf Next Next UnlockBuffer SetBuffer originalBuffer Return img End Function
Use WritePixelFast would be much better than Plot of course, just let me find some time to code it.
This is more a grayscale converter than a real shadow... but it is easier to convert it into a shadow, you must use always the same r g b gray value instead of converting each rgb color to a different grayscale level.