+
Skip to content

Conversation

Gaubee
Copy link

@Gaubee Gaubee commented Oct 15, 2025

This feature introduces superellipse (squircle) corner rendering capabilities that enable modern UI aesthetics similar to Apple's design language:

🎨 Features

  • CornerShape enum: Support for circular, superellipse, and custom corner shapes
  • Superellipse struct: Configurable n-value for controlling corner curves (n=2 for circles, higher values for squircles)
  • Enhanced tessellator: Proper rendering of superellipse corners with adjustable precision
  • Style integration: Corner shape properties added to Style and Window decorations
  • Demo showcase: WidgetGallery example displaying various corner shapes and values
  • Backward compatibility: Extends CornerRadius types while maintaining existing API

🔧 Implementation Details

  • Added CornerShape enum with variants for different corner types
  • Implemented Superellipse with configurable exponent value
  • Updated the tessellation pipeline to support curved corners
  • Extended style system to use corner shapes
  • Added comprehensive demo in widget gallery

🎯 Benefits

  • Enables creation of softer, more modern interfaces
  • Particularly useful for Apple-style squircle corners
  • Non-breaking change - existing code continues to work
  • Aligns with web standards for UI design

📸 Screenshots

20251015-134831.mp4

✅ Checklist

  • Followed the "Making a PR" section of CONTRIBUTING.md
  • Keep PR small and focused
  • Descriptive title for changelog
  • Add screenshot or gif
  • Added demo in egui_demo_lib
  • Run cargo fmt and cargo clippy
  • Open as draft for initial review
  • Run ./scripts/check.sh

📝 Related Issues

🤝 Additional Notes

This implementation provides a foundation for more flexible UI design in egui, allowing developers to create more visually appealing applications with modern corner styling options.

Copy link

Preview is being built...

Preview will be available at https://egui-pr-preview.github.io/pr/7636-feature/superellipse-corners

View snapshot changes at kitdiff

This feature introduces superellipse (squircle) corner rendering capabilities:
- Add CornerShape enum with support for circular, superellipse, and custom shapes
- Implement Superellipse struct with configurable n-value for controlling corner curves
- Update tessellator to properly render superellipse corners with adjustable precision
- Add corner shape properties to Style and Window decorations
- Include demo in WidgetGallery showcasing various corner shapes and values
- Extend CornerRadius types with shape information while maintaining backward compatibility

The implementation allows for more modern and aesthetically pleasing UI designs,
particularly useful for creating softer interfaces with Apple-style squircle corners.
@Gaubee Gaubee force-pushed the feature/superellipse-corners branch from b953743 to bb31815 Compare October 15, 2025 05:58
@Gaubee
Copy link
Author

Gaubee commented Oct 15, 2025

in the clippy.toml:

disallowed-methods = [
  # NOTE: There are many things that aren't allowed on wasm,
  # but we cannot disable them all here (because of e.g. https://github.com/rust-lang/rust-clippy/issues/10406)
  # so we do that in `clipppy_wasm.toml` instead.

  { path = "std::env::temp_dir", readon = "Use the tempfile crate instead" },
  { path = "std::panic::catch_unwind", reason = "We compile with `panic = abort" },
  { path = "std::thread::spawn", readon = "Use `std::thread::Builder` and name the thread" },
]

readon or reason

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.

CornerRadius add superellipse support

1 participant

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载