Android Graphics System Description

Source: Internet
Author: User

The Android graphics system adopts the Client/Server architecture. SurfaceFlinger is mainly written by C ++ code. The Client code is divided into two parts. One part is the supplied and used APIs provided by Java, and the other part is the underlying implementation written by C ++.

An important concept and clue in the Android graphics system is surface. View and its subclass, such as TextView and Button, must be painted on the surface. Creates a Canvas object for each surface, but its attributes change frequently. This object is used to manage the drawing operations of a view on the surface, such as drawing points and draw lines. Each canvas object corresponds to a bitmap that stores the content drawn on the surface.

There are several objects closely related to the Surface concept:

1. Java Surface frameworks/base/core/java/android/view/Surface. java ). This object is indirectly called by the application through SurfaceView, ViewRoot, etc.), the application needs to create a surface, and create a canvas at the same time), draw the image to this object and finally deliver it to the screen.

2. C ++ Surface (frameworks/base/libs/ui/Surface. cpp. This object is called by Java Surface through Jni to implement the Java Surface function.

3. ISurface (and its derived class BnSurface ). This object is the interface between the application and the server. C ++ Surface creates this ISurface BnSurface) and sends commands, such as updating the surface content to the screen. The Server accepts the command and performs the corresponding operation.

The functions of android. graphics, android. view, and android. widget are similar to those of other similar graphics libraries such as Qt/Gtk +, which provide basic graphics primitives such as drawing points and setting the image context ). Event mechanism and controls for developing graphical user interfaces. Canvas is used to develop 2D images. Surface represents a surface that can be drawn by the graphic system. You can draw Android images on it.

Graphics-related code is mainly located in the following directories:

 
 
  1. 1、frameworks/base/graphics/java/android/graphics  
  2. 2、frameworks/base/core/java/android/view  
  3. 3、frameworks/base/core/java/android/widget  
  4. 4、frameworks/base/opengl/  
  5. 5、frameworks/base/libs/ui  
  6. 6、frameworks/base/libs/surfaceflinger  
  7. 7、frameworks/base/core/jni/android/graphics  
  8. 8、frameworks/base/core/jni/android/opengl  
  9. 9、frameworks/base/core/jni/android/android_view_*.cpp  
  10. 10、external/skia 

Related Article

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.