~eliasnaur/gio

gio/op/paint d---------
Many operations do not pass refs to Write. Similarly adding
...interface{} requires constructing a slice, which is slow.

This cuts about 100ns from RRect and Border benchmark.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
all: use color.NRGBA in public API

color.RGBA has two problems with regards to using it.

First the color values need to be premultiplied, whereas most APIs
have non-premultiplied values. This is mainly to preserve color components
with low alpha values.

Second there are two ways to premultiply with sRGB. One is to premultiply
after sRGB conversion, the other is before. This makes using the API more
confusing.

Using color.NRGBA in sRGB makes it align with CSS.e

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
op/paint: update documentation to match the removal of PaintOp.Rect

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: document that color.RGBA values are in the sRGB color space

Updates gio#169

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: remove support for PaintOp.Rect

PaintOp.Rect is the wrong abstraction; it implies a clip operation
better handled by package clip, and not all paints need it (colors).
Furthermore, it's awkward to specify a PaintOp that fills up the
current clip area, regardless of its size.

Redefine PathOp to mean "fill current clip area".

API change. Replace uses of PaintOp.Rect with a TransformOp applied
before the PaintOp.

Leave a TODO for the PathOp infinity area.

Fixes gio#167

Signed-off-by: Elias Naur <mail@eliasnaur.com>
app/headless,internal/rendertest: replace PaintOps with Fill/FillShape

We're about to remove PaintOp.Rect. Replacing PaintOps with Fill or
FillShape where possible will ease the transition.

Using Fill in tests exposed a problem with the infinity in paint.Fill.
Adjust it for now; it will be removed later.

Updates gio#167

Signed-off-by: Elias Naur <mail@eliasnaur.com>
gpu,widget,op/paint,gpu: remove support for ImageOp.Rect

This is effectively a revert of commit gioui.org/commit/69dfd2e3a5541.

ImageOp.Rect is the wrong abstraction; it implies a clipping operation that is
better handled by package clip.

API change. Uses of ImageOp.Rect should apply a clip.Rect before the PaintOp,
or use image.RGBA.SubImage (or similar).

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: make the shape argument last in FillShape

FillShape is a generalization of Fill, so it seems more natural to
have the extra argument last.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
gpu: add linear gradient

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
op/paint: add Fill helpers for painting an area with a solid color

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
op/paint: further clarify PaintOp documentation

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: document ImageOp gotcha

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: rename material to brush

The "material" name clashes with the theme of the same name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint,io/system: document ImageOp lifetime

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: set subimage Rect when converting image

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: add support for efficient ImageOp subimages

The new field ImageOp.Rect is initialized to cover the entire source
image, but can be modified to draw only a section of it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: correct image loading

Corrected the use of draw.Draw in paint.NewImageOp as the old use only works for images starting at the origin

Signed-off-by: Axel Paulander <axel.paulander@gmail.com>
op/clip: split clip operations into its own package

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: add note that ClipOp intersects the clip, not replace it

Updates #61

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: guard against nil image in ImageOp.Size

Signed-off-by: Elias Naur <mail@eliasnaur.com>
op/paint: NewImageOp does not need to make copies of RGBA images

Signed-off-by: Elias Naur <mail@eliasnaur.com>
Next