:
endl;
}
}
}
p_show_pixel=p_img_buf;
for(intiy=0;iy<=height_img;iy+=size_y_step)
{
for(intix=0;ix<=width_img;ix++)
{
p_show_pixel=p_img_buf+iy*width_img+ix;
p_show_pixel->red=255;
p_show_pixel->green=255;
p_show_pixel->blue=0;
}
}
p_show_pixel=p_img_buf;
for(intix=0;ix<=width_img;ix+=size_x_step)
{
for(intiy=0;iy<=height_img;iy++)
{
p_show_pixel=p_img_buf+iy*width_img+ix;
p_show_pixel->red=255;
p_show_pixel->green=255;
p_show_pixel->blue=0;
}
}
my_img_pixbuf=Gdk:
:
Pixbuf:
:
create_from_data((guint8*)p_img_buf,
Gdk:
:
COLORSPACE_RGB,
false,
8,
width_img,
height_img,
width_img*3
);
my_img_pixbuf->render_to_drawable(ref_pixmap_scribble,
p_drawingarea->get_style()->get_fg_gc(p_drawingarea->get_state()),
0,
0,
20,
20,
width_img,
height_img,
Gdk:
:
RGB_DITHER_NONE,
0,
0);
p_drawingarea->queue_draw();
}
voidWindow1:
:
on_button_refresh()
{
}
voidWindow1:
:
on_button_save()
{
}
voidWindow1:
:
on_button_exit()
{
cairo_surface_destroy(image01);
cairo_surface_destroy(image02);
hide();
}
voidWindow1:
:
translate_img()
{
width=WIDTH;
height=HEIGHT;
cr01=cairo_create(image01);
cr02=cairo_create(image02);
doublew01=cairo_image_surface_get_width(image01);
doubleh01=cairo_image_surface_get_height(image01);
snippet_normalize(cr01,w01,h01);
cairo_stroke(cr01);
memset(p_buf_cairo,0,STRIDE*HEIGHT);
doublew02=cairo_image_surface_get_width(image02);
doubleh02=cairo_image_surface_get_height(image02);
snippet_normalize(cr02,w02,h02);
cairo_translate(cr02,0.5,0.5);
cairo_rotate(cr02,a*M_PI/180);
cairo_scale(cr02,1.0/w02,1.0/h02);
cairo_translate(cr02,-0.5*w01,-0.5*h01);
cairo_set_source_surface(cr02,image01,0,0);
cairo_paint(cr02);
cairo_stroke(cr02);
//cairo_surface_write_to_png(image02,"zj02.png");
guint8*p_uch=p_buf_cairo;
p_show_pixel=p_img_show_data;
for(guint32i=0;i{
p_show_pixel->red=0;
p_show_pixel->green=0;
p_show_pixel->blue=0;
p_show_pixel->red=*(p_uch+2);
p_show_pixel->green=*(p_uch+1);
p_show_pixel->blue=*(p_uch+0);
p_uch+=4;
p_show_pixel++;
}
intx0,y0;
for(guint32i=0;i{
intx=i%image_long;
inty=(guint16)(i/image_long);
p_tmp_pixel=p_img_show_data+y*image_long+x;
if(p_tmp_pixel->red>200
&&p_tmp_pixel->green>200
&&p_tmp_pixel->blue>200)
{
x0=x;
y0=y;
break;
}
}
x1=x0;
y1=y0;
xn=x0;
yn=y0;
for(guint32i=0;i{
intx=i%image_long;
inty=(guint16)(i/image_long);
p_tmp_pixel=p_img_show_data+y*image_long+x;
if(p_tmp_pixel->red>200
&&p_tmp_pixel->green>200
&&p_tmp_pixel->blue>200)
{
if(xif(yif(x>xn)xn=x;
if(y>yn)yn=y;
}
}
for(guint32i=0;i{
intx=i%image_long;
inty=(guint16)(i/image_long);
p_tmp_pixel=p_img_show_data+y*image_long+x;
if(x>x1&&y==y1&&x<=xn)
{
p_tmp_pixel->red=255;
p_tmp_pixel->green=255;
p_tmp_pixel->blue=255;
}
if(x>x1&&y==yn&&x<=xn)
{
p_tmp_pixel->red=255;
p_tmp_pixel->green=255;
p_tmp_pixel->blue=255;
}
if(y>y1&&x==x1&&y<=yn)
{
p_tmp_pixel->red=255;
p_tmp_pixel->green=255;
p_tmp_pixel->blue=255;
}
if(y>y1&&x==xn&&y<=yn)
{
p_tmp_pixel->red=255;
p_tmp_pixel->green=255;
p_tmp_pixel->blue=255;
}
}
size_rect=(xn-x1)*(yn-y1);
if(size_rect_min==0)
{
size_rect_min=size_rect;
amin=a;
}
if(size_rect_min>size_rect)
{
size_rect_min=size_rect;
amin=a;
}
cairo_destroy(cr01);
cairo_destroy(cr02);
}
voidWindow1:
:
draw()
{
my_img_pixbuf=Gdk:
:
Pixbuf:
:
create_from_data((guint8*)p_img_show_data,
Gdk:
:
COLORSPACE_RGB,
false,
8,
image_long,
image_long,
image_long*3
);
my_img_pixbuf->render_to_drawable(ref_pixmap_scribble,
p_drawingarea->get_style()->get