Code Analysis of the scroll bar when Windows CE s3c2440a is started

Source: Internet
Author: User

Like Windows XP, Windows CE can still draw a wonderful progress bar. In fact, this operation mainly involves operations on the screen cache. The buffer address image_framebuffer_ua_base_eboot has been provided in the S3C2440 cpu bsp code. The supported video encoding format of this buffer is rgb16, and the default color is white. In this process, unlike EVC, which provides many GDI plotting functions, such as drawing lines and rectangles, all operations start from a vertex, are made of a dot plot into a line, and drawn from a line into a rectangle. It can be found that the entire buffer can be defined as a binary data, each element is a vertex, and each row is a line. The access process is as follows;

  1. * (Embedsky_ LCD _buffer + y * LCD _xsize_tft + x) = 0xf800;

With the dot, we can plot it into a line, the following function;

Uint32 currwidth = 0;
Void drawprocessbar (uint32 total, uint32 current)
{
Uint32 const bar_height = 8;
Uint32 bar_base = LCD _ysize_tft-bar_height;
Int I = (INT) LCD _xsize_tft/8;
Uint32 J;
Int pbcolor = 0xf800; // red
Int bar_width;
// Printk ("tooal = % d, current = % d/N", total, current );
If (total! =-1)
{
J = 0;
Bar_width = (INT) LCD _xsize_tft * (current * 1.0)/Total );
If (bar_width> currwidth)
{
For (; j <bar_height; j ++)
{
Putpixel (bar_width, J + bar_base, pbcolor );
}
Currwidth = bar_width;
}
}

During the Windows CE startup process, You need to draw a scroll bar. Generally, you can place the above Code in the bootloadermain function, and the results have been verified to be good.

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.