Commit Graph

21 Commits

Author SHA1 Message Date
Elias Naur 31acd5451e op/paint: further clarify PaintOp documentation
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:44:36 +02:00
Elias Naur 29c9b06dab op/paint: document ImageOp gotcha
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:31:21 +02:00
Elias Naur b7ba809517 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>
2020-05-14 13:19:15 +02:00
Elias Naur 81f474f5d7 op/paint,io/system: document ImageOp lifetime
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-14 13:15:05 +02:00
Elias Naur af68e17dd3 op/paint: set subimage Rect when converting image
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-03-12 18:42:20 +01:00
Elias Naur 69dfd2e3a5 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>
2020-02-13 13:15:32 +01:00
axel paulander 2e66c90aee 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>
2020-01-10 17:52:33 +01:00
Elias Naur e864ac3fc3 op/clip: split clip operations into its own package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 19:07:00 +01:00
Elias Naur 560cf6054c op/paint: add note that ClipOp intersects the clip, not replace it
Updates #61

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 18:31:49 +01:00
Elias Naur f1d971268e op/paint: guard against nil image in ImageOp.Size
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-07 21:08:01 +01:00
aarzilli 454b226404 op/paint: NewImageOp does not need to make copies of RGBA images
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-07 18:44:31 +01:00
Elias Naur 97299dc2f9 op/paint: make every ImageOp unique
The gioui.org/commit/74407a50d598bfd27e8f8e48b6832cc5df04de77
added a NewImageOp constructor that always copies the supplied
image. It does that for two reasons:

First, the image.Image reference is used in the image=>texture
map of cached textures. Without a copy, we wouldn't detect a
modified image even if a new ImageOp was created.

Second, we don't want the program to touch the image while the GPU
is uploading it.

The second reason was removed in a previous change that blocks
FrameEvent.Frame until we're done with the operations, including
uploading images to the GPU.

The first reason is easily fixed by using a unique per ImageOp,
as pointed out by Alessandro Arzilli.

This change switches to using the unique key. Alessandro's patch
avoids the copy when possible.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-07 18:27:06 +01:00
aarzilli 299e966816 op/paint: make documentation of Line clearer
The movement is not to an absolute coordinate but by a delta relative
to the current position of the pen.
2019-11-05 17:57:50 +01:00
Elias Naur fa00b53e13 op: change signature of Ops.Write
By returning the allocated data buffer, Ops can become an interface
in a future change without forcing operations to allocate.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 23:10:35 +02:00
Elias Naur 88208891de op/paint,app/internal/gpu: post-process paths during GPU upload
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 22:51:52 +02:00
Elias Naur d9100b506f op,op/paint: remove aux awareness from Ops
Aux data is now entirely confined to the writers (Path) and the
ops Reader parser.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 20:20:56 +02:00
Elias Naur 74407a50d5 op/paint: add NewImageOp, unexport ImageOp fields
With public ImageOp fields there was no way to mark an image.Image as modified.
Replace them with NewImageOp that always make a copy, and use the opportunity
to ensure the copy is ready to upload to a GPU texture.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 18:06:50 +02:00
Elias Naur ef5cf5b724 op/paint: return ClipOp from Path.End
Instead of adding an implicit ClipOp, return a ClipOp ready to use, freeing the
caller from recording a macro.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur 31e12607d7 op/paint: note that ImageOp caches image contents
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-03 19:26:37 +02:00
Elias Naur 6dad034b22 op/paint: rename PathBuilder to Path
There was no "Path" to "Build", so let's just use the simpler name.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-03 13:35:38 +02:00
Elias Naur beaec661d2 op/paint: move paint package below the op package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00