home *** CD-ROM | disk | FTP | other *** search
- /* Draw a bevelled drop box, plus a stencil mask, using OpalPaint.
- Requires OpalPaint 2.3 and above.
- */
-
-
- address 'OpalPaint_Rexx'
-
- options Results
-
- SaveSetUp
- GetRect
- parse var Result X1 Y1 X2 Y2
-
- Width = X2-X1
- Height = Y2-Y1
-
- If Width < Height then MaxDepth = (Width/2)%1
- If Height < Width then MaxDepth = (Height/2)%1
-
- /* Simple requester for bevel & stencil */
- ReqBuild '200 150 "Bevel Box Creator"'
- AddGadget 'HProp DepthGad 30 45 120 16 0 'MaxDepth''
- AddGadget 'Check StencilGad Below DepthGad 0 15 Medium'
- AddText 'Above DepthGad 0 -3 "Bevel depth"'
- AddText 'Right StencilGad 2 7 "Create Stencil?"'
- InitGadget DepthGad 10
- InitGadget 'StencilGad Selected'
- Request
- GadgetStatus Cancel
- if Result=1 Then do
- FreeRequest
- Exit
- END
- GadgetStatus DepthGad
- Depth = Result /* Set depth of bevel */
- GadgetStatus StencilGad
- StencilStatus = Result
- FreeRequest
-
- GetPen
- RGBtoHSV Result
- Parse var Result Hue Sat Val
-
- /* Make a stencil mask of the bevel box area */
-
- if StencilStatus=1 then do
- /*
- Key StencilEditMode
- */
- WorkMode STENCIL
- SolidRect X1 Y1 X2 Y2-1
- WorkMode IMAGE
- StenEnable 0
- end
-
- /* Box body. Set up a diagonal HSV gradient */
-
- FillMode Gradient
- ClearColGrad
- ClearTransGrad
- ColourDither 0
- TransDither 0
-
- HSVtoRGB Hue Sat Val
- ColGradTag 0 Result
- S2 = (Sat-(0.4*65535))%1 /* Note: %1 converts number to an integer */
- S2 = MAX(S2,0)
- HSVtoRGB Hue S2 Val
- ColGradTag 0.5 Result
- HSVtoRGB Hue Sat Val
- ColGradTag 1 Result
- GradType LinearFree HSV
- GradRange X1+Depth Y1+Depth X2-Depth Y2-Depth
- SolidRect X1+Depth Y1+Depth X2-Depth Y2-Depth
-
- FillMode Solid
- /* Top */
-
- V2 = (Val+0.1*65535)%1
- V2 = MIN(V2,65535)
-
- HSVtoRGB Hue Sat V2
- SetPen Result
-
- SolidPoly X1 Y1 X2 Y1 X2-Depth Y1+Depth X1+Depth Y1+Depth X1 Y1
- LastPoint
-
-
- /* Right */
-
- V2 = (Val-0.15*65535)%1
- V2 = MAX(V2,0)
-
- HSVtoRGB Hue Sat V2
- SetPen Result
-
- SolidPoly X2 Y1 X2 Y2 X2-Depth Y2-Depth X2-Depth Y1+Depth X2 Y1
- LastPoint
-
- /* Left */
-
- V2 = (Val+0.15*65535)%1
- V2 = MIN(V2,65535)
-
- HSVtoRGB Hue Sat V2
- SetPen Result
-
- SolidPoly X1 Y1 X1+Depth Y1+Depth X1+Depth Y2-Depth X1 Y2 X1 Y1
- LastPoint
-
- /* Bottom */
-
- V2 = (Val-0.1*65535)%1
- V2 = MAX(V2,0)
-
- HSVtoRGB Hue Sat V2
- SetPen Result
-
- SolidPoly X2 Y2 X1 Y2 X1+Depth Y2-Depth X2-Depth Y2-Depth X2 Y2
- LastPoint
- RestoreSetUp
-