Current location - Education and Training Encyclopedia - Graduation thesis - Who can send me an English paper on computers and translate it?
Who can send me an English paper on computers and translate it?
One way to eliminate image flicker in animation design is to use multi-page animation. Using page switching technology to realize multi-page animation. Page switching changes the display page to draw adjacent frames of a given animation sequence. Because images are usually drawn on different pages (not currently visible pages), users will not see drawn or erased images. Therefore, this technology can produce high-quality animation without image flicker. The detailed steps of page switching are as follows.

1. Select a video mode with at least two available display pages (for example, EGA640×200, 16 4 pages in color).

2. Use the -setvideomode () function to get the selected video mode. Draws the first frame in the sequence on the currently displayed page (page 0).

3. When you need to draw the next frame in the sequence, use the -setactivepage () function to set the active page as an alternative display item, and only change the active page (without changing the visible page).

4. Draw the next frame. The frame will be drawn on the standby display page (1 page), while the current page (0 page) will continue to be displayed. When this step is repeated later, delete the existing frame before drawing the new frame.

5. After drawing a new frame, use the -setvisualpage () function to set the visible page as the standby page. At this point, the standby page becomes the current page.

6. Repeat steps 3 to 5 until the animation sequence is completed.

The following program (using Visual C++) demonstrates the actual multi-page animation, and the animation sequence in the example is designed by the readers themselves.

# include & ltconio.h & gt

# include & ltgraph.h}

# include & lttime.h}

# Defines the last frame in the sequence 4/* the total number of frames. */

# Define the DRAW 1 /* code for the drawing operation. */

# Defines the DELTA-X 10 /* pixels that change and move every frame. */

# Defines a half-second 500 /* 500 millisecond delay between frames.

. */

# Define the max X 600 /* max x position before termination.

*/

# Define Settings-Display \ Parameters

\ par-set video mode(-hres 16 color); \par

# Define exit to-do list \par

\ par-set video mode(-default mode); \par

/* * * * Page switching and animation sequence drawing * * */

# Define Page Turning \ par

\ par if(v = = 0)v = 1; \par

else v = 0; \par

-setactivepage(v); \par

-clear screen(-GCLEARSCREEN); \par

-settextposition( 1, 16); \par

-outtext( \par "Example:

Multi-page animation "); \par

Drawing frame (current frame, pixel, pixel); \par

-setvisualpage; \par

Create-Delay (half a second); \par

int px,py; /* Current character position. */

Int page; /* Displays the current page. */

Current frame; /* The current frame displayed. */

Master ()

Settings-display

Loop frame ();

Exit to-do list

Cyclic frame ()

Current frame = 0;

px = 0;

py = 85

page = 0;

while(px & lt; =MAX-X)

Current frame++;

If (current frame & gt last frame)

Current frame = 2;

Turn pages (page)

px = px+DELTA-X;

current-frame = 1;

Turn pages (page)

Drawing frame (frame, x, y)

Int frame, x, y;

Switch (frame)

Case 1:

frame- 1(DRAW,x,y);

Break;

Case 2:

Frame -2 (drawing, x, y);

Break;

Case 3:

Frame -3 (drawing, x, y);

Break;

Case 4:

Frame -4 (drawing, x, y);

Break;

Creation delay (td)

/* * Same as the delay (td) function in Borland C++ *

int td

time-t ts 1,ts2

ts2 = ts 1 = clock();

while(ts 1+TD & gt; ts2)

ts2 = clock();

73 tupmop 1

One way to eliminate image flicker in animation design is to use animated pages. Animated pages switch pages by using technology. Page switching changes the animation sequence in which the display page will be drawn to adjacent frames. Since images are usually drawn in different pages (the current page cannot be seen), users will not see the images erased or drawn. Therefore, this technology can produce high-quality animation and images without flicker. The detailed steps of switching pages are as follows.

1. Select programs that can be used in at least two-page video mode (for example, EGA640 × 200, 16 color 4).

2. Use the -setvideomode () function to get the selected video mode. On the currently displayed page (0), the sequence in the first frame is drawn.

3. When you need to draw the sequence of the next frame, use the -setactivepage () function to activate the page and set it as backup display, just change the activated page (invisible).

4. Draw the next frame. This screen will be drawn on the backup display page (page 1), and the current page (page 0) will continue to be displayed. Repeat this step for pre-cleaning when creating a new map in the future to clear the existing frame.

5. Map out a new future, and use the -setvisualpage () function to see a back-page setting page. At this point, the page has become the back page.

6. Repeat steps 3-5 until the animation series is completed.

The following program (in Visual C++) demonstrates the actual page of animation, and the reader designs an example of animation sequence.

# include & ltconio.h & gt

# include & ltgraph.h)

# include & lttime.h)

# Defines the last frame in the sequence 4/* the total number of frames. * /

# Define the DRAW 1/* code for the drawing operation. * /

# Defines the DELTA-X 10/* pixels that change and move every frame. * /

# Defines a half-second 500/* 500 millisecond delay between frames.

. * /

# Define the max X 600/* max x position before termination.

* /

# Define Settings-Display \ Parameters

\ par-set video mode(-hres 16 color); \ par

# Define exit to-do list \ par

\ par-set video mode(-default mode); \ par

/* * * * Page rendering and animation sequence switching * * */

# Define Page Turning \ par

\ par if(v = = 0)v = 1; \ par

else v = 0; \ par

-setactivepage(v); \ par

-clear screen(-GCLEARSCREEN); \ par

-settextposition ( 1, 16); \ par

-outtext (\ par "Example:

Multi-page animation "); \ par

Drawing frame (current frame, pixel, pixel); \ par

-setvisualpage; \ par

Create-Delay (half a second); \ par

int px,py; /* Current character position. * /

Int page; /* Displays the current page. * /

Current frame; /* The current frame displayed. * /

Master ()

Settings-display

Loop frame ();

Exit to-do list

Cyclic frame ()

Current frame = 0;

px = 0;

py = 85

page = 0;

while(px & lt; = MAX-X)

Current frame++;

If (current frame & gt last frame)

Current frame = 2;

Turn pages (page)

px = px+DELTA-X;

current-frame = 1;

Turn pages (page)

Drawing frame (frame, x, y)

Int frame, x, y;

Switch (frame)

Case 1:

frame- 1 (DRAW,x,y);

Break;

Case 2:

Frame -2 (drawing, x, y);

Break;

Case 3:

Frame -3 (drawing, x, y);

Break;

Case 4:

Frame -4 (drawing, x, y);

Break;

Creation delay (td)

/* * borland c++with delay (td) function * */

int td

time-t ts 1,ts2

ts2 = ts 1 = clock();

while(ts 1+TD & gt; ts2)

ts2 = clock();

73 tupmop 1