在嵌入式环境中使用html渲染器。

时间:2022-11-19 09:58:52

I'm working on a project where I will design a GUI for an embedded device and would love to go with HTML for this. I hope you guys can help me find a render engine that suits my needs.

我正在做一个项目,我将为一个嵌入式设备设计一个GUI,并且喜欢用HTML来做这个。我希望你们能帮我找到一个适合我需要的渲染引擎。

Requirements:

要求:

  • The web-page must be rendered into a memory buffer. I will then transfer the memory buffer to the display.

    web页面必须呈现到内存缓冲区中。然后,我将把内存缓冲区转移到显示中。

  • I must be notified though callback or event that the render engine need to fetch a new item. HTML page, image, etc. The reason for this is that I must fetch the resource and feed it to the render engine (the reason is that the device does not have TCP/IP in all configurations and will then need to fetch the item over serial line, and also for security I need to validate that the request is allowed).

    必须通过回调或事件通知我呈现引擎需要获取新项。HTML页面、图像等等。这样做的原因是,我必须获取资源和饲料的渲染引擎(原因是设备没有各配置TCP / IP,将需要获取项目串行线,和安全,我需要验证请求允许)。

  • I must be able to inject mouse and keyboard events into the rendering engine.

    我必须能够将鼠标和键盘事件注入渲染引擎。

  • Only C and/or C++

    只有C和/或c++

  • Must be easily portable and lack dependencies to libraries that only exist for win/linux/mac. The device I have runs a custom OS...

    必须很容易移植,并且对只有win/linux/mac的库缺乏依赖。我的设备运行一个自定义操作系统……

  • Small footprint and memory consumption, I can probably get away with 10MB footprint and 5-10 MB allocated memory during rendering. But not much more.

    内存占用和内存占用都很小,我可以在渲染过程中使用10MB内存和5- 10MB内存。但不是更多。

  • Both open source as well as commercial solutions are welcome

    开源和商业解决方案都是受欢迎的

  • I do NOT need full HTML5 and CSS3 support, I mean if I can use "basic HTML and some CSS" I'm more than happy.

    我不需要完全的HTML5和CSS3支持,我的意思是,如果我可以使用“基本的HTML和一些CSS”,我很高兴。

I have looked at some WebKit, chromium, gecko, berkelium and awesomium but not really found that they fit my needs.

我看过一些WebKit, chromium, gecko, berkelium和awesomium,但并没有发现它们真的适合我的需要。

Is there anything out there that comes close to what I need? Or should I just give up this idea and build the GUI in some other way? I appreciate any help!

有什么东西接近我需要的吗?或者我应该放弃这个想法,以其他方式构建GUI吗?我很感谢任何帮助!

3 个解决方案

#1


30  

Good question! It turns out there are a few options within this space, and as you've surmised, many of them are based on Webkit. Some of them aren't, though, and those are the ones that I believe you're most interested in.

好问题!事实证明,在这个空间中有一些选项,正如您所猜测的,其中许多都是基于Webkit的。但有些不是,那些是我相信你们最感兴趣的。

Links

The simplest, 0th-level browser that's going to meet your needs is the graphical version of the Links web browser. It's suitably cross-platform (admittedly, you will require some of the libraries from Cygwin for Windows environments), open source, carries a small memory footprint, and in some of its forked or enhanced incarnations (for example, Elinks), has enhanced functionality like Javascript support, full mouse functionality, and the bells and whistles that you desire in your problem statement.

要满足您的需求,最简单的第0级浏览器是链接web浏览器的图形化版本。适当跨平台(诚然,您将需要一些库从Cygwin Windows环境),开源的,带有小的内存占用,和一些叉形的或增强的化身(例如,Elinks),增强功能像Javascript支持,完整的鼠标功能,附属功能,你想要在你的问题陈述。

Of course, it's written in C.

当然,它是用C写的。

Konqueror/Embedded

Exploring some of the other options within this space, Konqueror/Embedded is something to consider and watch in the future. Yes, it is based on Qt/Embedded and Webkit (mumble mumble), but they're aiming to provide a slimmed down version of both their browser and their library stack to meet this need specifically. Once again, Windows is going to be the odd child out here, but it's workable.

在这个空间中探索其他一些选项,Konqueror/Embedded是未来需要考虑和关注的问题。是的,它基于Qt/嵌入式和Webkit(听不清),但是他们的目标是提供他们的浏览器和库堆栈的精简版本,以满足这一特殊需求。再说一遍,Windows将会是一个奇怪的子元素,但它是可行的。

Fennec

One last cross-platform option to explore is the slim version of Mozilla Firefox, Fennec. While providing a much larger code base, Mozilla is working on its embedded version very aggressively, and any help you can provide here would be greatly appreciated. From what I understand, the slimmed version is still pre-alpha (Fennec, however, lives on), but it should become a workable option in the future.

最后一个跨平台的选择是Mozilla Firefox的精简版,Fennec。在提供更大的代码基础的同时,Mozilla正在非常积极地开发其嵌入式版本,如果您能在这里提供任何帮助,我们将非常感激。据我所知,瘦身版仍然是前alpha版(不过,Fennec仍将继续),但未来它将成为一个可行的选择。

And a Gamut of Others to Explore

In addition to the gamut of web browsers currently competing in this space, proprietary options like ANT Galio may also meet your needs. It seems there are many other proprietary solutions out there, but the majority of them (for example, Internet Explorer Mobile, Mobile Safari) only service a small number of platforms. Good, proprietary, cross-platform solutions that aren't based on Webkit seem to be quite rare.

除了当前在这个空间中竞争的web浏览器的范围之外,像ANT Galio这样的专有选项也可以满足您的需要。似乎还有许多其他专有的解决方案,但是大多数(例如,Internet Explorer Mobile, Mobile Safari)只服务于少量的平台。优秀的、专有的、跨平台的、不基于Webkit的解决方案似乎非常罕见。

SpliFF also offered an excellent suggestion in his answer: try libRocket. As he recommends, it's lightweight, cross-platform, currently and actively maintained, easy for you to hook into, and provides for the automation cases that you seek. In this case, it's programmed in C++, with Python bindings for additional convenience.

斯普利夫在他的回答中也提出了一个很好的建议:试试libRocket。正如他所建议的,它是轻量级的,跨平台的,目前和积极维护,便于您连接,并提供您所寻求的自动化案例。在本例中,它是用c++编写的,带有Python绑定,以提供额外的方便。


In conclusion, given your needs, you'll still need to evaluate the strengths, weaknesses, and API specifications for the options listed above.

总之,考虑到您的需求,您仍然需要为上面列出的选项评估优缺点和API规范。

I recommend starting with Links, because it's the most feature-rich and robust option while optimizing on a very small memory footprint and codebase. Its biggest strength is that this was a design goal from the outset, and the entire code tree is built with this design philosophy in mind.

我建议从链接开始,因为它是功能最丰富、最健壮的选项,同时在非常小的内存占用和代码库上进行优化。它最大的优点是,这从一开始就是一个设计目标,整个代码树都是基于这种设计理念构建的。

Do let us know what you go for. This is a common enough need in the community that I'm sure others will benefit from your experience.

一定要让我们知道你想要什么。这在社区中是很常见的,我相信其他人会从你的经验中受益。

#2


11  

Have a look at librocket. It meets your requirements of being HTML+CSS, lightweight, handling events and rendering to a buffer. I looked though a bunch of projects recently looking for basically what you asked and this was the match I found.

看看利布罗克特。它满足了HTML+CSS、轻量级、事件处理和缓存呈现的要求。最近我看了很多项目,基本上都是你问的,这就是我找到的匹配。

libRocket is the C++ user interface middleware package based on the HTML and CSS standards. It is designed as a complete solution for any project's interface needs.

libRocket是基于HTML和CSS标准的c++用户界面中间件包。它被设计成满足任何项目的接口需求的完整解决方案。

libRocket uses the time-tested open standards XHTML1.0 and CSS2.0 (while borrowing features from HTML5 and CSS3), and extends them with features suited towards real-time applications. Because of this, you don't have to learn a whole new proprietary technology like other packages in this middleware space.

libRocket使用经过时间考验的开放标准XHTML1.0和CSS2.0(同时借鉴了HTML5和CSS3的特性),并使用适合于实时应用的特性来扩展它们。正因为如此,您不必像这个中间件空间中的其他包一样学习一种全新的专有技术。

* Cross platform architecture (Windows, Mac, Linux, iPhone, ...).
* Dynamic layout system.
* Efficient application-wide styling, with a custom-built templating engine.
* Fully featured user control set: buttons, sliders, drop-downs, etc.
* Runtime visual debugging suite.
* Easily integrated and extensible with Python scripting.

* Abstracted interfaces for plugging in to any game engine (samples for OpenGL, DirectX and Ogre3d).
* Decorator engine allowing custom application-specific effects that can be applied to any element.
* Generic event system that binds seamlessly into existing projects.

#3


3  

Have a look at DS Organize, a homebrew DS browser, and also ES Operating System by Google (for an OS originally developed by Nintendo).

看看DS组织,一个自制的DS浏览器,以及谷歌的操作系统(对于一个最初由任天堂开发的操作系统)。

I have suggested looking at DS Organize as the Nintendo DS has only 4MB of RAM (8MB with the memory extension that most DS browsers use). And you might also be able to get away with rendering directly to VRAM, saving you a few 100kb, depending on your memory model and how much freedom you have with VRAM writes outside of VBlank.

我建议看一下DS组织,因为任天堂DS只有4MB内存(8MB内存,大多数DS浏览器都使用内存扩展)。您也可以直接向VRAM渲染,节省100kb,这取决于您的内存模型和VRAM在VBlank之外的写的*度。

#1


30  

Good question! It turns out there are a few options within this space, and as you've surmised, many of them are based on Webkit. Some of them aren't, though, and those are the ones that I believe you're most interested in.

好问题!事实证明,在这个空间中有一些选项,正如您所猜测的,其中许多都是基于Webkit的。但有些不是,那些是我相信你们最感兴趣的。

Links

The simplest, 0th-level browser that's going to meet your needs is the graphical version of the Links web browser. It's suitably cross-platform (admittedly, you will require some of the libraries from Cygwin for Windows environments), open source, carries a small memory footprint, and in some of its forked or enhanced incarnations (for example, Elinks), has enhanced functionality like Javascript support, full mouse functionality, and the bells and whistles that you desire in your problem statement.

要满足您的需求,最简单的第0级浏览器是链接web浏览器的图形化版本。适当跨平台(诚然,您将需要一些库从Cygwin Windows环境),开源的,带有小的内存占用,和一些叉形的或增强的化身(例如,Elinks),增强功能像Javascript支持,完整的鼠标功能,附属功能,你想要在你的问题陈述。

Of course, it's written in C.

当然,它是用C写的。

Konqueror/Embedded

Exploring some of the other options within this space, Konqueror/Embedded is something to consider and watch in the future. Yes, it is based on Qt/Embedded and Webkit (mumble mumble), but they're aiming to provide a slimmed down version of both their browser and their library stack to meet this need specifically. Once again, Windows is going to be the odd child out here, but it's workable.

在这个空间中探索其他一些选项,Konqueror/Embedded是未来需要考虑和关注的问题。是的,它基于Qt/嵌入式和Webkit(听不清),但是他们的目标是提供他们的浏览器和库堆栈的精简版本,以满足这一特殊需求。再说一遍,Windows将会是一个奇怪的子元素,但它是可行的。

Fennec

One last cross-platform option to explore is the slim version of Mozilla Firefox, Fennec. While providing a much larger code base, Mozilla is working on its embedded version very aggressively, and any help you can provide here would be greatly appreciated. From what I understand, the slimmed version is still pre-alpha (Fennec, however, lives on), but it should become a workable option in the future.

最后一个跨平台的选择是Mozilla Firefox的精简版,Fennec。在提供更大的代码基础的同时,Mozilla正在非常积极地开发其嵌入式版本,如果您能在这里提供任何帮助,我们将非常感激。据我所知,瘦身版仍然是前alpha版(不过,Fennec仍将继续),但未来它将成为一个可行的选择。

And a Gamut of Others to Explore

In addition to the gamut of web browsers currently competing in this space, proprietary options like ANT Galio may also meet your needs. It seems there are many other proprietary solutions out there, but the majority of them (for example, Internet Explorer Mobile, Mobile Safari) only service a small number of platforms. Good, proprietary, cross-platform solutions that aren't based on Webkit seem to be quite rare.

除了当前在这个空间中竞争的web浏览器的范围之外,像ANT Galio这样的专有选项也可以满足您的需要。似乎还有许多其他专有的解决方案,但是大多数(例如,Internet Explorer Mobile, Mobile Safari)只服务于少量的平台。优秀的、专有的、跨平台的、不基于Webkit的解决方案似乎非常罕见。

SpliFF also offered an excellent suggestion in his answer: try libRocket. As he recommends, it's lightweight, cross-platform, currently and actively maintained, easy for you to hook into, and provides for the automation cases that you seek. In this case, it's programmed in C++, with Python bindings for additional convenience.

斯普利夫在他的回答中也提出了一个很好的建议:试试libRocket。正如他所建议的,它是轻量级的,跨平台的,目前和积极维护,便于您连接,并提供您所寻求的自动化案例。在本例中,它是用c++编写的,带有Python绑定,以提供额外的方便。


In conclusion, given your needs, you'll still need to evaluate the strengths, weaknesses, and API specifications for the options listed above.

总之,考虑到您的需求,您仍然需要为上面列出的选项评估优缺点和API规范。

I recommend starting with Links, because it's the most feature-rich and robust option while optimizing on a very small memory footprint and codebase. Its biggest strength is that this was a design goal from the outset, and the entire code tree is built with this design philosophy in mind.

我建议从链接开始,因为它是功能最丰富、最健壮的选项,同时在非常小的内存占用和代码库上进行优化。它最大的优点是,这从一开始就是一个设计目标,整个代码树都是基于这种设计理念构建的。

Do let us know what you go for. This is a common enough need in the community that I'm sure others will benefit from your experience.

一定要让我们知道你想要什么。这在社区中是很常见的,我相信其他人会从你的经验中受益。

#2


11  

Have a look at librocket. It meets your requirements of being HTML+CSS, lightweight, handling events and rendering to a buffer. I looked though a bunch of projects recently looking for basically what you asked and this was the match I found.

看看利布罗克特。它满足了HTML+CSS、轻量级、事件处理和缓存呈现的要求。最近我看了很多项目,基本上都是你问的,这就是我找到的匹配。

libRocket is the C++ user interface middleware package based on the HTML and CSS standards. It is designed as a complete solution for any project's interface needs.

libRocket是基于HTML和CSS标准的c++用户界面中间件包。它被设计成满足任何项目的接口需求的完整解决方案。

libRocket uses the time-tested open standards XHTML1.0 and CSS2.0 (while borrowing features from HTML5 and CSS3), and extends them with features suited towards real-time applications. Because of this, you don't have to learn a whole new proprietary technology like other packages in this middleware space.

libRocket使用经过时间考验的开放标准XHTML1.0和CSS2.0(同时借鉴了HTML5和CSS3的特性),并使用适合于实时应用的特性来扩展它们。正因为如此,您不必像这个中间件空间中的其他包一样学习一种全新的专有技术。

* Cross platform architecture (Windows, Mac, Linux, iPhone, ...).
* Dynamic layout system.
* Efficient application-wide styling, with a custom-built templating engine.
* Fully featured user control set: buttons, sliders, drop-downs, etc.
* Runtime visual debugging suite.
* Easily integrated and extensible with Python scripting.

* Abstracted interfaces for plugging in to any game engine (samples for OpenGL, DirectX and Ogre3d).
* Decorator engine allowing custom application-specific effects that can be applied to any element.
* Generic event system that binds seamlessly into existing projects.

#3


3  

Have a look at DS Organize, a homebrew DS browser, and also ES Operating System by Google (for an OS originally developed by Nintendo).

看看DS组织,一个自制的DS浏览器,以及谷歌的操作系统(对于一个最初由任天堂开发的操作系统)。

I have suggested looking at DS Organize as the Nintendo DS has only 4MB of RAM (8MB with the memory extension that most DS browsers use). And you might also be able to get away with rendering directly to VRAM, saving you a few 100kb, depending on your memory model and how much freedom you have with VRAM writes outside of VBlank.

我建议看一下DS组织,因为任天堂DS只有4MB内存(8MB内存,大多数DS浏览器都使用内存扩展)。您也可以直接向VRAM渲染,节省100kb,这取决于您的内存模型和VRAM在VBlank之外的写的*度。