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

Windows/Sprites: styling improvements #441

Closed
IgorAlexey opened this issue May 12, 2022 · 3 comments
Closed

Windows/Sprites: styling improvements #441

IgorAlexey opened this issue May 12, 2022 · 3 comments
Labels
feature request Discuss request for missing feature

Comments

@IgorAlexey
Copy link
Contributor

IgorAlexey commented May 12, 2022

I feel the interface system may benefit from a few enhancements to increase usability and the breadth of designs that can be achieved in a less time-consuming manner if a few of these features were to be implemented:

  • Shadow property w/ base color, directional inset/offset & blur radius
  • Border outline (this could be implemented in a similar way to shadows, but with only color & thickness)
  • Corner rounding (the ability to round individual corners of a element by a certain amount), this way round windows & things like tabs in Sublime text could be achieved

as of currently I am using images and a lot of overlapping action to get similar effects, which is probably not very resource efficient and is very difficult to manage due to different resolutions. It would be very great if something like this could be performed using the native UI system:

image

@turanszkij turanszkij added the feature request Discuss request for missing feature label May 12, 2022
@turanszkij
Copy link
Owner

This will need custom rendering code for gui elements. Currently most of it is just using the image renderer. The rounding corners would be probably best implemented with a specialized vertex buffer generator, the shadow could be a border with alpha = 0 edges in that vertex buffer, and custom falloff setting. I don't know when I will do it, but I tagged as feature request.

@IgorAlexey
Copy link
Contributor Author

That's a good observation, I look forward to this the most, also some functionality can be mimicked from CSS:
https://developer.mozilla.org/en-US/docs/Web/CSS/border-radius
https://developer.mozilla.org/en-US/docs/Web/CSS/box-shadow

@turanszkij
Copy link
Owner

Sprites now support corner rounding, and border softening #502 . Example usage for rendering an image:

wi::image::Params params;
params.pos = XMFLOAT3(GetLogicalWidth() * 0.5f, GetLogicalHeight() * 0.3f, 0);
params.siz = XMFLOAT2(400, 200);
params.pivot = XMFLOAT2(0.5f, 0.5f);
params.border_soften = 0.05f;				// <-
params.enableCornerRounding();				// <-
params.corners_rounding[0].radius = 60;	    // <-
params.corners_rounding[0].segments = 12;   // <-
params.corners_rounding[1].radius = 20;	    // <-
params.corners_rounding[1].segments = 6;    // <-
params.corners_rounding[3].radius = 260;    // <-
params.corners_rounding[3].segments = 40;   // <-
wi::image::Draw(wi::texturehelper::getWhite(), params, cmd);

image_renderer

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

No branches or pull requests

2 participants