原始宏有四个参数
时间: 2023-09-16 11:08:50 浏览: 60
非常抱歉,我的回答有误。原始宏有四个参数,而不是三个参数。在这种情况下,将逆时针旋转90度的宏修改如下:
```
#define ROTATE_BITMAP(pattern_array, width, height, row_size) \
for (int i = 0; i < (width / 2); i++) { \
for (int j = 0; j < height; j++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, width, j, i); \
*((uint8_t *)pattern_array + width * j + i/8) &= ~(1 << (7-(i%8))); \
*((uint8_t *)pattern_array + width * j + i/8) |= (PATTERN_BITMAP(pattern_array, width, j, width-i-1) << (7-(i%8))); \
*((uint8_t *)pattern_array + width * j + (width-i-1)/8) &= ~(1 << (7-((width-i-1)%8))); \
*((uint8_t *)pattern_array + width * j + (width-i-1)/8) |= (temp << (7-((width-i-1)%8))); \
} \
} \
for (int i = 0; i < width; i++) { \
for (int j = i+1; j < height; j++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, width, i, j); \
*((uint8_t *)pattern_array + width * i + j/8) &= ~(1 << (7-(j%8))); \
*((uint8_t *)pattern_array + width * i + j/8) |= (PATTERN_BITMAP(pattern_array, width, j, i) << (7-(j%8))); \
*((uint8_t *)pattern_array + width * j + i/8) &= ~(1 << (7-(i%8))); \
*((uint8_t *)pattern_array + width * j + i/8) |= (temp << (7-(i%8))); \
} \
} \
for (int i = 0; i < height; i++) { \
for (int j = width; j > row_size; j--) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, width, i, j-1); \
*((uint8_t *)pattern_array + width * i + j/8 - 1) &= ~(1 << (7-((j-1)%8))); \
*((uint8_t *)pattern_array + width * i + j/8 - 1) |= (temp << (7-((j-1)%8))); \
} \
}
```
其中,pattern_array是要旋转的位图的数组指针,width表示每一行的字节数,height表示位图的行数,row_size表示位图每一行实际需要的字节数。该宏会将位图逆时针旋转90度,并将多余的列按顺序拼接到列的后面,最终结果会保存在原始的位图中。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)