# Line

在图像中绘制直线。

## 参数

<table><thead><tr><th>参数名</th><th width="208.18338610093963">类型</th><th>说明</th></tr></thead><tbody><tr><td>x1</td><td><code>int</code></td><td>直线端点坐标 x 轴</td></tr><tr><td>y1</td><td><code>int</code></td><td>直线端点坐标 y 轴</td></tr><tr><td>x2</td><td><code>int</code></td><td>直线另一个端点坐标 x 轴</td></tr><tr><td>y2</td><td><code>int</code></td><td>直线另一个端点坐标 y 轴</td></tr><tr><td>c</td><td><code>color.Color</code></td><td>直线颜色</td></tr></tbody></table>

## 返回值

`*imgo.Image` 类型的实例。

## 例子

```go
package main

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

func main() {
    imgo.Canvas(300, 300, color.White).
        Line(10, 10, 200, 250, color.Black).
        Save("out.png")
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://imgo.gitbook.io/cn/api/line.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
