Syntax
DrawImgShadowInsetEx(Img, x.d, y.d, Width.d, Height.d, dx.d, dy.d, dWidth.d, dHeight.d, BlurAmount.f=10, Spread.f=0, ShadowColor.l=0, ShadowOpacity.f=1, xOffset.d=0, yOffset.d=0, isHollow=#False)Description
Draws an extended inner drop shadow by specifying a source clipping rectangle and projecting it onto a destination rectangle, scaling it if the dimensions differ. The shadow is cast inside the opaque areas of the image segment.
Parameters
Img
The source image handle.
x.d, y.d, Width.d, Height.d
The source coordinates and dimensions specifying the segment of the
image to use.
dx.d, dy.d, dWidth.d, dHeight.d
The destination coordinates and dimensions to project the shadow
onto.
BlurAmount.f (optional)
The gaussian blur amount applied to the shadow. Default is 10.
Spread.f (optional)
The expansion/contraction amount of the shadow. Default is 0.
ShadowColor.l (optional)
The RGB color of the shadow. Default is 0 (Black).
ShadowOpacity.f (optional)
The opacity of the shadow (0.0 to 1.0). Default is 1.
xOffset.d, yOffset.d (optional)
The shadow offset. Default is 0.
isHollow (optional)
If #True, the shadow will only be drawn inside the opaque
bounds of the image, preventing it from rendering over the fully
transparent sections. Default is #False.
Return Value
This command does not return a value.
Example
IncludeFile "ProGUI_PB.pbi"
StartProGUI()
; Create a source mask image with an ellipse
Global MaskImg = CreateImg(200, 200, #PG_Img_Transparent)
If BeginDraw(OutputImg(MaskImg))
DrawEllipse(100, 100, 90, 90, RGB(100, 150, 255), 1.0) ; Blue ellipse
EndDraw()
EndIf
Procedure DrawHandler(Window, EventType, *EventData.PG_EventDraw, *UserData)
DrawClear(RGB(255, 255, 255), 1) ; White background
; 1. Draw the full ellipse image scaled down to 100x100 at position 20, 20
DrawImgEx(MaskImg, 0, 0, 200, 200, 20, 20, 100, 100, 1.0)
; Draw the inset shadow over it, scaling it identically and applying an offset and blur
DrawImgShadowInsetEx(MaskImg, 0, 0, 200, 200, 20, 20, 100, 100, 10, 0, RGB(0, 0, 0), 0.8, 5, 5)
; 2. Draw only the top half of the ellipse, scaled and stretched
DrawImgEx(MaskImg, 0, 0, 200, 100, 150, 20, 150, 100, 1.0)
; Draw a red inset shadow exclusively for that clipped section
DrawImgShadowInsetEx(MaskImg, 0, 0, 200, 100, 150, 20, 150, 100, 15, 0, RGB(128, 0, 0), 0.9, 0, 8)
EndProcedure
MyWindow = CreateWindow(0, 0, 350, 160, "DrawImgShadowInsetEx Example")
If MyWindow
AddEventHandler(MyWindow, #PG_Event_Draw, @DrawHandler())
WindowShow(MyWindow, #True, #PG_WindowShow_ScreenCentered)
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
FreeImg(MaskImg)
StopProGUI()See Also
Supported OS
Windows, Linux