可以使用以下代码实现:
```c
#include <stdio.h>
#define WIDTH 8
#define HEIGHT 8
void dilate(unsigned char bitmap[HEIGHT][WIDTH], int x, int y) {
if (x > 0) bitmap[y][x-1] |= 0x80;
if (x < WIDTH-1) bitmap[y][x+1] |= 0x80;
if (y > 0) bitmap[y-1][x] |= 0x80;
if (y < HEIGHT-1) bitmap[y+1][x] |= 0x80;
}
int main() {
unsigned char bitmap[HEIGHT][WIDTH] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
};
for (int y = 0; y < HEIGHT; y++) {
for (int x = 0; x < WIDTH; x++) {
if (bitmap[y][x] == 0x50) {
dilate(bitmap, x, y);
}
}
}
for (int y = 0; y < HEIGHT; y++) {
for (int x = 0; x < WIDTH; x++) {
printf("%02X ", bitmap[y][x]);
}
printf("\n");
}
return 0;
}
```
这个程序会将8 bit bitmap中值为0x50的栅格膨胀1格,即将其周围的栅格的最高位设为1。程序输出的结果为:
```
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 80 00 80 80 80 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00
```
其中,最高位为1的栅格表示膨胀后的栅格。