Skip to content

proposal: image: add bound to Uniform image. #22380

@kybin

Description

@kybin

Currently image.Uniform is unbounded (infinite-sized) Image. But all other Images in the package are bounded. This unmatched property is cumbersome to me.

Because an unbounded image is good for filling all area, but bad for filling specific area.

For example, I usually code like this, but with Uniform, I can't.

draw.Draw(dst, src.Bounds(), src, src.Bounds().Min, draw.Src)

I once created my own Uniform image that has size. But draw.Draw got slower. (draw.Draw knows how to optimize image.Uniform but not MyUniform)

So I propose add bound to Uniform and new function like NewUniformBounded or NewUniformSized.

The original NewUniform will still there, so we could generate both bounded and unbounded images easily.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions