#include<stdio.h>
#include<string.h>
#define row 70
#define coloumn 70
#define buff_size row*coloumn
int draw_Box(int x,int y,int height,int width,int pixel_width,char *);
typedef struct
{
char r;
char g;
char b;
char a;
}rgba_t;
typedef struct
{
int x;
int y;
int height;
int width;
int pixel_width;
char * base_ptr;
}box_t;
rgba_t *rgba_ptr;
unsigned char data[buff_size]={1};
void main()
{
long unsigned int status,i,j=0;
memset(data,' ',sizeof(data));
if(status = draw_Box(28,28,15 ,15,3,data))
{
printf("out of boundary");
return ;
}
for(i=0;i<buff_size;i++)
{
if(i%coloumn==0)
{
if(i==0)
{
}
else
{
printf("%3d\n\n",(j++));
}
}
printf("%2c ",data[i]);
}
printf("%3d\n\n",j);
for(i=0;i<coloumn;i++)
{
printf("%2d ",i);
}
return ;
}
int draw_Box(int x,int y,int height,int width,int thick,char *base_ptr)
{
int x1,y1,i,j;
x1 = x + height-1;
y1 = y + width-1;
// char *box_base_ptr = (base_ptr+((x*10)+y));
if((x1)>row || (y1) >coloumn)
{
return 1;
}
#if 1
for(j=0;j<thick;j++)
{
for(i=x+j;i<=x1-j;i++)
{
*(base_ptr+(i*coloumn)+y+j)=0x31+j;
*(base_ptr+(i*coloumn)+y1-j)=0x31+j;
}
}
#endif
#if 1
for(j=0;j<thick;j++)
{
for(i=y+1+j;i<y1-j;i++)
{
*(base_ptr+((x+j)*coloumn)+i)=0x31+j;
*(base_ptr+((x1-j)*coloumn)+i)=0x31+j;
}
}
#endif
return 0;
// for(i=x;)
}
一个正方形的sterik?你的意思是星号,是吗?另外,请_please_格式化您的代码。 – jrd1
@ jrd1 - 哇!你比我好很多 - 我不知道斯特里克是谁,或者他为什么需要一个广场。 –
@HotLicks:Nah。这只是一个幸运的猜测。 ;) – jrd1