Пример #1
0
void save_one_dive_to_mb(struct membuffer *b, struct dive *dive)
{
	struct divecomputer *dc;

	put_string(b, "<dive");
	if (dive->number)
		put_format(b, " number='%d'", dive->number);
	if (dive->tripflag == NO_TRIP)
		put_format(b, " tripflag='NOTRIP'");
	if (dive->rating)
		put_format(b, " rating='%d'", dive->rating);
	if (dive->visibility)
		put_format(b, " visibility='%d'", dive->visibility);
	save_tags(b, dive->tag_list);
	if (dive->dive_site_uuid)
		put_format(b, " divesiteid='%8x'", dive->dive_site_uuid);
	show_date(b, dive->when);
	put_format(b, " duration='%u:%02u min'>\n",
		   FRACTION(dive->dc.duration.seconds, 60));
	save_overview(b, dive);
	save_cylinder_info(b, dive);
	save_weightsystem_info(b, dive);
	save_dive_temperature(b, dive);
	/* Save the dive computer data */
	for_each_dc(dive, dc)
		save_dc(b, dive, dc);
	FOR_EACH_PICTURE(dive)
		save_picture(b, picture);
	put_format(b, "</dive>\n");
}
Пример #2
0
void solid_font_variants(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 250, 0, 0);
    ucg_SetColor(ucg, 1, 255, 255, 30);
    ucg_SetColor(ucg, 2, 220, 235, 10);
    ucg_SetColor(ucg, 3, 205, 0, 30);

    ucg_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_SetColor(ucg, 1, 150, 220, 255);		/* light blue background */
    ucg_SetFontMode(ucg, UCG_FONT_MODE_SOLID);
    ucg_SetFontPosBaseline(ucg);

    ucg_SetFont(ucg, ucg_font_fur11_tf);
    ucg_DrawString(ucg, 3+ox, 20, 0, "fur11_tf");

    ucg_SetFont(ucg, ucg_font_fur11_hf);
    ucg_DrawString(ucg, 3+ox, 50, 0, "fur11_hf");

    ucg_SetFont(ucg, ucg_font_fur11_hr);
    ucg_DrawString(ucg, 68+ox, 50, 0, "fur11_hr");


    //pos(ucg, 42+ox, 40, 0);

    save_picture(ucg, "solid_font_variants");
}
Пример #3
0
static void
gamine_on_key (GtkWidget *pWidget,
    GdkEventKey* pKey,
    gamine_t *cb)
{
    gint mx, my;
    if (pKey->type == GDK_KEY_PRESS)
    {
        switch (pKey->keyval)
        {
            case GDK_Escape :
                gtk_main_quit ();
            break;
            case GDK_space :
                gtk_widget_queue_draw(pWidget);
            break;
            case GDK_Print:
                save_picture(cb);
            break;
            default:
                gdk_window_get_pointer(pWidget->window, &mx, &my, NULL);
                draw_string(cb, mx, my, pKey->string);
            break;
        }
    };
}
Пример #4
0
void draw_pixel(ucg_t *ucg)
{
    prepare_picture(ucg);
    pos(ucg, ox+50, 20,0);
    ucg_SetColor(ucg, 0, 255, 255, 255);
    ucg_DrawPixel(ucg, ox+50, 20);
    save_picture(ucg, "draw_pixel");
}
Пример #5
0
void draw_vline(ucg_t *ucg)
{
    prepare_picture(ucg);
    vrule(ucg, ox+50, 20, 25, 1);
    ucg_SetColor(ucg, 0, 255, 255, 255);
    ucg_DrawVLine(ucg, ox+50, 20, 25);
    pos(ucg, ox+50, 20,0);
    save_picture(ucg, "draw_vline");
}
Пример #6
0
void draw_hline(ucg_t *ucg)
{
    prepare_picture(ucg);
    hrule(ucg, ox+50, 40, 45, 0);
    ucg_SetColor(ucg, 0, 255, 255, 255);

    ucg_DrawHLine(ucg, ox+50, 40, 45);
    pos(ucg, ox+50, 40,0);
    save_picture(ucg, "draw_hline");
}
Пример #7
0
void draw_box(ucg_t *ucg)
{
    prepare_picture(ucg);
    hrule(ucg, ox+50, 30, 45, 0);
    vrule(ucg, ox+50+45-1, 30, 20, 1);
    ucg_SetColor(ucg, 0, 255, 255, 255);

    ucg_DrawBox(ucg, ox+50, 30, 45, 20);
    pos(ucg, ox+50, 30,0);
    save_picture(ucg, "draw_box");
}
Пример #8
0
void draw_circle(ucg_t *ucg)
{
    prepare_picture(ucg);
    hrule(ucg, ox+50+1, 30, 20, 0);
    vrule(ucg, ox+50+20-1, 30+1, 20, 1);
    ucg_SetColor(ucg, 0, 255, 255, 255);

    ucg_DrawCircle(ucg, ox+50, 30, 20, UCG_DRAW_LOWER_RIGHT);
    pos(ucg, ox+50, 30,0);
    save_picture(ucg, "draw_circle");
}
Пример #9
0
void draw_gradient_line(ucg_t *ucg)
{
    prepare_picture(ucg);
    hrule(ucg, ox+50, 40, 45, 0);
    ucg_SetColor(ucg, 0, 0, 255, 255);
    ucg_SetColor(ucg, 1, 255, 255, 0);

    ucg_DrawGradientLine(ucg, ox+50, 40, 45, 0);
    pos(ucg, ox+50, 40,0);
    save_picture(ucg, "draw_gradient_line");
}
Пример #10
0
void draw_rframe(ucg_t *ucg)
{
    prepare_picture(ucg);
    hrule(ucg, ox+50, 30, 45, 0);
    vrule(ucg, ox+50+45-1, 30, 20, 1);

    vrule(ucg, ox+50+1, 30+20-8, 8, 0);
    hrule(ucg, ox+50, 30+20-1-1, 8, 1);
    ucg_SetColor(ucg, 0, 255, 255, 255);

    ucg_DrawRFrame(ucg, ox+50, 30, 45, 20, 8);
    pos(ucg, ox+50, 30,0);
    save_picture(ucg, "draw_rframe");
}
Пример #11
0
void draw_text_dir1(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetFontPosBaseline(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 255);		/* draw blue "baseline" */
    //ucg_DrawHLine(ucg, 45+ox, 30, ucg_GetStrWidth(ucg, "Ucg"));
    ucg_SetColor(ucg, 0, 255, 255, 255);		/* draw white "Ucg" */
    ucg_DrawString(ucg, 45+ox, 10, 1, "Ucg");
    pos(ucg, 45+ox, 10, 0);

    save_picture(ucg, "draw_text_dir1");
}
Пример #12
0
void Host::format_and_save(unsigned int** mat_envt, int id)
{
	// host matrix
    unsigned int** mat_host= matrixGenerator(host_triangles, DefVal::N_TRIANGLES_HOST);
    // parasite matrix
    unsigned int ** mat_par= matrixGenerator(paras_triangles, DefVal::N_TRIANGLES_PARASITE);
    unsigned char * pix= convert_pixel(mat_host, mat_envt, mat_par);
    char name[100];
    sprintf(name,"host_%d%s", id, DefVal::PIC_FORMAT.c_str());
    save_picture(pix, name);

    delete [] mat_host;
    delete [] mat_par;
}
Пример #13
0
void set_scale2x2(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetFontPosBaseline(ucg);
    //ucg_SetColor(ucg, 0, 0, 0, 255);		/* draw blue "baseline" */
    //ucg_DrawHLine(ucg, 45+ox, 30, ucg_GetStrWidth(ucg, "Ucg"));
    ucg_SetColor(ucg, 0, 255, 255, 255);		/* draw white "Ucg" */
    ucg_SetScale2x2(ucg);
    ucg_DrawString(ucg, 20+ox, 20, 0, "Ucg");
    ucg_UndoScale(ucg);
    pos(ucg, 40+ox, 40, 0);

    save_picture(ucg, "set_scale2x2");
}
Пример #14
0
void draw_triangle(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 255, 255, 255);

    ucg_DrawTriangle(ucg, 52, 9,   83,32,      47,42);

    ucg_DrawTriangle(ucg, 52,55,  83,32+1,  47,42+1);
    pos(ucg, 52, 9, 0);
    pos(ucg, 83,32, 1);
    pos(ucg, 47,42+1, 0);



    save_picture(ucg, "draw_triangle");
}
Пример #15
0
void clip_putlasso(GEM_WINDOW *gwnd, int x1, int y1, int x2, int y2, MFDB *mask, MFDB *masked_img)
{
  VXIMAGE *vimage ;

  if ( !GWIsWindowValid( gwnd ) ) return ;
  vimage = (VXIMAGE *) gwnd->Extension ;

  FreeClipboard() ;

  memcpy(&clipboard.img, masked_img, sizeof(MFDB)) ;
  memcpy(&clipboard.mask, mask, sizeof(MFDB)) ;
  clipboard.gwindow = gwnd ;
  clipboard.x   = x1 ;
  clipboard.y   = y1 ;
  clipboard.w   = 1+x2-x1 ;
  clipboard.h   = 1+y2-y1 ;

  if (config.clip_gem == 1)
  {
    char name[200] ;

    mouse_busy() ;
    if ( clbd_getpath( name ) == 0 )
    {
      INFO_IMAGE info ;

      memcpy( &info, &vimage->inf_img, sizeof(INFO_IMAGE) ) ;
      info.largeur  = clipboard.img.fd_w ;
      info.hauteur  = clipboard.img.fd_h ;
      if ( Truecolor )
      {
        strcat(name, "SCRAP.TIF") ;
        info.compress = 1 ;
        info.lformat  = IID_TIFF ;
      }
      else
      {
        strcat(name, "SCRAP.IMG") ;
        info.lformat  = IID_IMG ;
      }
      save_picture( name, &clipboard.img, &vimage->inf_img, NULL ) ;
    }
    mouse_restore() ;
  }
}
Пример #16
0
void draw_text_ascent_descent(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetFont(ucg, ucg_font_ncenB24_tf);
    ucg_SetFontPosBaseline(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 255);		/* draw blue "baseline" */
    ucg_DrawHLine(ucg, 42+ox, 30, ucg_GetStrWidth(ucg, "Ucg"));
    ucg_SetColor(ucg, 0, 255, 255, 255);		/* draw white "Ucg" */
    ucg_DrawString(ucg, 42+ox, 30, 0, "Ucg");
    pos(ucg, 42+ox, 30, 0);
    ucg_SetFont(ucg, ucg_font_ncenB24_tf);
    vrule(ucg, 42+ox+ucg_GetStrWidth(ucg, "Ucg"), 30-ucg_GetFontAscent(ucg), ucg_GetFontAscent(ucg), 1);
    ucg_SetFont(ucg, ucg_font_ncenB24_tf);
    vrule(ucg, 42+ox+ucg_GetStrWidth(ucg, "Ucg"), 30, -ucg_GetFontDescent(ucg), 1);

    save_picture(ucg, "draw_text_ascent_descent");
}
Пример #17
0
void set_clip_range(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetFontPosBaseline(ucg);
    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetColor(ucg, 0, 255, 255, 255);		/* draw white A */
    ucg_DrawGlyph(ucg, 50, 40, 0, 'A');
    ucg_SetClipRange(ucg, 57, 20, 30, 15);	/* restrict area */
    ucg_SetColor(ucg, 0, 0, 0, 127);
    ucg_DrawBox(ucg, 0, 0, 128, 64);		/* fill the restricted area with dark blue */
    ucg_SetColor(ucg, 0, 0, 0, 255);
    ucg_DrawGlyph(ucg, 50, 40, 0, 'A');	/* draw light blue A */

    hrule(ucg, ox+57, 20, 30, 0);
    vrule(ucg, ox+57+30, 20, 15, 1);
    pos(ucg, ox+50, 40, 0);
    save_picture(ucg, "set_clip_range");
}
Пример #18
0
void set_font_mode_1(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 255, 0, 0);
    ucg_SetColor(ucg, 1, 0, 255, 0);
    ucg_SetColor(ucg, 2, 255, 0, 255);
    ucg_SetColor(ucg, 3, 0, 255, 255);

    ucg_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetFontMode(ucg, UCG_FONT_MODE_TRANSPARENT);
    ucg_SetFont(ucg, ucg_font_ncenB18_tf);
    ucg_SetFontPosBaseline(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_DrawString(ucg, 40+ox, 40, 0, "Ucg");
    pos(ucg, 42+ox, 40, 0);

    save_picture(ucg, "set_font_mode_1");
}
Пример #19
0
int 
main (int argc, char *argv[]) 
{
  
    int n_iter,			/* degre de nettete  */  
	x_size, y_size;		/* & dimensions de l'image */  
    double x_min, x_max, y_min, y_max; /* bornes de la representation */
    char *pathname;		/* fichier destination */
    picture_t pict;

    parse_argv(argc, argv, 
	       &n_iter, 
	       &x_min, &x_max, &y_min, &y_max, 
	       &x_size, &y_size, &pathname);

    init_picture (& pict, x_size, y_size);
    compute (& pict, n_iter, x_min, x_max, y_min, y_max);
    save_picture (& pict, pathname);

    exit(EXIT_SUCCESS);
}
Пример #20
0
void set_font_mode_2(ucg_t *ucg)
{
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 255, 0, 0);
    ucg_SetColor(ucg, 1, 0, 255, 0);
    ucg_SetColor(ucg, 2, 255, 0, 255);
    ucg_SetColor(ucg, 3, 0, 255, 255);

    ucg_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetFontMode(ucg, UCG_FONT_MODE_SOLID);
    ucg_SetFont(ucg, ucg_font_ncenB18_hr);
    ucg_SetFontPosBaseline(ucg);
    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_SetColor(ucg, 1, 150, 220, 255);		/* light blue background */
    ucg_DrawString(ucg, 40+ox, 40, 0, "Ucg");
    pos(ucg, 42+ox, 40, 0);

    save_picture(ucg, "set_font_mode_2");
}
Пример #21
0
void string_overwrite(ucg_t *ucg, int cnt)
{
    char s[40];
    int i;
    prepare_picture(ucg);

    ucg_SetColor(ucg, 0, 250, 0, 0);
    ucg_SetColor(ucg, 1, 255, 255, 30);
    ucg_SetColor(ucg, 2, 220, 235, 10);
    ucg_SetColor(ucg, 3, 205, 0, 30);

    ucg_DrawGradientBox(ucg, ox+0, 0, 128, 64);

    ucg_SetColor(ucg, 0, 0, 0, 0);		/* draw black "Ucg" */
    ucg_SetColor(ucg, 1, 150, 220, 255);		/* light blue background */
    ucg_SetFontMode(ucg, UCG_FONT_MODE_SOLID);
    ucg_SetFontPosBaseline(ucg);

    for( i = 11; i < 11+cnt; i++ )
    {
        sprintf(s, "cu12_tf %d", i);
        ucg_SetFont(ucg, ucg_font_cu12_tf);
        ucg_DrawString(ucg, 1+ox, 15, 0, s);

        sprintf(s, "cu12_hf %d", i);
        ucg_SetFont(ucg, ucg_font_cu12_hf);
        ucg_DrawString(ucg, 1+ox, 35, 0, s);

        sprintf(s, "7x14_mf %d", i);
        ucg_SetFont(ucg, ucg_font_7x14_mf);
        ucg_DrawString(ucg, 1+ox, 55, 0, s);
    }

    //pos(ucg, 42+ox, 40, 0);

    sprintf(s, "string_overwrite_%d", cnt);
    save_picture(ucg, s);
}
Пример #22
0
void clip_put(GEM_WINDOW *gwnd, int x1, int y1, int x2, int y2)
{
  VXIMAGE *vimage ;
  int     xy[8] ;
  int     temp ;
  int     larg ;
  int     w, h ;

  if ( !GWIsWindowValid( gwnd ) ) return ;
  vimage = (VXIMAGE *) gwnd->Extension ;

  if (x2 < x1)
  {
    temp = x1 ;
    x1   = x2 ;
    x2   = temp ;
  }
  if (y2 < y1)
  {
    temp = y1 ;
    y1   = y2 ;
    y2   = temp ;
  }

  FreeClipboard() ;

  w = 1+x2-x1 ; h = 1+y2-y1 ;
  if (w % 16) larg = (16+w) & 0xFFF0 ;
  else        larg = w ;
  if (larg < MINIW) larg = MINIW ;
  if (h < MINIH)       h = MINIH ;
  clipboard.img.fd_addr = img_alloc(larg, h, nb_plane) ;
  if (clipboard.img.fd_addr == NULL)
  {
    form_error(8) ;
    return ;
  }

  clipboard.img.fd_w       = larg ;
  clipboard.img.fd_h       = h ;
  clipboard.img.fd_wdwidth = larg/16 ;
  clipboard.img.fd_nplanes = nb_plane ;
  clipboard.img.fd_stand   = 0 ;
  clipboard.gwindow        = gwnd ;
  clipboard.x              = x1 ;
  clipboard.y              = y1 ;
  clipboard.w              = 1+x2-x1 ;
  clipboard.h              = 1+y2-y1 ;

  img_raz(&clipboard.img) ;
  xy[0] = x1 ;    xy[1] = y1 ;
  xy[2] = x2 ;    xy[3] = y2 ;
  xy[4] = 0 ;     xy[5] = 0 ;
  xy[6] = x2-x1 ; xy[7] = y2-y1 ;
  vro_cpyfm(handle, S_ONLY, xy, &vimage->raster, &clipboard.img) ;

  if ( config.clip_gem == 1 )
  {
    char name[PATH_MAX] ;

    mouse_busy() ;
    if ( clbd_getpath( name ) == 0 )
    {
      INFO_IMAGE info ;
      IMG_MODULE *img_module ;

      memcpy( &info, &vimage->inf_img, sizeof(INFO_IMAGE) ) ;
      info.largeur  = clipboard.img.fd_w ;
      info.hauteur  = clipboard.img.fd_h ;
      info.compress = 1 ;
      strcat( name, "SCRAP." ) ;
      if ( Truecolor ) info.lformat = IID_TIFF ;
      else             info.lformat = IID_IMG ;
      img_module = DImgGetModuleFromIID( info.lformat ) ;
      if ( img_module )
      {
        strcat( name, img_module->Capabilities.file_extension ) ;
        save_picture( name, &clipboard.img, &info, NULL ) ;
      }
    }
    mouse_restore() ;
  }
}