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

Create a uiImage control #209

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Create a uiImage control #209

wants to merge 6 commits into from

Conversation

sclukey
Copy link
Contributor

@sclukey sclukey commented Sep 15, 2016

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.

sclukey and others added 6 commits September 14, 2016 21:36
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.
@andlabs
Copy link
Owner

andlabs commented Sep 15, 2016

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!

@sclukey
Copy link
Contributor Author

sclukey commented Sep 15, 2016

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.

@jswhisperer
Copy link

Any luck with image support? I know this is 2 years old now

@Swyter
Copy link

Swyter commented May 28, 2018

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.

@mischnic
Copy link
Contributor

Any luck with image support? I know this is 2 years old now

From #318:

This is dependent on #310, as the table branch has a lot of the groundwork done already. Once that's done, I'll start discussing and planning the API (as I need to go back through my notes and the OS API documentation and also make sure I'm doing high-DPI multi-resource correctly).

@jswhisperer
Copy link

jswhisperer commented May 28, 2018

Awesome! great project, will be really exciting to have images. Would be able to do really professional apps with https://proton-native.js.org/#/

@andlabs
Copy link
Owner

andlabs commented May 28, 2018

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.

@mischnic mischnic mentioned this pull request Jun 1, 2018
@mischnic
Copy link
Contributor

mischnic commented Oct 5, 2018

So this would need to be updated to use the existing uiImage, although that one is really meant for icons with multiple resolutions?

@mischnic
Copy link
Contributor

mischnic commented Oct 7, 2018

Also, a test/example is missing.

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.

5 participants