Exemple #1
0
/******************************************************************

  DrawSubMenu() -- This function draws the specified submenu gadget.

******************************************************************/
GS_errorType
DrawSubMenu(GSgadgetStruct *sm)
{
   int 	i;
   char *item_label;

   GS_errorType ExtractItemLabel();


   if (sm->gadget_type == GSSUBMENU) {

      /*  draw background of sub menu
       */
      SRGP_setColor(sm->gadget_bgd_color);
      SRGP_fillRectangle(sm->gadget_extent);

      /*  draw outline of sub menu
       */
      SRGP_setColor(sm->gadget_bor_color);
      SRGP_rectangle(sm->gadget_extent);

      /*  draw menu labels of sub menu
       */
      SRGP_setColor(sm->gadget_fgd_color);

      for (i = 0; i < sm->submenu->item_count; i++) {
         ExtractItemLabel(i, sm->submenu->item_list, item_label);
         SRGP_text(sm->submenu->item_pos[i], item_label);
      }
   }
   else
      return(GSNOTSUBMENUERR);

   return(GSNOERROR);
} /* end of DrawSubMenu()*/
Exemple #2
0
void paint_julia_prev(infoptr pic, point mouse_pos)
{
  struct picture_info prev_pic;
  dpoint p, tmp;
  int n = 0;

  prev_pic.area = get_prev_rect(pic);
  init_coords(&prev_pic);    /* Asetetaan sopiva skaalaus */
  /* Julia-vakio hiiren koordinaateista */  
  prev_pic.julia_c = to_dpoint(mouse_pos, pic); 
  SRGP_setClipRectangle(prev_pic.area);
  SRGP_setColor(SRGP_BLACK);  /* Peitetään vanha kuva */
  SRGP_fillRectangleCoord(prev_pic.area.bottom_left.x + 1,
			  prev_pic.area.bottom_left.y + 1,
			  prev_pic.area.top_right.x - 1,
			  prev_pic.area.top_right.y - 1); 
  SRGP_setColor(SRGP_WHITE);  /* Valkea reunus */
  SRGP_rectangle(prev_pic.area);
  p.x = 0;   /* Inverse functionin */
  p.y = 0;   /* alkupiste          */

  while(n < JULIA_LIMIT)
  {   /*  z[n+1] = sqrt(z[n] - c)  */
    tmp.x = p.x - prev_pic.julia_c.x;
    tmp.y = p.y - prev_pic.julia_c.y;
    p = c_sqrt(tmp);
    SRGP_point(to_point(p, &prev_pic));
    n++;
  }
  SRGP_setClipRectangle(pic->area);
}
Exemple #3
0
/******************************************************************

  DrawDrawingArea() -- This function draws the specified drawing area.

******************************************************************/
GS_errorType
DrawDrawingArea(GSgadgetStruct *area)
{

   if (area->gadget_type == GSDRAWAREA) {

      /*  draw background of drawing area
       */
      SRGP_setColor(area->gadget_bgd_color);
      SRGP_fillRectangle(area->gadget_extent);

      /*  draw outline of drawing area
       */
      SRGP_setColor(area->gadget_bor_color);
      SRGP_rectangle(area->gadget_extent);

      /*  reset drawing color back to foreground color
       */
      SRGP_setColor(area->gadget_fgd_color);
   }
   else
      return(GSNOTDRAWAREA);

   return(GSNOERROR);
} /* end of DrawDrawingArea()*/
Exemple #4
0
/******************************************************************

  DrawMenuBar() -- This function draws the specified menu bar gadget.

******************************************************************/
GS_errorType
DrawMenuBar(GSgadgetStruct *mb)
{
   int 	i;
   char *item_label;

   GS_errorType ExtractItemLabel();


   if (mb->gadget_type == GSMENUBAR) {

      /*  draw background of menu bar 
       */
      SRGP_setColor(mb->gadget_bgd_color);
      SRGP_fillRectangle(mb->gadget_extent);

      /*  draw outline of menu bar
       */
      SRGP_setColor(mb->gadget_bor_color);
      SRGP_rectangle(mb->gadget_extent);

      /*  draw menu labels of menu bar
       */
      SRGP_setColor(mb->gadget_fgd_color);

      for (i = 0; i < mb->menubar->item_count; i++) {
         ExtractItemLabel(i, mb->menubar->item_list, item_label);
         SRGP_text(mb->menubar->item_pos[i], item_label);
      }
   }
   else
      return(GSNOTMENUBARERR);

   return(GSNOERROR);
} /* end of DrawMenuBar()*/
Exemple #5
0
/******************************************************************

  DrawPushButton() -- This function draws the specified push 
		button gadget.

******************************************************************/
GS_errorType
DrawPushButton(GSgadgetStruct *bg)
{
   if (bg->gadget_type == GSPUSHBUTTON) {

      /*  draw background of button 
       */
      SRGP_setColor(bg->gadget_bgd_color);
      SRGP_fillRectangle(bg->gadget_extent);

      /*  draw outline of button
       */
      SRGP_setColor(bg->gadget_bor_color);
      SRGP_rectangle(bg->gadget_extent);

      /*  draw label of button
       */
      SRGP_setColor(bg->gadget_fgd_color);
      SRGP_text(bg->button->label_pos, bg->button->label);
   }
   else
      return(GSNOTBUTTONERR);

   return(GSNOERROR);
} /* end of DrawPushButton() */
Exemple #6
0
/******************************************************************

  DrawToggleButton() -- This function draws the specified toggle 
		button gadget.

******************************************************************/
GS_errorType
DrawToggleButton(GSgadgetStruct *bg)
{
   if (bg->gadget_type == GSTOGBUTTON) {

      switch(bg->togbutton->shape)
      {
         case GSTOGSQUARE:
            if (bg->togbutton->state == FALSE)
            {
               /*  draw background of button 
                */
               SRGP_setColor(bg->gadget_bgd_color);
               SRGP_fillRectangle(bg->togbutton->square);

               /*  draw outline of button
                */
               SRGP_setColor(bg->gadget_bor_color);
               SRGP_rectangle(bg->togbutton->square);
            }
            else
            {
               /*  draw background of button 
                */
               SRGP_setColor(bg->gadget_bor_color);
               SRGP_fillRectangle(bg->togbutton->square);

               /*  draw outline of button
                */
               SRGP_setColor(bg->gadget_bgd_color);
               SRGP_rectangle(bg->togbutton->square);
            }
            break;
         case GSTOGDIAMOND:
            break;
         case GSTOGCIRCLE:
            break;
         default:
            break;
      }

      /*  draw label of button
       */
      SRGP_setColor(bg->gadget_fgd_color);
      SRGP_text(bg->togbutton->label_pos, bg->togbutton->label);
   }
   else
      return(GSNOTBUTTONERR);

   return(GSNOERROR);
} /* end of DrawToggleButton() */
Exemple #7
0
void print_coords(infoptr pic, point mouse_pos, rectangle box)
{
  char coord_string[20];
  dpoint coords;

  /* Peitetään vanha teksti */
  SRGP_setColor(SRGP_BLACK);
  SRGP_fillRectangle(box);
  
  /* Muotoillaan uusi teksti */
  coords = to_dpoint(mouse_pos, pic);
  sprintf(coord_string, "(%.17f, %.17f)", coords.x, coords.y);
  SRGP_setColor(SRGP_WHITE);
  SRGP_setClipRectangle(box); /* Varmistetaan ettei teksti ylitä rajoja */
  SRGP_text(box.bottom_left, coord_string);
  SRGP_setClipRectangle(pic->area);
}
Exemple #8
0
static void
EVUprint (char *text)
{
   SRGP_inquireAttributes (&bund);
   SRGP_setColor (COLOR_BLACK);
   SRGP_setWriteMode (WRITE_REPLACE);
   SRGP_setClipRectangle (SRGP_defRectangle(0,0,1023,799));
   SRGP_text (SRGP_defPoint(15,ycoord), text);
   ycoord -= ydelta;
   SRGP_setAttributes (&bund);
}
Exemple #9
0
void repaint(infoptr pic, rectangle area)
{
  point p;
  int n;

  for(p.y = area.bottom_left.y; p.y <= area.top_right.y; p.y++)
    for(p.x = area.bottom_left.x; p.x <= area.top_right.x; p.x++)
    { 
      /* Muutetaan pikselikoordinaatit joukon koordinaateiksi ja iteroidaan */
      if(pic->is_mandel)    /* Mandelbrotin joukko */
	n = iterate(to_dpoint(p, pic),     /* alkupiste  */
		    to_dpoint(p, pic),     /* iteraation lisäys */
		    pic->max_iterations);  /* max iteraatiot */

      else   /* Julian joukko */
	n = iterate(to_dpoint(p, pic),
		    pic->julia_c,
		    pic->max_iterations);

      /* Pikselin väri hajaantumisnopeuden n mukaan */
      SRGP_setColor(select_color(n, pic->max_iterations));
      SRGP_point(p);
    }
}
Exemple #10
0
PRIVATE void doExposureAnimation(SUIT_object newGuy)
{
    
    /* the animations run a little faster after the first time */
    static	boolean firstTime = TRUE;
    SUIT_object o = SUIT_name("property editor export button");
    
    GP_pushGraphicsState();
    si_animateOverTime(moveTheTruck, o, firstTime ? 1000 : 500); 
    GP_popGraphicsState();		       
    
    SUIT_redisplayRequired(o); /* clean up after ourselves */
    
    /* now draw attention to the new guy */

    GP_pushGraphicsState();
    SRGP_setColor(1);
    SRGP_setWriteMode (WRITE_XOR);
    si_animateOverTime(si_animateScreenBorderToObject, newGuy, firstTime ? 1000 : 500);
    GP_popGraphicsState();		       

    firstTime = FALSE;

}