Discover Packages
github.com/dyike/keel
ui
internal
imageload
package
Version:
v0.0.4
Opens a new window with list of versions in this module.
Published: Oct 4, 2026
License: AGPL-3.0
Opens a new window with license information.
Imports: 14
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
README
¶
ui/internal/imageload
ui/markdown 的图片:调用 core.DecodeImage 解析来源(文件路径、file://、data:、http(s)://),在后台 goroutine 加载解码,限制文件大小和像素数,加载中和失败时画占位。
依赖 :ui/core、ui/theme、ui/locale、ui/internal/loop。
被谁依赖 :ui/markdown(公开为 markdown.ImageLoader 和 markdown.DecodeImage)。
Load 返回 *Asset,加载完成后通过 core.Update 写回并重绘;Revision 变化表示状态变了。View 画图片,Agent 看到的角色是 image,值是 loading / loaded / error。kit 的 Image 直接接收 image.Image,不经过这里。
Expand ▾
Collapse ▴
Documentation
¶
Package imageload loads images off the UI thread and draws them with a
placeholder until they arrive. ui/markdown uses it for Markdown images.
Asset is shared image data. Read its state under the UI lock. A completed
load invalidates windows through core.Update.
Load reads a local path, file URL, HTTP(S) URL or data URL in the
background. A nil loader uses core.DecodeImage. The request has a 15-second deadline.
Revision changes when the asset finishes loading, for render caches.
Size is the image's size in pixels, zero until it has loaded.
Loader reads an image source off the UI thread. Apps provide one for
authenticated requests or paths relative to a document.
View draws an asset at its natural size in dp, scaled down to fit, or a
placeholder with the alt text while it loads or after it fails.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.