How to Create MTK Special Effects

Source: Internet
Author: User

MTKThis article describes how to create special effects.MTKFor more information about how to use the application.

In the process of WIN image programming or FLASH production, a hundred-page window is the simplest and most frequently-performing special effect, and it is easy to use it by understanding the Core algorithms.MTK.

 
 
  1. for(i=0;i  
  2. {  
  3. my_gdi_layer_bitblt(Transition_Effect_layer,i*(UI_device_width/frame_num),0,  
  4. g_step_w,UI_device_height,bg_layer,i*(UI_device_width/frame_num),0);  

The variable frame_num is the number of blind pages, Transition_Effect_layer is the special effect layer, and bg_layer is the layer of the new window. the core function is the copy function at this layer. if you are interested in the code, functions, and usage of this function, please refer to another article about the Function copy at the layer.

ForMTKFor the platform, menus and screen effects have been greatly affected for a long time.

However, the design process and method are rarely mentioned for various reasons.

Here we will introduce another method different from the method contained in logs a few days ago, that is, merge layers. Its core implementation function is as follows.

 
 
  1. voidmy_gdi_layer_copy(gdi_layer_struct*dst_layer,intdst_x,intdst_y,intwidth,intheight,  
  2. gdi_layer_struct*src_layer,intsrc_x,intsrc_y)  
  3. {  
  4. U16*dst_buf,*src_buf;  
  5. inti;  
  6. if(dst_x<0||dst_y<0||dst_x+width>dst_layer->width||dst_y+height>dst_layer->height)  
  7. {  
  8. if(dst_x<0)  
  9. {  
  10. width-=-dst_x;  
  11. src_x+=-dst_x;  
  12. dst_x=0;  
  13. }  
  14. if(dst_y<0)  
  15. {  
  16. height-=-dst_y;  
  17. src_y+=-dst_y;  
  18. dst_y=0;  
  19. }  
  20. if(dst_x+width>dst_layer->width)  
  21. {  
  22. width=dst_layer->width-dst_x;  
  23. }  
  24. if(dst_y+height>dst_layer->height)  
  25. {  
  26. height=dst_layer->height-dst_y;  
  27. }  
  28. }  
  29. if(src_x<0||src_y<0||src_x+width>src_layer->width||src_y+height>src_layer->height)  
  30. {  
  31. if(src_x<0)  
  32. {  
  33. width-=-src_x;  
  34. dst_x+=-src_x;  
  35. src_x=0;  
  36. }  
  37. if(src_y<0)  
  38. {  
  39. height-=-src_y;  
  40. dst_y+=-src_y;  
  41. src_y=0;  
  42. }  
  43. if(src_x+width>src_layer->width)  
  44. {  
  45. width=src_layer->width-src_x;  
  46. }  
  47. if(src_y+height>src_layer->height)  
  48. {  
  49. height=src_layer->height-src_y;  
  50. }  
  51. }  
  52. if(width<=0||height<=0)  
  53. return;  
  54. dst_buf=(U16*)dst_layer->buf_ptr+dst_y*dst_layer->width+dst_x;  
  55. src_buf=(U16*)src_layer->buf_ptr+src_y*src_layer->width+src_x;  
  56. for(i=0;i  
  57. {  
  58. memcpy(dst_buf,src_buf,width*2);  
  59. dst_buf+=dst_layer->width;  
  60. src_buf+=src_layer->width;  
  61. }  

If you are interested, you can use this function to develop various changes.

This function, coupled with another method provided some time ago, can produce about 20 effects.

Summary: DetailsMTKThe content of the special effect production method is omnipotent.MTKLearning application content can help you.

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.