Commit Graph

20 Commits

Author SHA1 Message Date
Walter Werner SCHNEIDER 3b1effb7f5 f32: use value receiver for Split method on Affine2D
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
2025-07-09 13:36:30 +02:00
Walter Werner SCHNEIDER d76b4272aa f32: replace Affine2D{} with AffineId() for identity transformations
Reduces ambiguity by introducing AffineId() for representing identity transformation matrices.

References: https://todo.sr.ht/~eliasnaur/gio/655
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
2025-07-09 13:35:03 +02:00
Admin f73287be87 all: clean up code, upgrade to modern Go
Signed-off-by: ddkwork
2025-05-05 19:46:39 +02:00
Egon Elbre dead6e007f f32: nicer Affine2D string formatting
Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2022-10-11 13:27:57 -06:00
Dominik Honnef b9416c7c9c f32: fix typo in comment
Signed-off-by: Dominik Honnef <dominik@honnef.co>
2022-07-21 10:07:52 +02:00
Egon Elbre 9de13e37e9 f32: add Affine2D.Split
splitTransform func was creating multiple copies of f32.Affine2D
due to not having access to the internal and passing around non-pointer.

This makes splitTransform from ~8ns to .Split ~2ns.

It seems that the non-pointer receiver was ~0.6ns slower in this case.

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2022-07-02 07:04:47 +02:00
Elias Naur b5f12c5f26 f32: [API] unexport Rectangle
There are no public API that uses f32.Rectangle anymore. Move Rectangle
to an internal package for internal use.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-05-31 10:24:09 +02:00
Elias Naur 14805af367 gesture,widget,f32: [API] use integer coordinates for gesture coordinates
Most widget code operate in integer coordinates. This change makes
gesture pointer coordinates integer, to lessen the number of float32
to int conversions.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-05-31 10:24:09 +02:00
Elias Naur 1f11a5a17b f32,gpu,op/clip: add f32.Rectangle method for converting to image.Rectangle
Creating an image.Rectangle from a f32.Rectangle is used by two packages in Gio
and about to be used for a third. Add a Round method to f32.Rectangle to avoid
duplicating the implementation.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2022-03-30 22:20:27 +02:00
Pierre Curto 05f0f5c20f f32: add Point.Div
Signed-off-by: Pierre Curto <pierre.curto@gmail.com>
2021-10-11 20:30:43 +02:00
Elias Naur 3322e211c9 f32: handle empty rectangles in Union and Intersect
The old renderer depends on the old behaviour of Union, so change that
reference to a copy.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2021-04-27 16:49:06 +02:00
Walter Werner SCHNEIDER fd2d96adfc all: fix spelling errors
Signed-off-by: Walter Werner SCHNEIDER <contact@schnwalter.eu>
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-12-17 08:55:23 +01:00
pierre dce035fec4 f32: added Point.In(Rectangle)
Signed-off-by: pierre <pierre.curto@gmail.com>
2020-11-24 19:53:58 +01:00
Elias Naur 6d98eccad0 f32: add Affine2D.String
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-11-05 13:36:36 +01:00
Egon Elbre 24d6f3fb65 f32: optimize Affine2D
encode/decode seem to introduce significant overhead. Inline them
manually. It'll make code harder to read, however the performance wins
are significant.

name \ time/op                 before       after        delta
TransformOffset-32             2.64ns ± 0%  0.25ns ± 0%   ~     (p=0.100 n=3+3)
TransformScale-32              2.64ns ± 0%  0.25ns ± 1%   ~     (p=0.100 n=3+3)
TransformRotate-32             2.65ns ± 0%  0.24ns ± 3%   ~     (p=0.100 n=3+3)
TransformTranslateMultiply-32  42.5ns ± 0%  12.9ns ± 0%   ~     (p=0.100 n=3+3)
TransformScaleMultiply-32      42.6ns ± 0%  12.9ns ± 0%   ~     (p=0.100 n=3+3)
TransformMultiply-32           42.2ns ± 0%  12.9ns ± 2%   ~     (p=0.100 n=3+3)

Signed-off-by: Egon Elbre <egonelbre@gmail.com>
2020-10-13 15:14:33 +02:00
Viktor e7bc1a4553 f32: implement 2D affine transformations
Implements 2D affine transformations. This commit is a step
towards full affine transformations for drawing operations.

Heavily based on the work by Péter Szilágyi in patch 9212

Signed-off-by: Viktor <viktor.ogeman@gmail.com>
2020-06-21 11:17:37 +02:00
Elias Naur d82eb8fc66 layout,f32: add convenience functions for rectangles and points
layout.FRect, layout.FPt for converting from integer to floating point,
useful for drawing operations.

f32.Pt is a shorthand that mirrors image.Pt.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2020-05-19 10:59:32 +02:00
Wagner Riffel 0bf6de6cfa f32: add package Rect shorthand function
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2020-05-18 11:11:03 +02:00
Wagner Riffel 390949790e f32: implement fmt.Stringer to Point and Rectangle
Signed-off-by: Wagner Riffel <wgrriffel@gmail.com>
2020-05-13 12:59:39 +02:00
Elias Naur 22cd88df9f all: rename the gioui.org/ui module to gioui.org
The "ui" is redundant and stutters.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:37:06 +02:00