Skip to content
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

Improve image docs #33

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

ErikKalkoken
Copy link
Contributor

I would like to propose an update to the page about canvas.Image.

The purpose of this update is to make it more clear how to use canvas.Image and to address commonly asked questions on the Discord help channel (e.g. not seeing the image because of missing SetMinSize()) .

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A great idea to improve this, however the statement "you need to
specify a minimum size for your image with Image.SetMinSize()." is not true.

Images will fill available space without any MinSize set. It is only needed if you want to ensure that it never becomes smaller than a certain size.

@ErikKalkoken
Copy link
Contributor Author

A great idea to improve this, however the statement "you need to specify a minimum size for your image with Image.SetMinSize()." is not true.

Images will fill available space without any MinSize set. It is only needed if you want to ensure that it never becomes smaller than a certain size.

Thank you for your feedback. I reworked the description to reflect your correction.

Copy link
Member

@andydotxyz andydotxyz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, just a couple of more things which struck me on review.


In our example we use `theme.AccountIcon()`, because it is already available in the Fyne library. To use your own images you can bundle them into your project, which will make them available as Fyne resources. For more information please see [Bundling resources]({% link extend/bundle.md %}).

Please note that we are setting a size for the window. This is necessary, because images normally do not have a minimum size and Fyne would draw a window with zero width and height. For more details please see the section about [Fillmode](#fillmode).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not zero so this statement is incorrect - the width and height of the image would be 1, in addition a window is normally padded as well. I would consider rewording this to be less specific.


## Image from a URL

Images can also be created from URLs with `canvas.NewImageFromURI()`. This will fetch the image during runtime from a public image URL.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this misleading as you can't pass a URL into a URI method.

You might find it easier to use LoadResourceFromURLString instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants