Implementing image rotation in J2ME/MIDP

Source: Internet
Author: User
Tags network function

J2ME is a standard version of Java (J2SE) for mobile phones, PDAs and other types of mobile and embedded devices, a reduced version of the support of many vendors and widely used mobile device development platform. Figure I shows the architecture of the J2ME technology. It is divided into three layers: virtual machine layer, configuration layer, and simple surface layer. The configuration layer (Configuration) describes and classifies disparate embedded devices in a functional description. It has limited computational functions, small memory, limited power equipment, defined in the CLDC (limited connection equipment Configuration) specification, such devices have PDA, mobile phones, etc., the relatively good computing power, relatively large memory, power supply more adequate equipment, defined in the CDC (Connection device configuration) specification, This type of equipment has refrigerators, set-top boxes, on-board computing equipment.

Virtual Machine is based on the host operating system and implements a Java virtual machine in one configuration. The CDC configuration corresponds to the virtual machine called CVM,CLDC the corresponding virtual machine called KVM.

Profile is built on top of the configuration layer, providing a higher level of user-oriented functionality such as user interface, network, data storage, etc. Basic specification (Foundation profile) and personal specification (Personal profiles) are two important specifications on the CDC, and the Mobile Information Device specification (MIDP) and the PDA specification (PDAP) are two important specifications on CLDC. Currently, the development of wireless applications is primarily based on MIDP.

The configuration layer and the simple surface layer together constitute the J2ME operating environment. such as the CLDC/MIDP architecture constructs the mobile phone application development and the running environment. The image rotation algorithm implemented in this paper is based on this architecture.

Figure J2ME Architecture It should be noted that these specifications are also evolving. If the computing power of many of the early devices is very limited, CLDC1.0 only supports integer values. Later, with the improvement of the operation ability of the equipment, CLDC1.0 developed to the CLDC1.1, and added to the support of floating-point arithmetic. As for the MIDP specification, from 1.0 to 2.0, it strengthens the support for game development by expanding the function of class and interface, increases the image processing function (rotation to use), enhances the support to the network function, such as serial port, socket, HTTPS, etc.

Data base of 2d rotation

Consider the rotation of a single point in Cartesian coordinate system. As shown in Figure two, here the point P (x,y) to the Origin o around O point counterclockwise rotation angle theta after point deflection (x′,y′). By the geometrical meaning of trigonometric functions, there are x = R*cosα,y = R*si nα and x′= R*cos (α+θ), y′= R*sin (α+θ), which are introduced:

x′= x * cosθ–y * sinθ

Y′= y * cosθ+ x * sinθ

When the rotation point is generalized to Q (x0,y0), it is obtained:

x′= x0 + (x-x0) cosθ-(y-y0) sinθ

y′= y0 + (y-y0) cosθ+ (x-x0) sinθ

At development time, we use the device coordinate system, which takes the upper-left corner of the screen as the coordinate origin and the y-axis direction downward. At this point, we might as well see Theta as the angle of rotation clockwise, so that the formula above is still valid.


Fig. 22 rotation algorithm for the rotation general image of D point

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.