詳解MTK特效制作方法
MTK特效制作方法是本文要介紹的內(nèi)容,主要是來了解并學(xué)習(xí)MTK的應(yīng)用使用方法,具體內(nèi)容的實現(xiàn)來看本文詳解。
在WIN圖像編程或者FLASH制作過程中,百頁窗是最簡單也是人們最常表演的特效.了解了核心算法,也就可以很容易的使用在MTK的屏幕切換中。
- for(i=0;i
- {
- my_gdi_layer_bitblt(Transition_Effect_layer,i*(UI_device_width/frame_num),0,
- g_step_w,UI_device_height,bg_layer,i*(UI_device_width/frame_num),0);
- }
變量frame_num;是百葉窗的頁數(shù),Transition_Effect_layer是特效層,bg_layer是新窗口的層.核心函數(shù)在于這個層的拷貝函數(shù).有關(guān)這個函數(shù)的代碼,功能和用法,有興趣的朋友可以參考我的另一篇專門介紹層拷貝的函數(shù)的文章.
對于MTK平臺來說,菜單和屏幕特效曾經(jīng)在很長的一段時間里,影響甚遠。
但對于其設(shè)計過程和方法,由于各種各樣的原因,很少有人提及。
這里介紹一種不同于前幾天日志所載之方法的另一種方法,就是合并圖層,其核心實現(xiàn)函數(shù)如下。
- voidmy_gdi_layer_copy(gdi_layer_struct*dst_layer,intdst_x,intdst_y,intwidth,intheight,
- gdi_layer_struct*src_layer,intsrc_x,intsrc_y)
- {
- U16*dst_buf,*src_buf;
- inti;
- if(dst_x<0||dst_y<0||dst_x+width>dst_layer->width||dst_y+height>dst_layer->height)
- {
- if(dst_x<0)
- {
- width-=-dst_x;
- src_x+=-dst_x;
- dst_x=0;
- }
- if(dst_y<0)
- {
- height-=-dst_y;
- src_y+=-dst_y;
- dst_y=0;
- }
- if(dst_x+width>dst_layer->width)
- {
- width=dst_layer->width-dst_x;
- }
- if(dst_y+height>dst_layer->height)
- {
- height=dst_layer->height-dst_y;
- }
- }
- if(src_x<0||src_y<0||src_x+width>src_layer->width||src_y+height>src_layer->height)
- {
- if(src_x<0)
- {
- width-=-src_x;
- dst_x+=-src_x;
- src_x=0;
- }
- if(src_y<0)
- {
- height-=-src_y;
- dst_y+=-src_y;
- src_y=0;
- }
- if(src_x+width>src_layer->width)
- {
- width=src_layer->width-src_x;
- }
- if(src_y+height>src_layer->height)
- {
- height=src_layer->height-src_y;
- }
- }
- if(width<=0||height<=0)
- return;
- dst_buf=(U16*)dst_layer->buf_ptr+dst_y*dst_layer->width+dst_x;
- src_buf=(U16*)src_layer->buf_ptr+src_y*src_layer->width+src_x;
- for(i=0;i
- {
- memcpy(dst_buf,src_buf,width*2);
- dst_buf+=dst_layer->width;
- src_buf+=src_layer->width;
- }
- }
有興趣的朋友可以自己利用該函數(shù)研發(fā)各種各樣的變化效果。
這個函數(shù),加上我前一段時間提供的另一種方法,大致可以制作二十種左右的效果。
小結(jié):詳解MTK特效制作方法的內(nèi)容介紹萬能了,希望通過MTK應(yīng)用內(nèi)容的學(xué)習(xí)能對你有所幫助。