Rectangle

Draw a rectangle in the image.

Parameters

Parameter
Type
Description

x

int

X-Coordinate of the top-left corner of the rectangle.

y

int

Y-Coordinate of the top-left corner of the rectangle.

width

int

Width of the rectangle.

height

int

Height of the rectangle.

c

color.Color

Color of the rectangle.

Return Values

The instance of *imgo.Image .

Examples

package main

import (
    "github.com/fishtailstudio/imgo"
    "image/color"
)

func main() {
    imgo.Canvas(300, 300, color.White).
        Rectangle(100, 100, 100, 150, color.Black).
        Save("out.png")
}

Last updated