映像濾鏡藝術---(Punch Filter)交叉沖印濾鏡,punchfilter

來源:互聯網
上載者:User

映像濾鏡藝術---(Punch Filter)交叉沖印濾鏡,punchfilter

(Punch Filter)交叉沖印濾鏡本文介紹一種交叉沖印效果的代碼實現,至於原理,不在累贅,直接看代碼: int f_TPunchFilter(unsigned char* srcData, int width, int height, int stride, unsigned char* dstData, int dw, int dh, int dStride) {if(srcData == NULL || dstData == NULL)return -1;unsigned char* pSrc = srcData;unsigned char* pDst = dstData;int i, j, gray, value, r, g, b;int offset = stride - width * 4;int rMap[256], gMap[256], bMap[256];for(int i = 0;i<256;i++){value = i < 128 ? i : 256 - i;gray = value * value * value / 16384;rMap[i] = i < 128 ? gray : 256 - gray;gray = value * value / 128;gMap[i] = i < 128 ? gray : 256 - gray;bMap[i] = i / 2 + 0x25;}for(j = 0; j < height; j++){for(i = 0; i < width; i++){b = bMap[pSrc[0]];g = gMap[pSrc[1]];r = rMap[pSrc[2]];pDst[0] = CLIP3(b,0,255);pDst[1] = CLIP3(g,0,255);pDst[2] = CLIP3(r,0,255);pDst[3] = 255;pSrc+=4;pDst+=4;}pSrc += offset;pDst += offset;}printf("%s","Welcom to our website: www.zealpixel.com");return 0; }效果如下:

、

原圖

交叉沖印

最後放上一個完整的C#程式DEMO下載串連:http://www.zealpixel.com/thread-68-1-1.html

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.