splash screen with a variety of dynamic effects

Source: Internet
Author: User

The use of splash screen is very common in all kinds of software, but it is rare to have dynamic effect. Today accidentally made by ACDSee screen saver to get some inspiration and reference to Li Jianjue written "splash screen graphics special effects of the realization of", special proposed to discuss with you, welcome to advise.

In fact, my method is also using the building block method, but if the use of random building blocks, we will find that as the number of blocks to increase the execution time will increase, so I took the step to control the position of the next point.

First of all, the new class framework completely copied the "Splash screen graphics special effects of the implementation of", but deleted the dynamic splash screen of the specific implementation code, all replaced by my own. Added a series of parameters.

int m_nBlockNum;  //将图片在X,Y方向均分为多少份
int m_nXStep;    //X方向的步长
int m_nYStep;    //Y方向的步长,步长决定了下一点的位置
int m_nDelay;    //绘制完一组点(m_nBlockNum个)后的延时
BOOL m_bDirection;  //表示第一个点从何处开始TRUE:左上,FLASE:右下

In order to speed up the display, a group of displays, so that two steps are used in the program, one is the step within the group, one is the outer step of the group, that is, the double for loop is used. The loop within the group is very simple, just show each area, x,y direction to increase the corresponding step size respectively.

for ( j=0; j<m_nBlockNum; j++ )
{
  if ( x >= m_nBlockNum )
  {
    x -= m_nBlockNum;
  }
  if ( y >= m_nBlockNum )
  {
    y -= m_nBlockNum;
  }
  dc.StretchBlt(
    x*stepx, y*stepy, //目标设备逻辑横、纵坐标
    stepx,stepy, //显示位图的像素宽、高度
    &MemDC, //位图内存设备对象
    x*stepx, y*stepy, //位图的起始横、纵坐标
    stepx,stepy, //位图的像素宽、高度
    SRCCOPY);
  x += m_nXStep;
  y += m_nYStep;
} 

With the step, then we should avoid "go" to a place that has already been shown, so the control of the outside step is very important, I found in the actual test that the group outside step size can only take two values, in order to display the picture complete.

可取值      可取值
         (x\y)        0      i+1//x,y分别表示外步长,下同
       0      否    是      
       i+1      是    是

This result, I think should be the reason for the algorithm, if a master can find a way to make up, please inform one or two.

The picture is determined by the size of the picture, such as X 600, if the picture can be fully displayed should not be more than 200 (can be divided by two dimensions) otherwise StretchBlt () will be "swallowed up a part of pixels." Because the parameter type in StretchBlt () is int,:)

But if you increase the number of blocks, you can make the effect more delicate, it depends on the individual.

(for example, when x=0,y=i+1,m_nxstep=1,m_nystep=200,m_nblocknum=600, the effect is: 1, for the picture in the vertical direction of the three equal parts, 2, the supremacy of the "stain" (I do not know how to describe, just look like) once, Then repeat step 2, just darken the color, and then perform another step 2, the picture is completely displayed.

P.S. " Staining "Number of =m_nblocknum/m_nystep (or M_nblocknum/m_nxstep)

When x=i+1,y=0,m_nxstep=200,m_nystep=1,m_nblocknum=600, the effect is the same, but the direction from vertical to horizontal, but the overall effect looks like the opening of the Japanese building door!!! You might as well try it.

Waterfall Effect: x=0,y=i+1,m_nxstep=1,m_nystep=20,m_nblocknum=600,m_ndelay=15, when the program is running, as long as the eyes follow the trajectory, it looks like a waterfall effect

It's important to note that the number of blocks does not exceed any of the x,y dimensions of the picture, otherwise the program will go wrong.

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.