Share several common embedded Linux GUI and its features-dry goods

Source: Internet
Author: User
Tags gtk

With the rapid development of Internet and network and gradually entering into people's families, the trend of integration of consumer electronics, computer and communication (3C) is becoming more and more obvious, and embedded system has become the hotspot of research and application. Embedded real-time Linux operating system is cheap, powerful and easy to transplant and is being widely adopted, become a new force, of course, the eyes of the people have already seen the development and prospects. Now with WAP mobile phones, PDAs, set-top boxes, and DVD/VCD players have been rapidly popularized, the user of these handheld devices GUI put forward a higher demand, hope to see like a PC to have a beautiful GUI. GUI has become a bridge of communication between human and machine, and the requirement of embedded system to GUI is more and more high, and all of which require a light, low resource, high performance, high reliability, configurable and beautiful GUI support. Let's take a look at the following:
1 graphical interface Tools for Java
Java technology is a great technology for servers, PCs, and embedded systems. Because of its cross-platform characteristics. Java's application to servers and desktops has been very successful. On the GUI side, however, Java uses only a very limited number of features to build a graphical user interface. The idea is to use a platform-agnostic Java application interface packaged into different operating systems to develop a local graphical user interface, called an abstract window tool (AWT). Only common parts such as file fields, text areas, selection boxes, radio buttons, list boxes, and buttons are supported by AWT, and the feature support for graphics and images is very limited, that is, only enough to build a simple applet program. Recognizing the need for more advanced graphical user interface components and graphics capabilities, Sun developed the Swing,java 2d,java3d, image input/output, and Java advanced Image (JAI). Swing is a standard API (application interface) for building Java graphical interfaces, and some AWT classes are based on swing. It has a complete set of components from buttons to file fields, tables, tree types, and file editors. Instead of relying on local parts of the operating system, these components are drawn with original graphics like straight lines, rectangles, and text. This painting represents a sense of plug-in, it can imitate the local sense of the concept. SWT is based on Java development, it is designed to maximize the operating system of the graphical components of the API, that is, as long as the operating system provides the corresponding graphics components, then SWT is simply the use of JNI technology calls them, only those components not provided in the operating system, SWT does a simulation of its own implementation. SWT also provides direct access to the operating system's local graphical user interface, so SWT-based Java applications have a local graphical user interface and can be integrated with local applications and components. Using SWT to develop packages, simple, cross-platform, reliable, and so on, the advantages of these Jaya languages are gradually merging into the application development of the graphical interface. Another door to success in the Java language is gradually opening up.

Architecture of the 2 SWT+GTKFB graphics system

Architecture of 2.1 SWT+GTKFB graphics system

2.1.1 SWT

SWT is at the top of the system, and it is part of the advanced library of functions needed to design graphical interfaces with AWT and swing in Java. And SWT has improved on some issues with AWT and swing, and now it has evolved into a set of graphical component functions that are not related to the operating system. In the production of components to use the appropriate simulation, in the basic components are the original operating system, for more complex components to use the simulation technology. SWT-based Java applications have a local graphical user interface and can be integrated with local applications, as well as parts.

SWT is a library of advanced graphics components developed in the Java language, and 2 shows that SWT uses the operating system's resources directly on the Java side via JNI (Java Native InteRFace) technology to invoke the GTKFB of the Native side. JNI technology enables SWT programs to collaborate with native-side code written in other languages, integrate them together, and enable SWT code running in the JVM (Jaava virtual machines) to call GTKFB library functions or other programs, and using the invocation API, Java virtual machines can be embedded in native-side applications. The JNI interface is bidirectional, equivalent to a bridge and link, which connects the SWT code with the GTKFB code on the native side.

2.1.2 GTK Library

As shown in 1, GTK uses several connection libraries, such as the glib library for basic data types, which consists of five parts of the base class, the core application support class, the utility class, the data class, and the object system class.

Pango is a full-featured framework for the layout and display of internationalized text. Pango can handle text that is arranged in a non-left-to-right direction, and can easily manage complex languages and even handle different forms of correspondence depending on the environment in which they are used. For example, it supports bidirectional text, which allows the user to mix left-to-right text and right-to-left text, as well as plug-ins that determine the shapes of various complex text, such as Arabic and Tamil. Pango is not only internationalized, but the Pango library can handle the display of anti-aliasing font text well with the support of Xft and Xrender.

Pango also supports a variety of graphic formats such as Libpng,libjpeg,libtiff and Framebuffer port for FreeType. In fact, GTK provides GDK-PIXBUF,GDK and GTK three connection libraries, where GDK-PIXBUF allows us to do related image work, GDK is the abstraction layer of the window drawing system, framebuffer related work is mostly done here, GTK is a high-level application interface.

ATK (accessibility Toolkit) Accessibility Toolkit. GTK leverages ATK to make it possible for people with disabilities, such as poor eyesight or mobility, to interact with GTK applications.

How the 2.1.3 GTKFB works

DIRECTFB access to graphics hardware devices relies on the kernel interface provided by the operating system, which is the frame buffer device (FrameBuffer). Framebuffer actually uses a piece of hardware to make a bridge between the video card and the software, and the Linux kernel opens it up so that the user's program can access the video card through block memory. For example, set the display resolution and number of colors, access to the display memory area. Different Linux needs to provide drivers for different display hardware framebuffer, which means that DIRECTFB needs to run on Frambuffer, while the Linux kernel provides framebuffer drivers for common chips.

When an application connects to GTKFB, it calls Gtk_init (), 3, when GTKFB starts the Framebiffer of Linux, sets the resolution and number of colors, and then turns on peripherals such as the keyboard and mouse (PDA Open button and touch screen). Then go to the specific directory to read the font, and finally to the window and event management to initialize the operation. The GTKFB can support 8, 16, 24, 32BPP framebuffer.

To perform a specific graphics operation, the DIRECTFB chip driver accesses the I/O port of the graphics device memory map and passes the command to the accelerator engine of the graphics device card. The actual hardware acceleration is done entirely within the user space.

Advantages of the 2.2 SWT+GTKFB graphics system

2.2.1 Low memory consumption, fast running speed especially suitable for embedded products

Since GTKFB runs directly above the Framebufer and skips the X-system, it saves the resources of X server, which makes the memory consumption and speed significantly improved. In addition, the JNI technology is used to improve the speed and response of the program, and it can meet the real-time application situations with more stringent requirements.

Good stability of 2.2.2 system

The stability of SWT is due to the design concept of SWT. SWT maximizes the operating system's graphical component API, which means that, as long as the operating system provides the corresponding graphical components, SWT only uses JNI technology to invoke them, only those components not provided in the operating system, SWT to do a simulation of their own implementation. It can be seen that the stability of SWT performance depends largely on the stability of the graphics component of the corresponding operating system.

2.2.3 easy to migrate and share

SWT's API and desktop editions are identical, so the code can be easily ported and shared between desktop and embedded devices.

2.2.4 Small Configurable

SWT uses the LGPL authorization method, users can freely even encourage the modification of the source code to better meet the needs of users, it is easy to tailor the user's needs to the specific SWT+GTKFB, according to the LGPL license, users need to publish the modified source code, but users do not have to publish the source code of the self-contained application.

2.2.5 Easy to develop

SWT is developed in the Java language, and has the characteristics of platform independence, object-oriented, portable, security and other Java languages. Users can easily develop widgets that meet their needs based on the SWT-provided widgets (widgets), and easily use these widgets to build applications.

Realization of 3 SWT+GTKFB graphics system

3.1 Pre-preparation

To compile and install SWT+GTKFB in Linux, first download the following packages: Pkg-config, GLIB2.X;ATK, Pango, DIRECTFB, gtk+2.x. Next download swt.tgr.gz.

The next step is to create the SWT and GTK two directories under the/home/xxx/directory and set the environment variables. As follows:

Export Swt_home=/home/xxx/swtexport swt_home=/home/xxx/gtkexport pkg_config_path= $GTK _home/lib/pkgconfigexport LD_ Library_path= $GTK _home/lib; $LD _library_path also add "/home/xxx/gtk/bin" to the system's environment variable under PATH.

3.2 Compiling and installing gtk+2.0

3.2.1 Compiling and installing Pkg-config

Tar zxvf glib-2.0.6.tar.gz-c $GTK _home/src

CD $GTK home/src/glib-2.0.6

。 /configure--prefix= $GTK _home

Make

Make InSTall

3.2.2 Compiling and installing ATK

Tar zxvf atk-1.0.1.tar.gz-c $GTK _home/src

CD $GTK _home/src/atk-1.0.1

。 /configure--prefix= $GTK _home

Make

Make install

3.2.3 Compiling and installing Pango, Direct FB, gtk+2.0, swt-forgtk2.2

Steps similar to ATK installation.

4 application prospect of embedded Linux GUI

Embedded Linux GUI has many application fields, which can be used in the market of household appliances, commercial market, industrial and automation market, defense market, communication market, etc. For example, in the communications market, mobile phones, video telephony, set-top boxes, etc. may become the operating platform of embedded linu.x, a user-friendly interface is to win the consumer key factors. Therefore, embedded Linux graphics system will play a more important role. If you have learned to embed at this time, it will be a very fortunate thing. But you want to learn to find no direction without resources, you can also private me. I believe I can give you a lot of help.

In the next few years, the embedded Linux GUI will evolve in the following directions: first, lightweight, resource-intensive, and do not want to be built on a huge, cumbersome, system-intensive operating system and GUI. Second, high-performance, high-reliability, especially industrial real-time control system, the demand for real-time is very high, and more than the embedded system, the GUI requirements are higher. Third, configurable, we must be aware that the embedded system is a custom device, they have different requirements for the GUI, some systems only require some graphics functions, and some systems require a complete GUI support, therefore, the GUI must be customizable.

Share several common embedded Linux GUI and its features-dry goods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.