MyGit

6.0

mikke89/RmlUi

版本发布时间: 2024-08-27 04:57:53

mikke89/RmlUi最新发布版本:6.0(2024-08-27 04:57:53)

RmlUi 6.0 comes with some of the most visible changes so far, being the biggest release to date. It has taken its time, and I am very happy to finally release it into the wild! The release brings a good selection of smaller and larger goodies for everyone. I want to particularly emphasize three major changes:

The advanced rendering effects include support for the box-shadow, filter, backdrop-filter, and mask-image properties from CSS. We also have support for all the CSS gradients, which can be used in our decorator system and as image masks. With these features you should have the tools to really make those elements pop. These additions also include more subtle but important changes, like making elements with border radius actually clip to the curved border. This has been a large undertaking, I started this work over two years ago, and it has been steadily (and sometimes not so steadily) worked on since then, with a lot of iterations on the implementation and API. Feedback from users during this process has been invaluable! I am quite happy with the end result, and it's nice to see this work finally being released.

For now, only the OpenGL 3 renderer has built-in support for the new effects. The other backends have been updated for the new API, but only support the old feature set. To support all of these features, the render interface needed a thorough update. At the same time, we took this opportunity to simplify and modernize the interface. So please be sure to check the breaking changes if you are upgrading with a custom render interface. We have made sure to make the new advanced effects optional, so you can start with the basics and opt-in to new functions incrementally as you want to expand your supported RCSS feature set.

The layout engine improvements are the very opposite of the advanced effects, they are hidden underneath in the library, not really visible to the end user. Nonetheless, this has been another massive undertaking. The inline layout part of the engine has been rewritten from scratch, and other large parts have been re-architectured. This change improves a lot of subtle layout issues, in the end over a hundred CSS tests have been fixed, and many long standing issues resolved. It also creates a foundation which will make it a lot easier to make changes and fix issues in the future. You can see some screenshots and comparisons to web browsers in the detailed release notes below. This change was in fact merged into master over a year ago. In this case, I am quite pleased that there has not been a lot of reports about it. I take that as an indication that your projects kept working pretty much the same, despite the massive changes underneath. Do expect some layout changes when upgrading from the previous release though, details and solutions are posted below.

Our CMake implementation really used to be a patch-work with an ancient foundation. It was time for a complete rewrite. Special thanks to @hobyst who initiated and layed the groundwork for the new implementation following modern guidelines. It should now be a lot easier to build the library and link to it. This does however involve changes to pretty much all options, targets, and executable names, so be sure to check the detailed release notes below to migrate your existing project.


I want to give a sincere thanks to all the contributors, and everyone active in the community. A lot of effort has been put into the library from a lot of people. Many of the changes in this release come directly from you, and your feedback helps improve the quality of the library. It has almost been a bit hard for me to keep up with everything and to respond as fast as I'd like. But I also need to give myself some breathers from time to time, and contribute with the amount I can.

In addition to all the contributors mentioned in the release notes below, I also want to give a special mention to contributors to the documentation: @ShawnCZek, @viseztrance, @Paril, @LucidSigma, and @slipher. No feature is complete without good documentation, so I appreciate all the help I can get here!

Finally, I want to give a thanks to everyone who contributed with pull requests that in the end didn't end up being merged. Even if they weren't merged, they bring valuable discussion and ideas: @CreatorInDeep, @blaisemccourtney, @JailbreakPapa, @skaarj1989, and @exjam.

I am very much looking forward to seeing what you build with this, have fun! Feel free to share your results with us, either on the gitter chat or in the discussions.

The detailed changelog follows below. Projects coming from previous releases should take a look at the breaking changes, which include tips for migration. The documentation is updated to reflect all the changes in this release.

RmlUi 6.0 Changelog

Table of contents. Turns out linked headers do not work in release notes, but I leave an unlinked version here for a quick overview.

Advanced rendering features

This one has been a long time in the making, now the time has come for one of the biggest additions to the library. Advanced rendering effects are now available, including filters with blur support, box-shadow, advanced gradients, shaders, masks, and clipping of rounded borders.

The original issue is found in #307 and the pull request is #594. Thanks to everyone who provided feedback. Resolves #249, #253, #307, #597, and even addresses #1.

New features

New properties:

New decorators:

The gradients support most of the CSS features and syntax, including angle and to <direction> syntax for direction, multiple color stops, locations in length or percentage units, and up to two locations per color. Please see the decorators documentation for details.

The documentation has been updated to reflect the new features, including the new decorators and properties, with examples and screenshots. The new features are also demonstrated in the new effects sample, so please check that out.

For now, only the OpenGL 3 renderer implements all new rendering features. All other backends have been updated to work with the updated render interface but with their old feature set. For users with custom backends, please see the updated render interface documentation in particular. Here, you will also find a table detailing exactly which functions must be implemented to support particular RCSS features.

Here are some quick RCSS examples taken from the documentation.

decorator: linear-gradient(to bottom, #00f3, #0001, #00f3), linear-gradient(to top right, red, blue);
decorator: radial-gradient(circle farthest-side at center, #ff6b6b, #fec84d, #4ecdc4);
decorator: repeating-conic-gradient(from 90deg, #ffd700, #f06, #ffd700 180deg);
decorator: shader("my_shader") border-box;

filter: brightness(1.2) hue-rotate(90deg) drop-shadow(#f33f 30px 20px 5px);
backdrop-filter: blur(10px);

box-shadow: #f008 40px 30px 0px 0px, #00f8 -40px -30px 0px 0px;
mask-image: conic-gradient(from 45deg, black, transparent, black), image("star.png" cover);

Screenshots

Collage of advanced effects:

Advanced effects demonstration

Masking principles and demonstration:

Mask imaging and demonstration

Improved clipping behavior of nested and transformed elements (also showing improved layouting of positioned boxes):

Clipping comparison of nested and transformed elements

Improved clipping with border-radius:

Clipping comparison of elements with border-radius

Demonstration of the effects sample:

Effects sample video

Major overhaul of the render interface

The render interface has been simplified to ease implementation of basic rendering functionality, while extended to enable the new advanced rendering effects. The new effects are fully opt-in, and can be enabled iteratively to support the features that are most desired for your project. See the updated render interface documentation for how to implement the new functionality. The documentation includes a table detailing which functions must be implemented to support specific RCSS features.

Highlighted changes:

Backward compatible render interface adapter

The render interface changes will require updates for all users writing their own render interface implementation. To smooth the transition, there is a fully backward-compatible adapter for old render interfaces, please see RenderInterfaceCompatibility.h.

  1. In your legacy RenderInterface implementation, derive from Rml::RenderInterfaceCompatibility instead of Rml::RenderInterface.
        #include <RmlUi/Core/RenderInterfaceCompatibility.h>
        class MyRenderInterface : public Rml::RenderInterfaceCompatibility { ... };
    
  2. Use the adapted interface when setting the RmlUi render interface.
        Rml::SetRenderInterface(my_render_interface.GetAdaptedInterface());
    

That's it, and your old renderer should now still work!

It can also be useful to take a closer look at the adapter before migrating your own renderer to the new interface, to see which changes are necessary. Naturally, this adapter won't support any of the new rendering features.

For demonstration purposes, there are two built-in backends implementing the adapter: BackwardCompatible_GLFW_GL2 and BackwardCompatible_GLFW_GL3. Each of the backends use a direct copy of their respective render interface from RmlUi 5.1, only with the above instructions applied. Please take a look if you want to see some examples on how to use this adapter.

Render manager and resources

A new RenderManager is introduced to manage resources and other rendering state. Users don't normally have to interact with this, but for contributors, and for more advanced usages, such as custom decorators, this implies several changes.

The RenderManager can be considered a wrapper around the render interface. All internal calls to the render interface should now go through this class.

Resources from the render interface are now wrapped as unique render resources, which are move-only types that automatically clean up after themselves when they go out of scope. This considerably helps resource management. This also implies changes to many central rendering types.

See this commit message for more details.

Limitations

Filters will only render based on geometry that is visible on-screen. Thus, some filters may be cut off. As an example, an element that is partly clipped with a drop-shadow may have its drop-shadow also clipped, even if it is fully visible. On the other hand, box shadows should always be rendered properly, as they are rendered off-screen and stored in a texture.

Major layout engine improvements

Detailed layout improvements

Here is a more detailed change list resulting from the rewritten inline formatting engine, and some related changes.

Please see the list of breaking changes and solutions at the end of the changelog.

Layout comparisons

Here are some screenshots demonstrating the layout improvements.

inline-formatting-01-mix

The above example demonstrates a variety of inline formatting details, with nested elements and borders (fiddle). We now match nicely with web browsers in such situations. The old behavior has several issues, in particular the elements are not aligned correctly and the border is broken off too early. Note that Firefox in these examples uses a different font, so expect some differences for that reason.

inline-formatting-04-mix

The above shows tests for line splits and borders in particular (fiddle). The old behavior is almost comically broken. The new behavior has for the most part been written from scratch following the CSS specifications, and turns out to nicely match up with Firefox.

inline-formatting-aligned-subtree

Finally, this example tests vertical alignment of inline boxes, and particularly the concept of aligned subtrees (fiddle). Again, we now nicely align with Firefox. The old behavior looks like it just gave up in the middle. I included Chrome here too, since I find it interesting how different it behaves compared to Firefox. In fact, I found a lot of these differences while testing various nuances of inline formatting. In this case, I am quite convinced that Firefox (and we) are doing the right thing and Chrome is not following the specifications.

General layout improvements

CMake modernization

The CMake code has been fully rewritten with modern practices. Special thanks to @hobyst who laid the groundwork for this change, with a solid foundation and great guidelines. #198 #446 #551 #606 (thanks @hobyst)

While modernizing our CMake code, it was clear that we also needed to change our naming conventions. This leads to quite significant breaking changes for building and linking, but the result should make the library a lot easier to work with and link to.

We now try to support all setups including:

  1. Adding the library as a subdirectory directly from CMake.
  2. Building the library "in-source" without installing.
  3. Building and installing the library.
  4. Using pre-built Windows binaries.

It should be a lot easier now to simply point to the built library or sources, and have everything link correctly.

And naturally, we will continue to support package managers however we can, and that is still considered the default recommendation. However, for the most part we rely on contributors to keep supporting this. Please help out with your favorite package manager if you see missing versions, or room for improvements.

Large parts of the CI workflows have also been rewritten to accommodate these changes. Most of the Windows building and packaging procedures have been moved from Appveyor to GitHub Actions, which streamlines our testing and also helps speed up the CI builds.

The build documentation has been updated to reflect all the new changes.

New target names

We now export the following targets:

Target Old target Description
RmlUi::RmlUi Includes all sub-libraries of the project, as listed just below
RmlUi::Core RmlCore The main library
RmlUi::Debugger RmlDebugger The debugger library
RmlUi::Lua RmlLua The Lua plugin (when enabled)

When including RmlUi as a subdirectory, the targets are constructed as aliases. When using pre-built or installed binaries, they are constructed using imported targets, which are available through the exported build targets.

The internal target names have also been changed, although they are typically only needed when exploring or developing the library. They are all lowercase and contain the prefix rmlui_ to avoid colliding with names in any parent projects. Some examples are: rmlui_core, rmlui_debugger, rmlui_sample_invaders, rmlui_tutorial_drag, rmlui_unit_tests, and rmlui_visual_tests.

New library filenames

The library binaries have also changed names. These names would be suffixed by e.g. .dll on Windows, and so on.

Library Old library Description
rmlui RmlCore The core (main) library
rmlui_debugger RmlDebugger The debugger library
rmlui_lua RmlLua The Lua plugin (when enabled)

New option names

We have a new set of CMake naming conventions for the library:

The following table lists all the new option names.

Option Default value Old related option Comment
RMLUI_BACKEND auto SAMPLES_BACKEND
RMLUI_COMPILER_OPTIONS ON Automatically sets recommended compiler flags
RMLUI_CUSTOM_CONFIGURATION OFF CUSTOM_CONFIGURATION
RMLUI_CUSTOM_CONFIGURATION_FILE CUSTOM_CONFIGURATION_FILE
RMLUI_CUSTOM_INCLUDE_DIRS CUSTOM_INCLUDE_DIRS
RMLUI_CUSTOM_LINK_LIBRARIES CUSTOM_LINK_LIBRARIES
RMLUI_CUSTOM_RTTI OFF DISABLE_RTTI_AND_EXCEPTIONS No longer modifies compiler flags - only enables RmlUi's custom RTTI solution so that the user can disable language RTTI and exceptions
RMLUI_FONT_ENGINE freetype NO_FONT_INTERFACE_DEFAULT Now takes a string with one of the options: none, freetype
RMLUI_HARFBUZZ_SAMPLE OFF
RMLUI_INSTALL_RUNTIME_DEPENDENCIES ON Automatically install runtime dependencies on supported platforms (e.g. DLLs)
RMLUI_LOTTIE_PLUGIN OFF ENABLE_LOTTIE_PLUGIN
RMLUI_LUA_BINDINGS OFF BUILD_LUA_BINDINGS
RMLUI_LUA_BINDINGS_LIBRARY lua BUILD_LUA_BINDINGS_FOR_LUAJIT Now takes a string with one of the options: lua, lua_as_cxx, luajit
RMLUI_MATRIX_ROW_MAJOR OFF MATRIX_ROW_MAJOR
RMLUI_PRECOMPILED_HEADERS ON ENABLE_PRECOMPILED_HEADERS
RMLUI_SAMPLES OFF BUILD_SAMPLES
RMLUI_SVG_PLUGIN OFF ENABLE_SVG_PLUGIN
RMLUI_THIRDPARTY_CONTAINERS ON NO_THIRDPARTY_CONTAINERS
RMLUI_TRACY_CONFIGURATION ON New option for multi-config generators to add Tracy as a separate configuration.
RMLUI_TRACY_MEMORY_PROFILING ON New option to overload global operator new/delete for memory inspection with Tracy.
RMLUI_TRACY_PROFILING OFF ENABLE_TRACY_PROFILING
- VISUAL_TESTS_CAPTURE_DIRECTORY Replaced with environment variable RMLUI_VISUAL_TESTS_CAPTURE_DIRECTORY
- VISUAL_TESTS_COMPARE_DIRECTORY Replaced with environment variable RMLUI_VISUAL_TESTS_COMPARE_DIRECTORY
- VISUAL_TESTS_RML_DIRECTORIES Replaced with environment variable RMLUI_VISUAL_TESTS_RML_DIRECTORIES

For reference, the following options have not changed names, as these are standard options used by CMake.

Unchanged options Default value
CMAKE_BUILD_TYPE
BUILD_SHARED_LIBS ON
BUILD_TESTING OFF

New exported definitions

Certain CMake options, when changed from their default value, require clients to set definitions before including RmlUi. These are automatically set when using the exported CMake targets, otherwise users will need to define them manually.

Some exported definition names have changed, as follows.

Definition Old definition Related CMake option
RMLUI_TRACY_PROFILING RMLUI_ENABLE_PROFILING RMLUI_TRACY_PROFILING
RMLUI_CUSTOM_RTTI RMLUI_USE_CUSTOM_RTTI RMLUI_CUSTOM_RTTI

For reference, here follows all other possibly exported definitions.

Definition Related CMake option
RMLUI_STATIC_LIB BUILD_SHARED_LIBS
RMLUI_NO_THIRDPARTY_CONTAINERS RMLUI_THIRDPARTY_CONTAINERS
RMLUI_MATRIX_ROW_MAJOR RMLUI_MATRIX_ROW_MAJOR
RMLUI_CUSTOM_CONFIGURATION_FILE RMLUI_CUSTOM_CONFIGURATION_FILE

CMake presets

We now have CMake presets:

The presets can be combined with other options, like CMAKE_BUILD_TYPE to select the desired build type when using single-configuration generators.

Spatial navigation

Introduce spatial navigation for keyboards and other input devices. This determines how the focus is moved when pressing one of the navigation direction buttons. #142 #519 #524 (thanks @gleblebedev)

RCSS example usage:

input { nav: auto; nav-right: #ok_button; }
.menu_item { nav: vertical; border: #000 3px; }
.menu_item:focus-visible { border-color: #ff3; }

Text shaping and font engine

Screenshots of the HarfBuzz sample showing Arabic text properly rendered with the HarfBuzz font engine, and compared to the default font engine:

HarfBuzz font engine vs default font engine comparison

Elements

Text input widget

The following improvements apply to both the textarea and text input elements.

IME sample screenshot:

IME sample screenshots

Utilities

Data bindings

Debugger plugin

Lua plugin

System interface

General improvements

General fixes

Build improvements

Backends

Breaking changes

CMake and linking

Layout

Expect some possible layout shifts in existing documents, mainly due to better CSS conformance. Detailed notes are available above. Here are some particular situations where layout output may change, and ways to address them:

Elements

Core types

Core functions

RCSS

Render interface

Affects all users with a custom backend renderer.

Render manager

Affects users with custom decorators and other more advanced usage with rendering commands.

Font engine interface

The font engine interface has been reworked to encompass new features, to simplify, and to modernize.

Removed deprecated functionality

New Contributors

Full Changelog: https://github.com/mikke89/RmlUi/compare/5.1...6.0

相关地址:原始地址 下载(tar) 下载(zip)

1、 RmlUi-vs2019-win32.zip 34.43MB

2、 RmlUi-vs2019-win64.zip 39.91MB

3、 samples-win64.zip 5.01MB

查看:2024-08-27发行的版本