~egonelbre

Recent activity

Re: [beginner] Need help to draw filled polylines a day ago

From Egon Elbre to ~eliasnaur/gio

Fixed point format won't help since the distance calculations
themselves may introduce an error.
As a simple example:

h := 10 //px
p.Begin(ops)
p.Move(0, 0)
p.Line(0, h/3)
p.Line(10, h/3)
p.Line(20, h/3)
p.Line(0, h/3)
p.Line(0, -h)

No matter how you try, you can find easy ways to introduce computation errors.

Re: [beginner] Need help to draw filled polylines 2 days ago

From Egon Elbre to ~eliasnaur/gio

I'm fine with removing them or keeping them.

My only concern with removing them is that people probably have
already heavily used them and it might be some effort to reimplement
things.

As an easier way to convert existing code there could be some external
temporary package that can be used instead of clip.Path that still
supports them for some time. e.g. `gioui.org/x/legacy/relclip` /
`relpath` or something -- that way fixing is just replacing the import
for Path.

+ Egon

Re: [beginner] Need help to draw filled polylines 2 days ago

From Egon Elbre to ~eliasnaur/gio

p.Close() is not required, however it's required that the paths are closed.

In your case, I don't think there's a potential issue, although the
cost of `p.Close` isn't that big.

When you use Line, Cube (instead of LineTo and CubeTo) you always want to have
p.Close to avoid potential issues with floating-point drift.

+ Egon

On Tue, Apr 20, 2021 at 5:24 PM Christophe Meessen
<christophe@meessen.net> wrote:
>
> It works. I used version 1. Thank you very much. I can proceed with my

Re: [beginner] Need help to draw filled polylines 2 days ago

From Egon Elbre to ~eliasnaur/gio

Oh, right... I mistook clip.Outline for clip.Path (derp).

You need to reset the clip path after every `clip.Outline` otherwise
they will be AND-ed together.

Alternatively, construct only one clip path rather than multiple.

https://pastebin.com/JvNTkt0Z

I would construct only one path -- unless you want to color each
letter a different color.

+ Egon

Re: [beginner] Need help to draw filled polylines 2 days ago

From Egon Elbre to ~eliasnaur/gio

Hi,

The code got pretty messed up, but roughly looks correct.
Can you upload the code such that it can be easily run?

The issue is probably because your outline does not specify the line width.

+ Egon

On Tue, Apr 20, 2021 at 1:21 PM Christophe Meessen
<christophe@meessen.net> wrote:
>
> Hello,
>

Re: [PATCH gio] op/clip: optimize zero corner radius in RRect a month ago

From Egon Elbre to ~eliasnaur/gio-patches

This change doesn't look correct.

RRect may not be aligned to pixel boundaries whereas Rect is.
It would need an additional check to ensure that half-pixels are not lost.

On Tue, Mar 16, 2021 at 11:17 AM ~pierrec <pierrec@git.sr.ht> wrote:
>
> From: pierre <pierre.curto@gmail.com>
>
> Signed-off-by: pierre <pierre.curto@gmail.com>
> ---
> Not sure how to add a proper test.
>
>  op/clip/shapes.go | 7 +++++++

Re: [PATCH gio-example v2] multiwindow: larger example a month ago

From Egon Elbre to ~eliasnaur/gio-patches

I'm not sure which version is preferred for the example repository.
I avoided changing the version in this specific changeset.

I don't have a strong opinion either way.

+ Egon

On Wed, Mar 3, 2021 at 2:30 PM Elias Naur <mail@eliasnaur.com> wrote:
>
> On Wed Mar 3, 2021 at 09:33 CET, ~egonelbre wrote:
> > +func main() {
> > +     // With Go 1.16, this can be replaced with:
> > +     //
> > +     //   signal.NotifyContext(context.Background(), os.Interrupt)

Re: [PATCH gio-example] all: bump gioui.org latest a month ago

From Egon Elbre to ~eliasnaur/gio-patches

Note, the x/component demo had a paint before layout.Inset handling. I
was assuming that it was implemented that way to change the color
outside the inset, I didn't test that behavior. However, I disabled
the inset handling just in case -- to make sure it doesn't modify the
existing behavior.

The latest x/component has double inset handling because the other
layout.Inset is still present.

+ Egon

On Mon, Mar 1, 2021 at 12:35 AM Chris Waldon
<christopher.waldon.dev@gmail.com> wrote:
>

Improvement to system.FrameEvent.Insets a month ago

From Egon Elbre to ~eliasnaur/gio

With change https://git.sr.ht/~eliasnaur/gio/commit/e124865
handling system.FrameEvent.Insets is not needed anymore.
The inset handling is needed in most cases and is easy to
forget and is boilerplate.

`layout.NewContext` will add the necessary insets
when they are present in the frame event.

To use the old behavior, you need to clear Insets in the event:

    e.Insets = system.Insets{}
    ctx := layout.NewContext(ops, e)

+ Egon

Go 1.16 heads-up a month ago

From Egon Elbre to ~eliasnaur/gio

While discussing a PR to add Windows compute shaders with Elias in
https://github.com/gioui/gio/pull/14. One of the problems was that a
generated shaders.go is getting out of hand (in the PR ~800kb). It
would be much nicer to use //go:embed, however that will require
bumping minimum required Go version to 1.16. It’ll take some time
before all the parts for Windows get added, so there’s still time to
upgrade your local/test environments and voice your concerns.

tl;dr; sometime in the future, Go 1.16 will be minimum required version for Gio.