-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1px thin stroke line #2298
Comments
I think that in released versions we check that line is at least 1 in width. However as the toolkit is scalable we don't use (P.S. the card lines are gradients, so the comparison isn't as direct as you may think) |
Thank you @andydotxyz . It's always you answered the questions. New to golang, I'm not sure how can I switch to develop branch. Please have a look at command below. It seems still v2.0.3
|
For my old MBP, branch develop won't work. I created a vendor directory, and download develop branch in it. Then run commands below. go mod vendor reports nothing. but when I try to run it, there is an error output below.
|
Version v2.0.3-rc2.0.20210619093830-4cea3cc8eb2c isn’t 2.0.3, it is pre-2.1 (you can see the date of the last commit in the second field). The error you report has been fixed in the branch So I’m not sure what is going on there. If you’re >= go 1.16 don’t do anything with vendor, it’s go.mod that is the source of truth. |
Ok. I use go get -d fyne.io/fyne/v2@develop switched to develop branch. But it seems not a thin line, but a line with fade-in colors. I set StrokeWidth = 3, 2, 1, 0.5, 0.3, and run them all. As you can see, only when I set strokeWidth=3, I can see the difference in the line stroke.
Is it possible to get a thin line? |
With a few local tweaks I managed to get it to this point, is that what you would look for @daiwhea ? |
Thanks. @andydotxyz Yes, this is what I'm looking for. And I think I'm using develop branch. I use LifeCycle() and see the log text. Why can't I got this thin lines? Is my MBP too old? it's late 2011, 10.13.6
|
Yes that is correct - like I said I was working on local modifications and was looking for your confirmation that it was the expected result. The version you are using is from develop as far as I can see. |
@andydotxyz Thanks. I'll close this issue later. |
You can test it on that PR #2299 and see if it gets the desired results on your macOS setup. |
@andydotxyz At last, I can get 1px thin line with a canvas.NewRectangle(). And if I want to get 0.5px thin line. It will be round up to 1px. I'm not sure why can't I got thin lines like yours. Seems fyne will forbid min width/height = 1, so any height < 1 will be round up to 1. my go.mod:
my main.go:
|
@andydotxyz I've a look at internal/painter/software/draw.go , Seems it will add vectorPad to strokeWidth. So canvas.Line will has a min height for 2px. Just like those lines what I got. I'm not sure why you got lines more thinner. and in internal/painter/vector.go. canvas.Line will get extra 2 for pad. |
vectorPad is not the cause, that is adding space around the drawable item so we don’t clip at the boundary (important for diagonal lines). can I ask why you closed the issue, I don’t see a comment? |
Sorry @andydotxyz . That thin line is what I'm looking for. I waited for serval days without your feedback. I know you're busy for the fyne toolkit. The most important reason is that I can't make sure the reason why I can't get a thin line like your. I don't want to waste your time for this tiny issue. At that time, I think maybe it's just because my os is too old. So I closed this issue. I don't know how to test why I can't get thin line like yours. Can you please tell me how to deep test it? I'm new to golang and gui system. I have only a little web developments. Thanks a lot. |
Can you please confirm the resolution of the monitor you are using @daiwhea? |
OK, thanks for this. That display is not HiDPI, so I will try to replicate on a suitably non-retina monitor. |
This fix is now on the |
Thanks @andydotxyz . I've just test the new branch. It doesn't work as expected. If StrokeWidth < 1, it won't be displayed. And StrokeWidth 1 or 2 displayed like they are same width. |
Can you confirm that you're still using |
If you could confirm the scale used that would help a little. $ git clone https://github.com/fyne-io/fyne
$ cd fyne
$ git checkout develop
$ cd cmd/hello
<copy your code into main.go>
$ go run main.go That will run your test app with the latest fixes all running. |
sorry @andydotxyz go get https://github.com/fyne-io/fyne doesn't work. Should I download source code directly ?
|
Sorry I meant |
Sorry I'm too late. Seems doesn't work on my old mac.
|
@andydotxyz Here. My texture scale is 1 ,yours 2. |
Thanks, this helps. I think latest |
@andydotxyz Great, it works now. |
Is your feature request related to a problem? Please describe:
Can we use canvas.NewLine() to paint a thin line which is just 1px?
I use export FYNE_SCALE=0.5 and export FYNE_SCALE=1 to run a demo. But the lines looks like the same strokeWidth. The text looks scaled, but lines seem not scaled as expected.
I'm using MBP. but I don't think it's because the HiDPI.
In fact we can see thin line if we use widget.Card, we can see it draws a thin border. But Card uses widget.NewShadowingRenderer which is internal.
Is it possible to construct a solution with the existing API?
I don't know how to draw a thin line with fyne-toolkit.
Thanks
The text was updated successfully, but these errors were encountered: