Use a html renderer in an embedded environment [closed]

99封情书 提交于 2019-12-31 08:29:33

问题


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.

Requirements:

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

  • 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).

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

  • Only C and/or 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...

  • 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.

  • 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.

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

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!


回答1:


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.

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.

Of course, it's written in 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.

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.

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.

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.


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

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:


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.

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 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.

  • 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:


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

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.



来源:https://stackoverflow.com/questions/9398650/use-a-html-renderer-in-an-embedded-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!