首页 > 其他 > 详细

顺时针旋转RGBA图片90度

时间:2015-04-27 15:01:47      阅读:202      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!