我已经给了宏PATTERN_BITMAP的定义,请仔细审题
时间: 2024-02-09 22:11:02 浏览: 133
非常抱歉,我没有仔细审题,造成了误导。根据题目要求,将指定的位图逆时针旋转90度,并将多余的列按顺序拼接到列的后面,可以使用如下宏:
```
#define PATTERN_BITMAP_ROTATE90(pattern_array, row_size, height) \
for (int i = 0; i < row_size / 2; i++) { \
for (int j = i; j < height - i - 1; j++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, 32, i, j); \
*((uint8_t *)pattern_array + 32 * i + j/8) &= ~(1 << (7-(j%8))); \
*((uint8_t *)pattern_array + 32 * i + j/8) |= (PATTERN_BITMAP(pattern_array, 32, j, row_size - i - 1) << (7-(j%8))); \
*((uint8_t *)pattern_array + 32 * j + (row_size - i - 1)/8) &= ~(1 << (7-((row_size - i - 1)%8))); \
*((uint8_t *)pattern_array + 32 * j + (row_size - i - 1)/8) |= (PATTERN_BITMAP(pattern_array, 32, row_size - i - 1, row_size - j - 1) << (7-((row_size - i - 1)%8))); \
*((uint8_t *)pattern_array + 32 * (row_size - i - 1) + (row_size - j - 1)/8) &= ~(1 << (7-((row_size - j - 1)%8))); \
*((uint8_t *)pattern_array + 32 * (row_size - i - 1) + (row_size - j - 1)/8) |= (PATTERN_BITMAP(pattern_array, 32, row_size - j - 1, i) << (7-((row_size - j - 1)%8))); \
*((uint8_t *)pattern_array + 32 * (row_size - j - 1) + i/8) &= ~(1 << (7-(i%8))); \
*((uint8_t *)pattern_array + 32 * (row_size - j - 1) + i/8) |= (temp << (7-(i%8))); \
} \
} \
if (row_size % 2 != 0) { \
int mid = row_size / 2; \
for (int i = 0; i < height / 2; i++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, 32, mid, i); \
*((uint8_t *)pattern_array + 32 * mid + i/8) &= ~(1 << (7-(i%8))); \
*((uint8_t *)pattern_array + 32 * mid + i/8) |= (PATTERN_BITMAP(pattern_array, 32, height - i - 1, mid) << (7-(i%8))); \
*((uint8_t *)pattern_array + 32 * (height - i - 1) + mid/8) &= ~(1 << (7-(mid%8))); \
*((uint8_t *)pattern_array + 32 * (height - i - 1) + mid/8) |= (PATTERN_BITMAP(pattern_array, 32, mid, i) << (7-(mid%8))); \
} \
for (int i = mid+1; i < row_size - mid - 1; i++) { \
for (int j = 0; j < height / 2; j++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, 32, i, j); \
*((uint8_t *)pattern_array + 32 * i + j/8) &= ~(1 << (7-(j%8))); \
*((uint8_t *)pattern_array + 32 * i + j/8) |= (PATTERN_BITMAP(pattern_array, 32, height - j - 1, i) << (7-(j%8))); \
*((uint8_t *)pattern_array + 32 * (height - j - 1) + i/8) &= ~(1 << (7-(i%8))); \
*((uint8_t *)pattern_array + 32 * (height - j - 1) + i/8) |= (temp << (7-(i%8))); \
} \
} \
for (int i = mid+1; i < row_size - mid - 1; i++) { \
for (int j = height / 2; j < height; j++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, 32, i, j); \
*((uint8_t *)pattern_array + 32 * i + j/8) &= ~(1 << (7-(j%8))); \
*((uint8_t *)pattern_array + 32 * i + j/8) |= (PATTERN_BITMAP(pattern_array, 32, i, row_size - j - 1 + row_size*(j/row_size)) << (7-(j%8))); \
} \
} \
} else { \
for (int i = 0; i < height / 2; i++) { \
for (int j = 0; j < row_size / 2; j++) { \
uint8_t temp = PATTERN_BITMAP(pattern_array, 32, j, i); \
*((uint8_t *)pattern_array + 32 * j + i/8) &= ~(1 << (7-(i%8))); \
*((uint8_t *)pattern_array + 32 * j + i/8) |= (PATTERN_BITMAP(pattern_array, 32, height-j-1, i) << (7-(i%8))); \
*((uint8_t *)pattern_array + 32 * (height-j-1) + i/8) &= ~(1 << (7-((i)%8))); \
*((uint8_t *)pattern_array + 32 * (height-j-1) + i/8) |= (temp << (7-((i)%8))); \
} \
for (int j = row_size / 2; j < row_size; j++)
阅读全文