You can do it with a mask. As a demo, make a main window:
-- main result window
win = GetPluginID ()
WindowCreate (win, 0, 0, 300, 200, 7, 0, ColourNameToRGB("silver")) -- create window
WindowShow (win, true) -- show it

Now draw whatever gradient (or background image) you want into a second window:
-- gradient window
win2 = GetPluginID () .. ".2"
WindowCreate (win2, 0, 0, 200, 80, 7, 0, ColourNameToRGB("white")) -- create window
WindowShow (win2, true) -- show it (for testing purposes only)
WindowGradient (win2, 0, 0, 0, 0,
ColourNameToRGB ("red"),
ColourNameToRGB ("yellow"),
1) -- left to right

Now make a mask in a third window:
-- mask window
win3 = GetPluginID () .. ".3"
WindowCreate (win3, 0, 0, 200, 80, 7, 0, ColourNameToRGB("black")) -- create window
WindowShow (win3, true) -- show it (for testing purposes only)
-- round rectangle
WindowCircleOp (win3, 3, 20, 20, 180, 60,
ColourNameToRGB("black"), 5, 0, -- no pen
ColourNameToRGB("white"), 0, -- brush
25, 25)

Convert both temporary windows into images, and merge them into the main window:
-- convert to images
WindowImageFromWindow (win, "gradient", win2)
WindowImageFromWindow (win, "mask", win3)
-- do the merge
WindowMergeImageAlpha (win, "gradient", "mask", 20, 20, 200, 100, 0, 1, 0, 0, 0, 0)

Normally you wouldn't show win2 and win3, I have just done that so you can see what is happening under the hood. By tweaking coordinates, colours etc., you can have pretty-much any effect you want.
|