Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Draw a rounded rectangle.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
GraphicsMagick | 3.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
ImageRef | The image reference number. | 1 | |
upperLeftX | Upper left X position. | ||
upperLeftY | Upper left Y position. | ||
lowerRightX | Lower right X position. | ||
lowerRightY | Lower right Y position. | ||
cornerWidth | The width of the corner arc. | Optional | |
cornerHeight | The height of the corner arc. | Optional |
Returns OK or error message.
Creates a new image and draws a round rectangle inside:
Set Variable [ $img; Wert:MBS("GMImage.New"; "300x200"; "RGB 1 1 1") ]
Set Variable [ $r; Wert:MBS("GMImage.SetStrokeColor"; $img; "RGB 1 0 0") ]
Set Variable [ $r; Wert:MBS("GMImage.SetFillColor"; $img; "RGB 0 0 1") ]
Set Variable [ $r; Wert:MBS("GMImage.SetLineWidth"; $img; 5) ]
Set Variable [ $r; Wert:MBS("GMImage.DrawRoundRectangle"; $img; 50; 50; 250; 150; 10; 10) ]
Set Variable [ $png; Wert:MBS("GMImage.WriteToPNGContainer"; $img; "test.png") ]
Set Variable [ $r; Wert:MBS("GMImage.Release"; $img) ]
Set Field [ Drawing::Image; $png ]
Use one picture as pattern to draw round rectangle:
# Load big picture
Set Variable [ $BigImageRef ; Value: MBS("GMImage.NewFromContainer"; Combine Pictures::BigImage) ]
# load pattern picture
Set Variable [ $SmallImageRef ; Value: MBS("GMImage.NewFromContainer"; Combine Pictures::SmallImage) ]
# Draw a rectangle using small image as pattern
Set Variable [ $Error ; Value: MBS( "GMImage.FillPattern"; $BigImageRef; $SmallImageRef) ]
Set Variable [ $Error ; Value: MBS( "GMImage.DrawRoundRectangle"; $BigImageRef; 100; 100; 300; 300; 20; 20) ]
# Write to container and free references
Set Field [ Combine Pictures::Result ; MBS( "GMImage.WriteToPNGContainer"; $BigImageRef ) ]
Set Variable [ $Error ; Value: MBS("GMImage.Free";$BigImageRef) ]
Set Variable [ $Error ; Value: MBS("GMImage.Free";$SmallImageRef) ]
This function checks for a license.
Created 18th August 2014, last changed 16th February 2023