-
Notifications
You must be signed in to change notification settings - Fork 615
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
Create a uiImage control #209
base: master
Are you sure you want to change the base?
Conversation
This can be used just like any of the other controls.
Unfortunately in order to decode PNGs and JPEGs and such the Windows Imaging Component needs to be included. Using this, the image is loaded, converted into an HBITMAP and painted in a window component.
Pretty simple here, just update the size of the NSImage and tell the NSImageView to redraw itself.
I already have a design for image loading in my local repository; it won't work in a way that's compatible with this. Thanks in the meantime, though! |
Ok no problem. Perhaps would you mind pushing that in a feature branch or something? I see what you are saying here, but that only seems to deal with application resources, not external images (which generally only have a single representation regardless of screen resolution). Even if there are multiple resolutions then Cocoa handles that directly with representations and a similar thing could be tacked onto Gtk and Win32. Also I'm not sure what the purpose of the floating point sizes is, it seems to just be a pixel size and a scale factor. Anyway, I guess I'm just curious what you're up to and I'd be willing to help out with your version if you'd like it. |
Any luck with image support? I know this is 2 years old now |
Same, I have been wanting to use this. This component looks pretty trivial and the implementation is pretty straightforward in the three back-ends, seems like a good fit for the type of simple dialog windows that one would make with libui. I think. |
From #318:
|
Awesome! great project, will be really exciting to have images. Would be able to do really professional apps with https://proton-native.js.org/#/ |
As soon as #361 is merged in, and table merged with master some hopefully short time later, I'll have a uiImage type that you can load bitmaps into, and we can talk about a control from there. |
So this would need to be updated to use the existing |
Also, a test/example is missing. |
This adds a simple control for loading an image from a file and getting and setting its size.
This shouldn't invalidate the work done in #2 by @art4711 since most GUI systems have a pixel buffer and an image component (Gtk has GdkPixbuf -> GtkImage, Windows has HBITMAP -> HWND, Cocoa has NSImage -> NSImageView, Qt has QPixmap -> QLabel, etc.). Perhaps in the future the uiImage control should be backed by a uiPixbuf or something, but for now at very least there should be a simple component for displaying an image.