Ticket #390 (Fixed)Wed Jun 04 20:27:32 UTC 2014
DragASprite flag bit 7 does nothing
Reported by: | Sprow (202) | Severity: | Normal |
Part: | RISC OS: Module | Release: | |
Milestone: | Status | Fixed |
Details by Sprow (202):
Change in 0.17 means that this flag bit does nothing when translucent drags are possible, that’s not right, the API is a contract to provide a service and now the module doesn’t provide the service it used to.
Looking at Windows’ drop shadow they use 4 pixels at 55.7% 67.0% 83.1% 94.5% (where 100% = transparent). DragASprite uses 8 OS units (so also 4 pixels in a EX1 EY1 mode) but a 50% opacity. That may also not be fair to compare with the previous 50% hatching due to the trick of the eye that requires black dot correction to stop newsprint photos coming out too dark.
I imagine a gradated drop shadow is a bit hard to implement, but 25% opacity (the mean of the numbers from Windows) would probably work and give it back a bit of depth.
Changelog:
Modified by Sprow (202) Wed, June 04 2014 - 20:27:58 GMT
- Attachment added: menu.png
Screenshot from Windows shadow.
Modified by Chris (121) Mon, June 23 2014 - 13:56:47 GMT
This will be tricky to get right, visually speaking. A translucent object will cast a less intense shadow than an opaque one. Also, the drop shadow will need to be visible under the image itself, perhaps at a different density than the portion of shadow visible to the right and below.
Modified by Sprow (202) Thu, June 26 2014 - 21:26:17 GMT
- Attachment added: shades.PNG
The top level sprite is 50% opaque (60% in 256 colour modes), and my suggestion is for a lighter 25% shadow – I would expect it to cast a less intense shadow, as you say. See attached mock ups (shades.png).
DragASprite makes an offset black sprite, paints the main sprite on top, then 50% hatches the result.
With transparency, it’d make a 25% (or whatever) black sprite, paint a 50% sprite on top, and done.
I can’t think of a reason why the shadow would be different densities around the bottom/right – if I viewed the shadow side on it would be cast uniformly.
Modified by Jeffrey Lee (213) Mon, June 30 2014 - 11:38:56 GMT
I played around with this a bit on Sunday and managed to get a prototype translucent drop shadow working. Rather than go with the naive approach of doing a two-pass render (first the shadow, then the sprite) I’ve gone down the route of precalculating the composite of the sprite + shadow. This will add a bit of a CPU hit to the start of a drag operation but will ensure the drag itself remains flicker-free (a nice feature of all existing versions of the module).
Being able to see the shadow through the sprite does look a bit funny, so I’ll probably try playing with the code a bit to see if I can improve it. E.g. feathering the edge of the shadow is another possibility, or artificially decreasing the intensity of the shadow when viewed through the sprite.
Modified by Jeffrey Lee (213) Thu, July 03 2014 - 23:33:33 GMT
- Status changed from Open to Fixed
- Attachment added: SpriteFile.png
Now fixed with DragASprite 0.18. The shadow is at about 37%, but decreases significantly when behind the foreground sprite in order to avoid any hard gradients.
Modified by Sprow (202) Fri, July 04 2014 - 09:59:15 GMT
Nice one! You managed to propose an implementation and implement it faster than I got round to reading the ticket update after my mock ups in InkScape.