码迷,mamicode.com
首页 > 其他好文 > 详细

顺时针旋转RGBA图片90度

时间:2015-04-27 15:02:14      阅读:125      评论:0      收藏:0      [点我收藏+]

标签:

 1 void RotateRGBA(
 2     const sd_uint8* src,
 3     sd_uint8* result,
 4     int width,
 5     int height,
 6     int mode
 7     ){// mode 0 -> 0; 1 -> 90; 2->180; 3->270;
 8     if(mode == 1){
 9         int x = 0;
10         int y = 0;
11         int posR = 0;
12         int posS = 0;
13         for(x = 0; x < width; x++){
14             for(y = height - 1; y >= 0; y--){
15                 posS = (y * width + x) * 4;
16                 result[posR + 0] = src[posS + 0];// R
17                 result[posR + 1] = src[posS + 1];// G
18                 result[posR + 2] = src[posS + 2];// B
19                 result[posR + 3] = src[posS + 3];// A
20                 posR += 4;
21             }
22         }
23     }
24 }

 

顺时针旋转RGBA图片90度

标签:

原文地址:http://www.cnblogs.com/wzswzd/p/4460053.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!