Commit 745647d1 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add support for translucent drop shadows

Detail:
  Drop shadows were disabled in DragASprite 0.17 when using translucency due to them looking a bit ugly. This change brings them back, but implemented in a different manner to produce a better result.
  Instead of using a standard sprite and rendering it with translucency, we create a sprite with an alpha channel and use the alpha to control the relative intensity of the dragged sprite and its shadow. The alpha channel also allows us to feather/blur the shadow, getting rid of the hard edges that were mostly resposible for the previous version looking so poor.
  s/Drag - Adjust TranslucentPlot to support plotting of the ABGR sprite
  s/StartUp - Adjust drag startup logic so that >2bpp uses an ABGR sprite, 2bpp uses a translucent plot (+ hard shadow), and 1bpp continues to use dithering/hatching. Add new GenerateTranslucentDropShadow routine that's responsible for creating the ABGR sprite. Adjust GetByteSizeOfSprite to return separate values for the size of the foreground (masked/ABGR) and background sprites.
  s/Support - Add new check for whether the kernel supports ABGR sprites
Admin:
  Tested on BB-xM
  Fixes issue #390:
  https://www.riscosopen.org/tracker/tickets/390


Version 0.18. Tagged as 'DragASprit-0_18'
parent 804d4f2c
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.17"
Module_Version SETA 17
Module_MajorVersion SETS "0.18"
Module_Version SETA 18
Module_MinorVersion SETS ""
Module_Date SETS "15 Oct 2013"
Module_ApplicationDate SETS "15-Oct-13"
Module_Date SETS "03 Jul 2014"
Module_ApplicationDate SETS "03-Jul-14"
Module_ComponentName SETS "DragASprit"
Module_ComponentPath SETS "castle/RiscOS/Sources/Desktop/DragASprit"
Module_FullVersion SETS "0.17"
Module_HelpVersion SETS "0.17 (15 Oct 2013)"
Module_FullVersion SETS "0.18"
Module_HelpVersion SETS "0.18 (03 Jul 2014)"
END
/* (0.17)
/* (0.18)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.17
#define Module_MajorVersion_CMHG 0.18
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 15 Oct 2013
#define Module_Date_CMHG 03 Jul 2014
#define Module_MajorVersion "0.17"
#define Module_Version 17
#define Module_MajorVersion "0.18"
#define Module_Version 18
#define Module_MinorVersion ""
#define Module_Date "15 Oct 2013"
#define Module_Date "03 Jul 2014"
#define Module_ApplicationDate "15-Oct-13"
#define Module_ApplicationDate "03-Jul-14"
#define Module_ComponentName "DragASprit"
#define Module_ComponentPath "castle/RiscOS/Sources/Desktop/DragASprit"
#define Module_FullVersion "0.17"
#define Module_HelpVersion "0.17 (15 Oct 2013)"
#define Module_LibraryVersionInfo "0:17"
#define Module_FullVersion "0.18"
#define Module_HelpVersion "0.18 (03 Jul 2014)"
#define Module_LibraryVersionInfo "0:18"
......@@ -82,20 +82,22 @@ Plot Entry "r0-r11"
TranslucentPlot ROUT
Entry "r5-r7"
LDRB r7, Translucency
TEQ r7, #0
BEQ %FT05
ORR r5, r5, r7, LSL #8
CMP r7, #1
BLT %FT05
ORRGT r5, r5, r7, LSL #8
ORREQ r5, r5, #16+32
MOV r6, #0
MOV r7, #0
LDR r7, fgtranstable
LDR r0, =SpriteReason_PutSpriteScaled + &100
SWI XOS_SpriteOp
EXIT VC
; Translucent plot failed - fall back to regular plotting for this drag.
; TODO - Hatch the sprite?
; Translucent plot failed - fall back to regular plotting for this drag
; This will almost certainly fail if this is an ABGR sprite, but should
; succeed for standard translucent plots
STRB r6, Translucency ; Disable translucency
MOV r6, #128
STRB r6, TranslucencyOK ; Reset SpriteExtend state (user may have downgraded?)
BIC r5, r5, #&FF00
AND r5, r5, #&F
05
LDR r0, =SpriteReason_PutSpriteUserCoords + &100
SWI XOS_SpriteOp
......
This diff is collapsed.
......@@ -30,14 +30,17 @@ y_size # 4 ; size in OS units of sprite
[ AtPointerFlag
ptrbuffer # 20 ; Wimp_GetPointerInfo buffer
]
fgtranstable # 4 ; Translation table for ABGR sprite
FirstMoveIsPlot # 1
Translucency # 1 ; Translucency value/enabled flag
; 0 = disabled
; 1 = no translucency (ABGR sprite)
; 2+ = real translucency value
TranslucencyOK # 1 ; Does SpriteExtend support translucency?
; 255 = yes, 0 = no, 128 = dunno
AlphaOK # 1 ; Does the kernel understand alpha sprites?
wss * :INDEX:@
Nowt * &bc000003
MACRO
$Label SortRegs $rl, $rh
$Label CMP $rl, $rh
......@@ -89,7 +92,7 @@ Support_ModuleFlags
DCD ModuleFlag_32bit
]
Support_Init
Support_Init ROUT
Push "lr"
MOV r0, #ModHandReason_Claim
MOV r3, #wss
......@@ -98,12 +101,24 @@ Support_Init
STRVC r12, [r2, #:INDEX:wsp]
MOV r12, r2
ChkKernelVersion
MOV r2, #Nowt
MOV r2, #0
STR r2, fgsa
STR r2, bg0sa
STR r2, bg1sa
STR r2, fgtranstable
MOV r2, #128
STRB r2, TranslucencyOK
; Check kernel support for alpha sprites/modes
MOV r3, #0
LDR r0, =&78000001+(SpriteType_New32bpp<<20)+ModeFlag_DataFormatSub_Alpha
MOV r1, #VduExt_ModeFlags
SWI XOS_ReadModeVariable
BVS %FT10
BCS %FT10
TEQ r2, #ModeFlag_DataFormatSub_Alpha
MOVEQ r3, #1
10
STRB r3, AlphaOK
Pull "pc"
Support_Die Entry
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment