Ejemplo n.º 1
0
int display_emotes_handler(window_info *win){

	int i,pos;
	actor *act = get_actor_ptr_from_id(yourself);
	static int last_pos=0;



	//check if vbar has been moved
	pos=vscrollbar_get_pos(emotes_win, EMOTES_SCROLLBAR_ITEMS);
	if(pos!=last_pos){
		last_pos=pos;
		update_selectables();
	}

	//draw texts
	glEnable(GL_TEXTURE_2D);
	
	SET_COLOR(c_orange1);
	draw_string_small(20, 15, (unsigned char*)"Categories",1);
	draw_string_small(20, emotes_rect_y+30+5, (unsigned char*)"Emotes",1);

	for(i=0;i<EMOTES_CATEGORIES;i++){
		if(cur_cat==i) SET_COLOR(c_blue2);
		else glColor3f(1.0f, 1.0f, 1.0f);
		draw_string_small(23, 32+13*i, (unsigned char*)emote_cats[i],1);
	}

	for(i=0;i<EMOTES_SHOWN;i++){
		if(emote_sel[cur_cat]==selectables[i]) SET_COLOR(c_blue2);
		else glColor3f(1.0f, 1.0f, 1.0f);
		if(cur_cat&&act&&selectables[i]==act->poses[cur_cat-1]) SET_COLOR(c_green1);
		if(selectables[i])
			draw_string_small(23, 30+emotes_rect_y+20+1+13*i, (unsigned char*)selectables[i]->name,1);
	}
	glColor3f(0.77f, 0.57f, 0.39f);
	//do grids
	glDisable(GL_TEXTURE_2D);
		
	rendergrid(1, 1, 20, 30, emotes_rect_x, emotes_rect_y);
	rendergrid(1, 1, 20, 30+emotes_rect_y+20, emotes_rect_x2, emotes_rect_y2);
	glEnable(GL_TEXTURE_2D);


	//draw description
	if(emote_sel[cur_cat]){
		draw_string_small(20, emotes_menu_y_len-36, emote_str1,2);
		draw_string_small(20, emotes_menu_y_len-36+16, emote_str2,1);
	}

#ifdef OPENGL_TRACE
CHECK_GL_ERRORS();
#endif //OPENGL_TRACE
	return 1;	
}
Ejemplo n.º 2
0
void
palette_editor_actions_update (GimpActionGroup *group,
                               gpointer         user_data)
{
  GimpPaletteEditor *editor      = GIMP_PALETTE_EDITOR (user_data);
  GimpDataEditor    *data_editor = GIMP_DATA_EDITOR (user_data);
  GimpData          *data;
  gboolean           editable    = FALSE;
  GimpRGB            fg;
  GimpRGB            bg;
  gboolean           edit_active = FALSE;

  data = data_editor->data;

  if (data)
    {
      if (data_editor->data_editable)
        editable = TRUE;
    }

  if (data_editor->context)
    {
      gimp_context_get_foreground (data_editor->context, &fg);
      gimp_context_get_background (data_editor->context, &bg);
    }

  edit_active = gimp_data_editor_get_edit_active (data_editor);

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_ACTIVE(action,condition) \
        gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
        gimp_action_group_set_action_color (group, action, color, FALSE);

  SET_SENSITIVE ("palette-editor-edit-color",   editable && editor->color);
  SET_SENSITIVE ("palette-editor-delete-color", editable && editor->color);

  SET_SENSITIVE ("palette-editor-new-color-fg", editable);
  SET_SENSITIVE ("palette-editor-new-color-bg", editable);

  SET_COLOR ("palette-editor-new-color-fg", data_editor->context ? &fg : NULL);
  SET_COLOR ("palette-editor-new-color-bg", data_editor->context ? &bg : NULL);

  SET_SENSITIVE ("palette-editor-zoom-out", data);
  SET_SENSITIVE ("palette-editor-zoom-in",  data);
  SET_SENSITIVE ("palette-editor-zoom-all", data);

  SET_ACTIVE ("palette-editor-edit-active", edit_active);

#undef SET_SENSITIVE
#undef SET_ACTIVE
#undef SET_COLOR
}
Ejemplo n.º 3
0
/* =============================================================================
 * fixAfterInsertion
 * =============================================================================
 */
static void
fixAfterInsertion (rbtree_t* s, node_t* x)
{
    STF(x, c, RED);
    while (x != NULL && x != LDNODE(s, root)) {
        node_t* xp = LDNODE(x, p);
        if (LDF(xp, c) != RED) {
            break;
        }
        /* TODO: cache g = ppx = PARENT_OF(PARENT_OF(x)) */
        if (PARENT_OF(x) == LEFT_OF(PARENT_OF(PARENT_OF(x)))) {
            node_t*  y = RIGHT_OF(PARENT_OF(PARENT_OF(x)));
            if (COLOR_OF(y) == RED) {
                SET_COLOR(PARENT_OF(x), BLACK);
                SET_COLOR(y, BLACK);
                SET_COLOR(PARENT_OF(PARENT_OF(x)), RED);
                x = PARENT_OF(PARENT_OF(x));
            } else {
                if (x == RIGHT_OF(PARENT_OF(x))) {
                    x = PARENT_OF(x);
                    ROTATE_LEFT(s, x);
                }
                SET_COLOR(PARENT_OF(x), BLACK);
                SET_COLOR(PARENT_OF(PARENT_OF(x)), RED);
                if (PARENT_OF(PARENT_OF(x)) != NULL) {
                    ROTATE_RIGHT(s, PARENT_OF(PARENT_OF(x)));
                }
            }
        } else {
            node_t* y = LEFT_OF(PARENT_OF(PARENT_OF(x)));
            if (COLOR_OF(y) == RED) {
                SET_COLOR(PARENT_OF(x), BLACK);
                SET_COLOR(y, BLACK);
                SET_COLOR(PARENT_OF(PARENT_OF(x)), RED);
                x = PARENT_OF(PARENT_OF(x));
            } else {
                if (x == LEFT_OF(PARENT_OF(x))) {
                    x = PARENT_OF(x);
                    ROTATE_RIGHT(s, x);
                }
                SET_COLOR(PARENT_OF(x),  BLACK);
                SET_COLOR(PARENT_OF(PARENT_OF(x)), RED);
                if (PARENT_OF(PARENT_OF(x)) != NULL) {
                    ROTATE_LEFT(s, PARENT_OF(PARENT_OF(x)));
                }
            }
        }
    }
    node_t* ro = LDNODE(s, root);
    if (LDF(ro, c) != BLACK) {
        STF(ro, c, BLACK);
    }
}
Ejemplo n.º 4
0
ge_Light* geCreateLight(float x, float y, float z, u32 diffuse, u32 ambient){
	ge_Light* light = (ge_Light*)geMalloc(sizeof(ge_Light));
	light->type = GE_LIGHT_TYPE_OMNIDIRECTIONNAL;
	light->used = true;
	light->attenuation = -2.0;
	light->position.x = x;
	light->position.y = y;
	light->position.z = z;
	light->position.w = 1.0;
	light->target.w = 1.0;
	SET_COLOR(light->diffuse, diffuse);
	SET_COLOR(light->ambient, ambient);
	return light;
}
Ejemplo n.º 5
0
void drawRecordScreen1(uchar i, uchar pos) {
  struct HiScore* h;
  uchar l;
  char buf[14];

  for(h=hiScores+i; i<9; ++i, ++h) {
    if(pos==i) { SET_COLOR(COLOR_YELLOW); } else SET_COLOR(COLOR_WHITE);
            
    memcpy(buf, "             ", 14);
    memcpy(buf, h->name, strlen(h->name));
    i2s(buf+8, h->score);
  
    print(25, 7+i, 14, buf);
  }
}
Ejemplo n.º 6
0
////////////////////////////////////////////////////////
// Composite class
//
Composite::Composite()
{
	_padding = 100;
	_width = 0;
	_height = 0;
	SET_COLOR(1,0.5,0.5,0.3);
}
Ejemplo n.º 7
0
void drawOnOff(uchar n, uchar state) {
  uchar i;
  uchar* d = onOff[n];
  if(state) SET_COLOR(COLOR_GREEN) else SET_COLOR(COLOR_BLUE);
  for(i=4; i; --i, d+=0x100)
    memcpy(d, d, 8);
}
Ejemplo n.º 8
0
void drawScore(uint score, char* scoreText) {
  uchar n;
  register uchar* s;  

  SET_COLOR(COLOR_GREEN);
  print1(PIXELCOORDS(40,7),2,5,scoreText);
  
  if(score < hiScores[0].score) {
    n = (score / (hiScores[0].score / 13));
    if(n>13) n=13;
  } else {
    n = 14;
  }

  if(playerSpriteTop != n) {
    playerSpriteTop = n;
    for(s=PIXELCOORDS(40, 167); n; --n, s-=4)
      bitBlt(s, imgPlayerD, 5*256+4);  
    bitBlt(s-46, imgPlayer, 5*256+50);                                         
    if(playerSpriteTop == 14) {
      bitBlt(s-50+0x200, imgPlayerWin, 3*256+16);
      bitBlt(PIXELCOORDS(3, 53), imgKingLose, 6*256+62);                                         
    }
  }
}
Ejemplo n.º 9
0
void drawBall(uchar x, uchar y, uchar* o, uchar c) {
  register uchar* d = cellAddr(x, y);
  SET_COLOR(COLOR_BLUE);
  d[-1] = 0x55;
  d[0x100-1] = 0x55;  
  drawBall1(d, o, c);
}
Ejemplo n.º 10
0
void drawCursor() {
//  drawSpriteBallOr(cellAddr(cursorX, cursorY), imgBalls + 21*16*11 + 3);
  SET_COLOR(COLOR_YELLOW);
  memset(cellAddr(cursorX, cursorY), 255, 2);
  memset(cellAddr(cursorX, cursorY)+0x100, 255, 2);
  memset(cellAddr(cursorX, cursorY)+12, 255, 2);
  memset(cellAddr(cursorX, cursorY)+0x100+12, 255, 2);
}
Ejemplo n.º 11
0
void initGameScreen2() {
  uchar *s, i, x, y;

  SET_COLOR(COLOR_BLACK);                                                    
  unmlz((uchar*)0x9000, imgScreen);
  unmlz((uchar*)0x4800, imgScreen_colors);
  colorizer_rand();
    
  SET_COLOR(COLOR_GREEN);
  print(56,19,8,"ВЫ");
  
  updateTopScore();
  playerSpriteTop = -1;
  drawScore1();
//  redrawNewBalls2();
  if(!showPath ) drawOnOff(0, 0);
  if(!playSound) drawOnOff(1, 0);
  if(!showHelp ) drawOnOff(2, 0);
//  drawCells();
}
Ejemplo n.º 12
0
void updateTopScore() {
  char buf[7];

  // Выводим счет игрока
  i2s(buf, hiScores[0].score);
  SET_COLOR(COLOR_GREEN);
  print1(PIXELCOORDS(3,7),1,5,buf);

  // Выводим имя игрока
  print1(PRINTARGS(5,19),7|0x80,hiScores[0].name);
}
Ejemplo n.º 13
0
void
colormap_actions_update (GimpActionGroup *group,
                         gpointer         data)
{
  GimpImage   *image      = action_data_get_image (data);
  GimpContext *context    = action_data_get_context (data);
  gboolean     indexed    = FALSE;
  gint         num_colors = 0;
  GimpRGB      fg;
  GimpRGB      bg;

  if (image)
    {
      indexed    = (gimp_image_get_base_type (image) == GIMP_INDEXED);
      num_colors = gimp_image_get_colormap_size (image);
    }

  if (context)
    {
      gimp_context_get_foreground (context, &fg);
      gimp_context_get_background (context, &bg);
    }

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
        gimp_action_group_set_action_color (group, action, color, FALSE);

  SET_SENSITIVE ("colormap-edit-color",
                 image && indexed && num_colors > 0);
  SET_SENSITIVE ("colormap-add-color-from-fg",
                 image && indexed && num_colors < 256);
  SET_SENSITIVE ("colormap-add-color-from-bg",
                 image && indexed && num_colors < 256);

  SET_COLOR ("colormap-add-color-from-fg", context ? &fg : NULL);
  SET_COLOR ("colormap-add-color-from-bg", context ? &bg : NULL);

#undef SET_SENSITIVE
#undef SET_COLOR
}
Ejemplo n.º 14
0
	void Settings::ProcessINI(){

// Extra stuff to make life easier
#define GET_INT(a, b, c) m_appIni.GetInteger(a, b, c)
#define SET_COLOR(a, b) m_colors.SetColor(a, RGB2COLORREF(b))
		// Load colors

		SET_COLOR(Colors::SEL_COLOR, GET_INT("colors", "sel_color", 0));
		SET_COLOR(Colors::INACTIVE_SEL_COLOR, GET_INT("colors", "inactive_sel_color", 0));
		SET_COLOR(Colors::BK_COLOR, GET_INT("colors", "bk_color", 0));
		SET_COLOR(Colors::CODELIST_ITEM_COLOR, GET_INT("colors", "codelist_item_color", 0));
		SET_COLOR(Colors::CODELIST_CURRENTLINE_COLOR, GET_INT("colors", "codelist_currentline_color", 0));

		// Load animate speed
		m_nums.SetNum(Nums::ANIMATE_SPEED, GET_INT("numbers", "animate_speed", 10));
		m_nums.SetNum(Nums::STEP_INTO_EXTERN_INT, GET_INT("numbers", "step_into_extern_int", 0));
		m_nums.SetNum(Nums::STEP_INTO_INT, GET_INT("numbers", "step_into_int", 0));

#undef SET_COLOR

#define SET_FONT(a, b) m_fonts.SetFont(a, b);
		// Load fonts
		// TODO : Load fonts from INI file
		SET_FONT(Fonts::GUI_FONT, (HFONT)GetStockObject(DEFAULT_GUI_FONT));
		SET_FONT(Fonts::MONOSPACE_FONT, (HFONT)GetStockObject(ANSI_FIXED_FONT));

#undef SET_FONT

#undef GET_INT

#define GET_STR(a, b, c) m_appIni.Get(a, b, c)

#define SET_PATH(a, b) m_paths.SetPath(a, b)

		SET_PATH(Paths::BIOS_PATH, GET_STR("paths", "bios_path", ""));

#undef SET_PATH

#undef GET_STR
	}
Ejemplo n.º 15
0
void add_plane(void)
{
    int i;

    for (i = 0; i < MAX_PLANES; i++)
        if (planes[i].speed == 0) {

#define SET_COLOR(r,g,b) \
        planes[i].red=r; planes[i].green=g; planes[i].blue=b; break;

            switch (random() % 6) {
            case 0: SET_COLOR(1.0, 0.0, 0.0); /* red */
            case 1: SET_COLOR(1.0, 1.0, 1.0); /* white */
            case 2: SET_COLOR(0.0, 1.0, 0.0); /* green */
            case 3: SET_COLOR(1.0, 0.0, 1.0); /* magenta */
            case 4: SET_COLOR(1.0, 1.0, 0.0); /* yellow */
            case 5: SET_COLOR(0.0, 1.0, 1.0); /* cyan */
            }
            planes[i].speed = (random() % 20) * 0.001 + 0.02;
            if (random() & 0x1) planes[i].speed *= -1;
            planes[i].theta = ((float) (random() % 257)) * 0.1111;
            tick_per_plane(i);
            if (!moving) draw(glxarea);
            return;
        }
    XBell(dpy, 100); /* can't add any more planes */
}
Ejemplo n.º 16
0
void drawSpriteSel(uchar x, uchar y, uchar s, uchar c, uchar t) {
  uchar* d;
  if(t==1) {
    d = cellAddr(x, y)-1;
    SET_COLOR(COLOR_BLUE);
    d[14] = 0x55;
    d[0x100+14] = 0x55;  
    drawBall1(d, selAnimation[t], s);  
  } else {
    drawBall(x, y, selAnimation[t], s);  
  }

  if(c) drawCursor();

  if(t==3) sound(1, 10);
}
Ejemplo n.º 17
0
void intro() { 
  uint* p;
  uchar s;

  // Выводим заставку
  SET_COLOR(COLOR_BLACK);
  unmlz((uchar*)0x9000, imgTitle);
  unmlz((uchar*)0x4800, imgTitle_colors);
  colorizer_rand();    

  // Выводим заставку
  p = music;
  while(1) {
    s = *p; ++p;
    if(s==0) { while(!getch1(1)); break; }
    if(getch1(1)) break;
    sound(s, *p); ++p;
    rand();
  }
}
static void
hsv_to_rgb (double	  h,
	    double	  s,
	    double	  v,
	    struct color *color)
{
    double m, n, f;
    int i;

    while (h < 0)
	h += 6.;
    while (h > 6.)
	h -= 6.;

    if (s < 0.)
	s = 0.;
    if (s > 1.)
	s = 1.;

    if (v < 0.)
	v = 0.;
    if (v > 1.)
	v = 1.;

    i = floor (h);
    f = h - i;
    if ((i & 1) == 0)
	f = 1 - f;

    m = v * (1 - s);
    n = v * (1 - s * f);
    switch(i){
    default:
    case 6:
    case 0: SET_COLOR (color, v, n, m); break;
    case 1: SET_COLOR (color, n, v, m); break;
    case 2: SET_COLOR (color, m, v, n); break;
    case 3: SET_COLOR (color, m, n, v); break;
    case 4: SET_COLOR (color, n, m, v); break;
    case 5: SET_COLOR (color, v, m, n); break;
    }
}
Ejemplo n.º 19
0
void
add_plane(void)
{
  int i;

  for (i = 0; i < MAX_PLANES; i++)
    if (planes[i].speed == 0) {

#define SET_COLOR(r,g,b) \
        planes[i].red=r; planes[i].green=g; planes[i].blue=b;

      switch (random() % 6) {
      case 0:
        SET_COLOR(1.0, 0.0, 0.0);  /* red */
        break;
      case 1:
        SET_COLOR(1.0, 1.0, 1.0);  /* white */
        break;
      case 2:
        SET_COLOR(0.0, 1.0, 0.0);  /* green */
        break;
      case 3:
        SET_COLOR(1.0, 0.0, 1.0);  /* magenta */
        break;
      case 4:
        SET_COLOR(1.0, 1.0, 0.0);  /* yellow */
        break;
      case 5:
        SET_COLOR(0.0, 1.0, 1.0);  /* cyan */
        break;
      }
      planes[i].speed = ((float) (random() % 20)) * 0.001 + 0.02;
      if (random() & 0x1)
        planes[i].speed *= -1;
      planes[i].theta = ((float) (random() % 257)) * 0.1111;
      tick_per_plane(i);
      if (!moving)
        glutPostRedisplay();
      return;
    }
}
Ejemplo n.º 20
0
static unsigned int ray_color(const point3 e, double t,
                              const point3 d,
                              idx_stack *stk,
                              const rectangular_node rectangulars,
                              const sphere_node spheres,
                              const light_node lights,
                              color object_color, int bounces_left)
{
    rectangular_node hit_rec = NULL, light_hit_rec = NULL;
    sphere_node hit_sphere = NULL, light_hit_sphere = NULL;
    double diffuse, specular;
    point3 l, _l, r, rr;
    object_fill fill;

    color reflection_part;
    color refraction_part;
    /* might be a reflection ray, so check how many times we've bounced */
    if (bounces_left == 0) {
        SET_COLOR(object_color, 0.0, 0.0, 0.0);
        return 0;
    }

    /* check for intersection with a sphere or a rectangular */
    intersection ip= ray_hit_object(e, d, t, MAX_DISTANCE, rectangulars,
                                    &hit_rec, spheres, &hit_sphere);
    if (!hit_rec && !hit_sphere)
        return 0;

    /* pick the fill of the object that was hit */
    fill = hit_rec ?
           hit_rec->element.rectangular_fill :
           hit_sphere->element.sphere_fill;

    void *hit_obj = hit_rec ? (void *) hit_rec : (void *) hit_sphere;

    /* assume it is a shadow */
    SET_COLOR(object_color, 0.0, 0.0, 0.0);

    for (light_node light = lights; light; light = light->next) {
        /* calculate the intersection vector pointing at the light */
        subtract_vector(ip.point, light->element.position, l);
        multiply_vector(l, -1, _l);
        normalize(_l);
        /* check for intersection with an object. use ignore_me
         * because we don't care about this normal
        */
        ray_hit_object(ip.point, _l, MIN_DISTANCE, length(l),
                       rectangulars, &light_hit_rec,
                       spheres, &light_hit_sphere);
        /* the light was not block by itself(lit object) */
        if (light_hit_rec || light_hit_sphere)
            continue;

        compute_specular_diffuse(&diffuse, &specular, d, l,
                                 ip.normal, fill.phong_power);

        localColor(object_color, light->element.light_color,
                   diffuse, specular, &fill);
    }

    reflection(r, d, ip.normal);
    double idx = idx_stack_top(stk).idx, idx_pass = fill.index_of_refraction;
    if (idx_stack_top(stk).obj == hit_obj) {
        idx_stack_pop(stk);
        idx_pass = idx_stack_top(stk).idx;
    } else {
        idx_stack_element e = { .obj = hit_obj,
                                .idx = fill.index_of_refraction
                              };
        idx_stack_push(stk, e);
    }

    refraction(rr, d, ip.normal, idx, idx_pass);
    double R = (fill.T > 0.1) ?
               fresnel(d, rr, ip.normal, idx, idx_pass) :
               1.0;

    /* totalColor = localColor +
                    mix((1-fill.Kd) * fill.R * reflection, T * refraction, R)
     */
    if (fill.R > 0) {
        /* if we hit something, add the color */
        int old_top = stk->top;
        if (ray_color(ip.point, MIN_DISTANCE, r, stk, rectangulars, spheres,
                      lights, reflection_part,
                      bounces_left - 1)) {
            multiply_vector(reflection_part, R * (1.0 - fill.Kd) * fill.R,
                            reflection_part);
            add_vector(object_color, reflection_part,
                       object_color);
        }
        stk->top = old_top;
    }
    /* calculate refraction ray */
    if ((length(rr) > 0.0) && (fill.T > 0.0) &&
            (fill.index_of_refraction > 0.0)) {
        normalize(rr);
        if (ray_color(ip.point, MIN_DISTANCE, rr, stk,rectangulars, spheres,
                      lights, refraction_part,
                      bounces_left - 1)) {
            multiply_vector(refraction_part, (1 - R) * fill.T,
                            refraction_part);
            add_vector(object_color, refraction_part,
                       object_color);
        }
    }

    protect_color_overflow(object_color);
    return 1;
}

/* @param background_color this is not ambient light */
void raytracing(void* args)
{
    arg *data = (arg*) args;
    point3 u, v, w, d;
    color object_color = { 0.0, 0.0, 0.0 };

    const viewpoint *view = (*data).View;
    color back = { 0.0 , 0.1 , 0.1 };
    uint8_t *pixels = data->pixels;
    int start_j,end_j;

    /*	Separate to count the pixels  */
    if(pthread_equal(pthread_self(),THREAD[0])) {
        start_j = 0;
        end_j = 128;
    } else if(pthread_equal(pthread_self(),THREAD[1])) {
        start_j = 128;
        end_j = 256;
    } else if(pthread_equal(pthread_self(),THREAD[2])) {
        start_j = 256;
        end_j = 384;
    } else if(pthread_equal(pthread_self(),THREAD[3])) {
        start_j = 384;
        end_j = 512;
    }

    /* calculate u, v, w */
    calculateBasisVectors(u, v, w, view);

    idx_stack stk;

    int factor = sqrt(SAMPLES);

    #pragma omp parallel for num_threads(64)	\
    private(stk), private(d),	\
    private(object_color)
    for (int j = start_j ; j < end_j; j++) {
        for (int i = 0 ; i < (*data).row; i++) {
            double r = 0, g = 0, b = 0;
            /* MSAA */
            for (int s = 0; s < SAMPLES; s++) {
                idx_stack_init(&stk);
                rayConstruction(d, u, v, w,
                                i * factor + s / factor,
                                j * factor + s % factor,
                                view,
                                (*data).row * factor, (*data).col * factor);
                if (ray_color(view->vrp, 0.0, d, &stk,(*data).rectangulars,
                              (*data).spheres, (*data).lights, object_color,
                              MAX_REFLECTION_BOUNCES)) {
                    r += object_color[0];
                    g += object_color[1];
                    b += object_color[2];
                } else {
                    r += back[0];
                    g += back[1];
                    b += back[2];
                }
                pixels[((i + (j * (*data).row)) * 3) + 0] = r * 255 / SAMPLES;
                pixels[((i + (j * (*data).row)) * 3) + 1] = g * 255 / SAMPLES;
                pixels[((i + (j * (*data).row)) * 3) + 2] = b * 255 / SAMPLES;
            }
        }
    }
}
Ejemplo n.º 21
0
int
_dxfPlineDraw (tdmPortHandleP portHandle, xfieldT *xf, int buttonUp)
{
  Vector *normals ;
  Point *points = 0 ;
  struct p2d {float x, y ;} *pnts2d = 0 ;
  RGBColor *fcolors, *color_map ;
  char *cache_id ;
  enum approxE approx ;
  tdmStripArraySB *stripsSB = 0 ;
  int type, rank, shape, is_2d ;

  DEFPORT(portHandle) ;

  ENTRY(("_dxfPlineDraw(0x%x, 0x%x, %d)", portHandle, xf, buttonUp));

  /*
   *  Transparent surfaces are stripped for those ports which implement
   *  transparency with the screen door technique, but we need to sort them
   *  as individual polygons to apply the more accurate alpha composition
   *  method supported by Starbase.
   *
   *  Connection-dependent colors are not supported by Starbase strips.
   */

  approx = buttonUp ? xf->attributes.buttonUp.approx :
	              xf->attributes.buttonDown.approx ;

  if (
#ifdef ALLOW_LINES_APPROX_BY_DOTS
      (approx == approx_dots) ||
#endif
      (xf->colorsDep == dep_connections))
    {
      int status ;
      PRINT(("drawing as individual polygons"));
      status = _dxfLineDraw (portHandle, xf, buttonUp) ;
      EXIT((""));
      return status ;
    }

  /*
   *  Extract rendering data from the xfield.
   */

  if (DXGetArrayClass(xf->fcolors_array) == CLASS_CONSTANTARRAY)
      fcolors = (Pointer) DXGetArrayEntry(xf->fcolors, 0, NULL) ;
  else
      fcolors = (Pointer) DXGetArrayData(xf->fcolors_array) ;

  color_map = (RGBColor *) DXGetArrayData(xf->cmap_array) ;

  if (DXGetArrayClass(xf->normals_array) == CLASS_CONSTANTARRAY)
      normals = (Pointer) DXGetArrayEntry(xf->normals, 0, NULL) ;
  else
      normals = (Pointer) DXGetArrayData(xf->normals_array) ;

#if 0
  if (xf->colorsDep != dep_field)
  {
    /*
     *  Dense fields of varying colors are visually confusing
     *  without hidden surface, even with wireframe approximation.
     */
    hidden_surface (FILDES, TRUE, FALSE) ;
  }
  else /* RE : <LUMBA281> */
  {
     hidden_surface(FILDES, TRUE, FALSE);
  }
#endif 

  hidden_surface(FILDES, TRUE, FALSE);

  if (xf->colorsDep == dep_field)
    {
      /* render field in constant color */
      cache_id = "CpfPline" ;
      SET_COLOR(fill_color, 0) ;
      SET_COLOR(line_color, 0) ;
    }
  else
    {
      cache_id = "CpfPline" ;
    }

  /*
   *  Render strips.
   */
  
  PRINT(("%s", cache_id));
  if (stripsSB = tdmGetTmeshCacheSB (cache_id, xf))
    {
      /*
       *  Use pre-constructed Starbase strips obtained from executive cache.
       */
      
      register tdmTmeshCacheSB *stripArray, *end ;
      PRINT(("got strips from cache"));
      PrintBounds() ;
      
      stripArray = stripsSB->stripArray ;
      end = &stripArray[stripsSB->num_strips] ;
      
      for ( ; stripArray < end ; stripArray++)
	{
	  polyline_with_data3d
	    (FILDES, stripArray->clist, stripArray->numverts,
	     stripArray->numcoords, stripArray->vertex_flags, NULL) ;
	}
    }
  else
    {
      /*
       *  Construct an array of Starbase strips and cache it.
       */

      register int vsize ;
      int *connections, (*strips)[2] ;
      int cOffs, nOffs, vertex_flags, facet_flags, numStrips ;
      tdmTmeshCacheSB *stripArray ;
      PRINT(("building new strips"));

      /* determine vertex and facet types and sizes */
      vertex_flags = 0 ;
      facet_flags = UNIT_NORMALS ;
      vsize = 3 ;

      if (fcolors && xf->colorsDep != dep_field)
	{
	  /* vertex has at least 6 floats, with color at float 3 */
	  vsize = 6 ; cOffs = 3 ;
	  vertex_flags |= VERTEX_COLOR ;
	}
      
      /* get positions */
      if (is_2d = IS_2D (xf->positions_array, type, rank, shape))
	pnts2d = (struct p2d *) DXGetArrayData(xf->positions_array) ;
      else
	points = (Point *) DXGetArrayData(xf->positions_array) ;
      
      /* get strip topology */
      connections = (int *)DXGetArrayData(xf->connections_array) ;
      strips = (int (*)[2])DXGetArrayData(xf->meshes) ;
      numStrips = xf->nmeshes ;
      
      DebugMessage() ;
      
      /* allocate space for Starbase strip data */
      stripsSB = (tdmStripArraySB *) tdmAllocate(sizeof(tdmStripArraySB)) ;
      if (!stripsSB)
	{
	  PRINT(("out of memory allocating strip structure"));
	  DXErrorGoto (ERROR_INTERNAL, "#13000") ;
	}
      
      stripsSB->stripArray = 0 ;
      stripsSB->num_strips = 0 ;
      
      /* allocate array of Starbase strips */
      stripArray =
	stripsSB->stripArray = (tdmTmeshCacheSB *)
	  tdmAllocate(numStrips*sizeof(tdmTmeshCacheSB));
      
      if (!stripArray)
	{
	  PRINT(("out of memory allocating array of strips"));
	  DXErrorGoto (ERROR_INTERNAL, "#13000") ;
	}
      
      for ( ; stripsSB->num_strips < numStrips ; stripsSB->num_strips++)
	{
	  /* each iteration constructs and draws one Starbase strip */
	  register float *clist = 0, *gnormals = 0 ;
	  register int i, dV, *pntIdx, numPnts ;
	  
	  stripArray->clist = 0 ;
	  stripArray->gnormals = 0 ;
	  
	  /* get the number of points in this strip */
	  numPnts = strips[stripsSB->num_strips][1] ;
	  
	  /* allocate coordinate list */
	  stripArray->clist = clist =
	    (float *) tdmAllocate(numPnts*vsize*sizeof(float)) ;
	  
	  if (!clist)
	    {
	      PRINT(("out of memory allocating coordinate list"));
	      DXErrorGoto(ERROR_INTERNAL, "#13000") ;
	    }
	  
	  /* get the sub-array of connections making up this strip */
	  pntIdx = &connections[strips[stripsSB->num_strips][0]] ;
	  
	  /* copy vertex coordinates into clist */
	  if (is_2d)
	    for (i=0, dV=0 ; i<numPnts ; i++, dV+=vsize)
	      {
		*(struct p2d *)(clist+dV) = pnts2d[pntIdx[i]] ;
		((Point *)(clist+dV))->z = 0 ;
	      }
	  else
	    for (i=0, dV=0 ; i<numPnts ; i++, dV+=vsize)
	      *(Point *)(clist+dV) = points[pntIdx[i]] ;
	  
	  /* copy vertex colors */
	  if (vertex_flags & VERTEX_COLOR)
	    if (color_map)
	      for (i=0, dV=cOffs ; i<numPnts ; i++, dV+=vsize)
		*(RGBColor *)(clist+dV) =
		  color_map[((char *)fcolors)[pntIdx[i]]] ;
	    else
	      for (i=0, dV=cOffs ; i<numPnts ; i++, dV+=vsize)
		*(RGBColor *)(clist+dV) = fcolors[pntIdx[i]] ;
	  
	  /* save other strip info */
	  stripArray->numverts = numPnts ;
	  stripArray->numcoords = vsize-3 ;
	  stripArray->vertex_flags = vertex_flags ;
	  stripArray->facet_flags = facet_flags ;
	  
	  polyline_with_data3d (FILDES, clist, numPnts,
				vsize-3, vertex_flags, NULL) ;
	  
	  /* increment strip */
	  stripArray++ ;
	}
      
      /* cache strip array */
      tdmPutTmeshCacheSB (cache_id, xf, stripsSB) ;
    }

  /* restore hidden surface OFF */
  hidden_surface(FILDES, FALSE, FALSE) ;
  EXIT(("OK"));
  return OK ;

 error:
  tdmFreeTmeshCacheSB((Pointer)stripsSB) ;
  hidden_surface(FILDES, FALSE, FALSE) ;
  EXIT(("ERROR"));
  return ERROR ;
}
Ejemplo n.º 22
0
void
view_actions_update (GimpActionGroup *group,
                     gpointer         data)
{
  GimpDisplay        *display        = action_data_get_display (data);
  GimpImage          *image          = NULL;
  GimpDisplayShell   *shell          = NULL;
  GimpDisplayOptions *options        = NULL;
  gchar              *label          = NULL;
  gboolean            fullscreen     = FALSE;
  gboolean            revert_enabled = FALSE;   /* able to revert zoom? */
  gboolean            use_gegl       = FALSE;

  if (display)
    {
      GimpImageWindow *window;

      image  = gimp_display_get_image (display);
      shell  = gimp_display_get_shell (display);
      window = gimp_display_shell_get_window (shell);

      if (window)
        fullscreen = gimp_image_window_get_fullscreen (window);

      options = (image ?
                 (fullscreen ? shell->fullscreen_options : shell->options) :
                 shell->no_image_options);

      revert_enabled = gimp_display_shell_scale_can_revert (shell);

      if (image)
        use_gegl = gimp_image_get_projection (image)->use_gegl;
    }

#define SET_ACTIVE(action,condition) \
        gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
        gimp_action_group_set_action_color (group, action, color, FALSE)

  SET_SENSITIVE ("view-new",   image);
  SET_SENSITIVE ("view-close", image);

  SET_SENSITIVE ("view-dot-for-dot", image);
  SET_ACTIVE    ("view-dot-for-dot", display && shell->dot_for_dot);

  SET_SENSITIVE ("view-zoom-revert", revert_enabled);
  if (revert_enabled)
    {
      label = g_strdup_printf (_("Re_vert Zoom (%d%%)"),
                               ROUND (shell->last_scale * 100));
      gimp_action_group_set_action_label (group, "view-zoom-revert", label);
      g_free (label);
    }
  else
    {
      gimp_action_group_set_action_label (group, "view-zoom-revert",
                                          _("Re_vert Zoom"));
    }

  SET_SENSITIVE ("view-zoom-out",    image);
  SET_SENSITIVE ("view-zoom-in",     image);
  SET_SENSITIVE ("view-zoom-fit-in", image);
  SET_SENSITIVE ("view-zoom-fill",   image);

  SET_SENSITIVE ("view-zoom-16-1",  image);
  SET_SENSITIVE ("view-zoom-8-1",   image);
  SET_SENSITIVE ("view-zoom-4-1",   image);
  SET_SENSITIVE ("view-zoom-2-1",   image);
  SET_SENSITIVE ("view-zoom-1-1",   image);
  SET_SENSITIVE ("view-zoom-1-2",   image);
  SET_SENSITIVE ("view-zoom-1-4",   image);
  SET_SENSITIVE ("view-zoom-1-8",   image);
  SET_SENSITIVE ("view-zoom-1-16",  image);
  SET_SENSITIVE ("view-zoom-other", image);

  if (image)
    view_actions_set_zoom (group, shell);

  SET_SENSITIVE ("view-navigation-window", image);
  SET_SENSITIVE ("view-display-filters",   image);

  SET_SENSITIVE ("view-show-selection",      image);
  SET_ACTIVE    ("view-show-selection",      display && options->show_selection);
  SET_SENSITIVE ("view-show-layer-boundary", image);
  SET_ACTIVE    ("view-show-layer-boundary", display && options->show_layer_boundary);
  SET_SENSITIVE ("view-show-guides",         image);
  SET_ACTIVE    ("view-show-guides",         display && options->show_guides);
  SET_SENSITIVE ("view-show-grid",           image);
  SET_ACTIVE    ("view-show-grid",           display && options->show_grid);
  SET_SENSITIVE ("view-show-sample-points",  image);
  SET_ACTIVE    ("view-show-sample-points",  display && options->show_sample_points);

  SET_SENSITIVE ("view-snap-to-guides",      image);
  SET_ACTIVE    ("view-snap-to-guides",      display && shell->snap_to_guides);
  SET_SENSITIVE ("view-snap-to-grid",        image);
  SET_ACTIVE    ("view-snap-to-grid",        display && shell->snap_to_grid);
  SET_SENSITIVE ("view-snap-to-canvas",      image);
  SET_ACTIVE    ("view-snap-to-canvas",      display && shell->snap_to_canvas);
  SET_SENSITIVE ("view-snap-to-vectors",     image);
  SET_ACTIVE    ("view-snap-to-vectors",     display && shell->snap_to_vectors);

  SET_SENSITIVE ("view-padding-color-theme",       image);
  SET_SENSITIVE ("view-padding-color-light-check", image);
  SET_SENSITIVE ("view-padding-color-dark-check",  image);
  SET_SENSITIVE ("view-padding-color-custom",      image);
  SET_SENSITIVE ("view-padding-color-prefs",       image);

  if (display)
    {
      SET_COLOR ("view-padding-color-menu", &options->padding_color);

      if (shell->canvas)
        {
          GtkStyle *style = gtk_widget_get_style (shell->canvas);
          GimpRGB   color;

          gtk_widget_ensure_style (shell->canvas);
          gimp_rgb_set_gdk_color (&color, style->bg + GTK_STATE_NORMAL);
          gimp_rgb_set_alpha (&color, GIMP_OPACITY_OPAQUE);

          SET_COLOR ("view-padding-color-theme",  &color);
        }
    }

  SET_SENSITIVE ("view-show-menubar",    image);
  SET_ACTIVE    ("view-show-menubar",    display && options->show_menubar);
  SET_SENSITIVE ("view-show-rulers",     image);
  SET_ACTIVE    ("view-show-rulers",     display && options->show_rulers);
  SET_SENSITIVE ("view-show-scrollbars", image);
  SET_ACTIVE    ("view-show-scrollbars", display && options->show_scrollbars);
  SET_SENSITIVE ("view-show-statusbar",  image);
  SET_ACTIVE    ("view-show-statusbar",  display && options->show_statusbar);

  SET_SENSITIVE ("view-shrink-wrap", image);
  SET_SENSITIVE ("view-fullscreen",  image);
  SET_ACTIVE    ("view-fullscreen",  display && fullscreen);
  SET_ACTIVE    ("view-use-gegl",    use_gegl);

  if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
      GIMP_IS_GIMP (group->user_data))
    {
      GtkWidget *window = NULL;

      if (shell)
        window = gtk_widget_get_toplevel (GTK_WIDGET (shell));

      /*  see view_actions_setup()  */
      if (GTK_IS_WINDOW (window))
        window_actions_update (group, window);
    }

#undef SET_ACTIVE
#undef SET_SENSITIVE
#undef SET_COLOR
}
Ejemplo n.º 23
0
void drawBall1(uchar* d, uchar* o, uchar c) {
  SET_COLOR(colors[c-1]);
  bitblt_bw(d, o, 0x20E);
}
Ejemplo n.º 24
0
void
items_actions_update (GimpActionGroup *group,
                      const gchar     *prefix,
                      GimpItem        *item)
{
  GEnumClass *enum_class;
  GEnumValue *value;
  gchar       action[32];
  gboolean    visible       = FALSE;
  gboolean    linked        = FALSE;
  gboolean    has_color_tag = FALSE;
  gboolean    locked        = FALSE;
  gboolean    can_lock      = FALSE;
  gboolean    locked_pos    = FALSE;
  gboolean    can_lock_pos  = FALSE;
  GimpRGB     tag_color;

  if (item)
    {
      visible      = gimp_item_get_visible (item);
      linked       = gimp_item_get_linked (item);
      locked       = gimp_item_get_lock_content (item);
      can_lock     = gimp_item_can_lock_content (item);
      locked_pos   = gimp_item_get_lock_position (item);
      can_lock_pos = gimp_item_can_lock_position (item);

      has_color_tag = gimp_get_color_tag_color (gimp_item_get_color_tag (item),
                                                &tag_color, FALSE);
    }

#define SET_SENSITIVE(action,condition) \
        gimp_action_group_set_action_sensitive (group, action, (condition) != 0)
#define SET_ACTIVE(action,condition) \
        gimp_action_group_set_action_active (group, action, (condition) != 0)
#define SET_COLOR(action,color) \
        gimp_action_group_set_action_color (group, action, color, FALSE)

  g_snprintf (action, sizeof (action), "%s-visible", prefix);
  SET_SENSITIVE (action, item);
  SET_ACTIVE    (action, visible);

  g_snprintf (action, sizeof (action), "%s-linked", prefix);
  SET_SENSITIVE (action, item);
  SET_ACTIVE    (action, linked);

  g_snprintf (action, sizeof (action), "%s-lock-content", prefix);
  SET_SENSITIVE (action, can_lock);
  SET_ACTIVE    (action, locked);

  g_snprintf (action, sizeof (action), "%s-lock-position", prefix);
  SET_SENSITIVE (action, can_lock_pos);
  SET_ACTIVE    (action, locked_pos);

  g_snprintf (action, sizeof (action), "%s-color-tag-menu", prefix);
  SET_COLOR (action, has_color_tag ? &tag_color : NULL);

  enum_class = g_type_class_ref (GIMP_TYPE_COLOR_TAG);

  for (value = enum_class->values; value->value_name; value++)
    {
      g_snprintf (action, sizeof (action),
                  "%s-color-tag-%s", prefix, value->value_nick);

      SET_SENSITIVE (action, item);
    }

  g_type_class_unref (enum_class);

#undef SET_SENSITIVE
#undef SET_ACTIVE
#undef SET_COLOR
}
Ejemplo n.º 25
0
/*setup_windows{{{*/
void setup_windows(int flags) {
 obj_param_t tmp_parm;

 globl_drop_depth =25;
 globl_flags = DROP_SHADOW;
 init_gui(WIDTH, HEIGHT, flags);

 SET_COLOR(globl_fg, 		0   ,0   ,0);
 SET_COLOR(globl_bg, 		224 ,224 ,204);
 SET_COLOR(globl_move_color, 	0x1f,0x8f,0x1f);
 SET_COLOR(hscroll_color, 	0   ,0x7f,0xff);
 SET_COLOR(sprite_color, 	0xff,0x7f,0);
 SET_COLOR(window_color, 	0   ,0   ,0xff);
 SET_COLOR(scroll_b_color, 	0xff,0   ,0xff);
 SET_COLOR(scroll_a_color, 	0xff,0   ,0);

 change_message_grp = new_group(40,40, 202, 77, globl_flags, globl_drop_depth);
 simple_window(change_message_grp, 200, 75);
 PARM(50, 45,100,20, &globl_fg, &globl_bg, SHOW_FOCUS | QUIT_BUTTON, proc_button_box);
 tmp_parm.dp1 = (void *)"Okay";
 new_obj(change_message_grp, &tmp_parm);
 PARM(12,16,172,20,&globl_fg, &globl_bg, MAX_CHARS|SHOW_FOCUS, proc_edit_line);
 tmp_parm.d3 = 80;
 text_edit_object = new_obj(change_message_grp, &tmp_parm);

 select_grp = new_group(0,0,WIDTH, HEIGHT,0,0);
 PARM(305,126,320,240,&globl_fg,&globl_bg,0,select_special);
 select_special_object = new_obj(select_grp, &tmp_parm);


 PARM(0,0, 304, 126, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = 0;
 new_obj(select_grp, &tmp_parm);

 PARM(0,126,304,240, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = HORIZONTAL;
 new_obj(select_grp, &tmp_parm);

 PARM(0, 366, 305, 112, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = 0;
 new_obj(select_grp, &tmp_parm);

 PARM(305, 0, 320, 126, 0,0, 0, select_quit_on_click);
 new_obj(select_grp, &tmp_parm);

 PARM(305, 366, 320, 114, 0,0, 0, select_quit_on_click);
 tmp_parm.user_flags = VERTICAL;
 new_obj(select_grp, &tmp_parm);

 PARM(625, 0, 15, 480, 0,0,0, select_quit_on_click);
 tmp_parm.user_flags = 0;
 new_obj(select_grp, &tmp_parm);

 main_grp = new_group(0,0, WIDTH, HEIGHT, 0, 0);

 PARM(0,0,WIDTH,HEIGHT,&globl_fg,&globl_bg,DROP_ACCUM|LOAD_XPM_FROM_ARRAY,proc_bitmap);
 tmp_parm.dp1 = back_xpm;
 background_object = new_obj(main_grp, &tmp_parm);

 PARM(82,22,0,0,&globl_fg,&globl_bg,
   TOGGLE|CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = undo_button;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 1;
 tmp_parm.dp1 = undo_xpm;
 new_obj(main_grp, &tmp_parm);


 /* tools */

 PARM(124, 22, 0, 0, &globl_fg, &globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = select_xpm;
 select_object = new_obj(main_grp, &tmp_parm);

 PARM(82, 53, 0, 0, &globl_fg, &globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = pal_hi_low_xpm;
 pal_hi_low_object = new_obj(main_grp, &tmp_parm);

 PARM(124, 53, 0, 0, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = flip_xpm;
 flip_object = new_obj(main_grp, &tmp_parm);
 

 PARM(82,88,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = line_xpm;
 line_object = new_obj(main_grp, &tmp_parm);
 last_tool = line_object;

 PARM(124,88,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = put_pat_xpm;
 put_pat_object = new_obj(main_grp, &tmp_parm);

 PARM(82,123,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button); 
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = fill_xpm;
 fill_object = new_obj(main_grp, &tmp_parm);

 PARM(124,123,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = clear_to_color_xpm;
 clear_to_color_object = new_obj(main_grp, &tmp_parm);


 PARM(82,158,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button); 
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = pic_xpm;
 pic_object = new_obj(main_grp, &tmp_parm);

 PARM(124,158,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button); 
 tmp_parm.callback = tool_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = pic_pat_xpm;
 pic_pat_object = new_obj(main_grp, &tmp_parm);



 /* not tools */

#ifndef WINDOWS
 PARM(580,450,50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"F/W";
 tmp_parm.callback = fw_bottom;
 new_obj(main_grp, &tmp_parm);
#endif

 
 PARM(580,1,50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Quit";
 tmp_parm.callback = really_quit;
 new_obj(main_grp, &tmp_parm);

 
 PARM(500,1,50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"About";
 tmp_parm.callback = about;
 new_obj(main_grp, &tmp_parm);

 PARM(20,1, 50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Load";
 tmp_parm.user_flags = LOAD;
 tmp_parm.callback=load_save_top;
 new_obj(main_grp, &tmp_parm);

 load_grp = new_menu(20,5, load_menu, &globl_fg, &globl_bg);

 PARM(75,1, 50,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Save";
 tmp_parm.user_flags = SAVE;
 tmp_parm.callback=load_save_top;
 new_obj(main_grp, &tmp_parm);

 save_grp = new_menu(75,5, save_menu, &globl_fg, &globl_bg);
 high_low_grp = new_menu(124,88, high_low_menu, &globl_fg, &sprite_color);
 hor_ver_grp = new_menu(124,88,horizontal_vertical_menu, &globl_fg, &sprite_color);
 pal_hi_low_grp = new_menu(124,88, pal_hi_low_menu, &globl_fg, &sprite_color);
 copy_move_grp = new_menu(124,88,copy_move_menu, &globl_fg, &sprite_color);

 PARM(380,1,90,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON|DROP_SHADOW,proc_button_box);
 tmp_parm.dp1 = (void *)"Background";
 tmp_parm.callback = change_background;
 new_obj(main_grp, &tmp_parm);

 PARM(425,81,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = preview_zoom_change;
 tmp_parm.d1 = FALSE;
 tmp_parm	.d2 = 4;
 tmp_parm.dp1 = zoom_out_xpm;
 preview_zoom_out = new_obj(main_grp,&tmp_parm);

 PARM(461,81,0,0,&globl_fg,&globl_bg,
   CALL_BUTTON|SHOW_FOCUS|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = preview_zoom_change;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 5;
 tmp_parm.dp1 = zoom_in_xpm;
 preview_zoom_in = new_obj(main_grp,&tmp_parm);

 PARM(499,83, 31,27, &globl_fg,&globl_bg,CALL_BUTTON,proc_button_box);
 tmp_parm.callback = change_bg_color;
 tmp_parm.dp1 = (char *)" ";
 bg_color_box = new_obj(main_grp, &tmp_parm);
 UPDATE_BG_COLOR;

 PARM(305,114,320,11,&globl_move_color, &globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 256;
 tmp_parm.d1 = 0;
 tmp_parm.callback = preview_scroll_change;
 preview_scroll_bar = new_obj(main_grp, &tmp_parm);

 PARM(292,126,11,240,&globl_move_color,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 0;
 tmp_parm.d1 = 0;
 preview_y_scroll = new_obj(main_grp,&tmp_parm);

 PARM(305,367,320,11,&globl_move_color,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 0;
 tmp_parm.d1 = 0;
 preview_x_scroll = new_obj(main_grp,&tmp_parm);


 tmp_parm.callback = preview_size_change;
 PARM(293,82,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 1;
 tmp_parm.dp1 = (void *)"NTSC";
 preview_ntsc = new_obj(main_grp, &tmp_parm);

 PARM(293,96,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 1;
 tmp_parm.dp1 = (void *)"PAL";
 preview_pal = new_obj(main_grp, &tmp_parm);

 PARM(348,82,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = (void *)"40 cell";
 preview_40c = new_obj(main_grp, &tmp_parm);

 PARM(348,96,0,0,&globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 2;
 tmp_parm.dp1 = (void *)"32 cell";
 preview_32c = new_obj(main_grp, &tmp_parm);




 PARM(190,297,11,176,&globl_move_color,&globl_bg,CALL_BUTTON|SHOW_FOCUS,proc_scroll_bar);
 tmp_parm.d2 = 0xf6;
 tmp_parm.d1 = 0;
 tmp_parm.callback = pattern_select_bot;
 pattern_select_scroll_bar = new_obj(main_grp, &tmp_parm);

 
 PARM(10,301,179,0xa*16,&globl_fg,&globl_bg,0,proc_pattern_select);
 pattern_select_object = new_obj(main_grp, &tmp_parm);

 PARM(10,22,70,260,&globl_fg,&globl_bg,0,proc_palette_change_object);
 palette_change_object = new_obj(main_grp, &tmp_parm);

 /* Pattern edit */
 PARM(88,200,67,83,&globl_fg,&globl_bg,0,proc_pattern_edit);
 pattern_edit_object = new_obj(main_grp, &tmp_parm);

 PARM(305,126,320,240,&globl_fg,&globl_bg,0,proc_preview_object);
 preview_object = new_obj(main_grp,&tmp_parm);

 PARM(540,88,65,17,&globl_fg,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_button_box);
 tmp_parm.dp1 = (void *)"overlay";
 tmp_parm.callback = load_ovr_window;
 preview_overlay = new_obj(main_grp, &tmp_parm);


/* View and edit what? */

 tmp_parm.callback = edit_change;
 PARM(254,96,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 3;
 tmp_parm.user_flags = EDIT_SCROLL_A;
 tmp_parm.dp1 = scroll_a_edit_xpm;
 new_obj(main_grp, &tmp_parm);
 currently_editing = EDIT_SCROLL_A;

 PARM(254,120,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 3;
 tmp_parm.user_flags = EDIT_SCROLL_B;
 tmp_parm.dp1 = scroll_b_edit_xpm;
 new_obj(main_grp, &tmp_parm);

 PARM(254,144,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY, proc_icon_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 3;
 tmp_parm.user_flags = EDIT_SPRITE;
 tmp_parm.dp1 = sprite_edit_xpm;
 new_obj(main_grp, &tmp_parm);


 tmp_parm.callback = edit_change;
 PARM(230,96,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_B;
 tmp_parm.dp1 = scroll_b_xpm;
 new_obj(main_grp, &tmp_parm);

 PARM(230,120,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_A;
 tmp_parm.dp1 = scroll_a_xpm;
 new_obj(main_grp, &tmp_parm);


 PARM(230,120+24,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_B_HIGH;
 tmp_parm.dp1 = scroll_b_high_xpm;
 new_obj(main_grp, &tmp_parm);

 PARM(230,120+24+24,0,0,&globl_fg,&globl_bg, 
   SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY|SINGLE_RADIO, proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 4;
 tmp_parm.user_flags = VIEW_SCROLL_A_HIGH;
 tmp_parm.dp1 = scroll_a_high_xpm;
 new_obj(main_grp, &tmp_parm);





 PARM(353,25,31,31, &hscroll_color, &globl_bg, 0, proc_scroll_size);
 new_obj(main_grp, &tmp_parm); 

 PARM(415,25,41,41, &globl_fg, &globl_bg, 0, proc_sprite_size);
 new_obj(main_grp, &tmp_parm); 

 PARM(369, 64,0,0,&globl_fg, &globl_bg, 0, proc_ctext);
 tmp_parm.dp1 = (void *)malloc( 8 );
 snprintf(tmp_parm.dp1, 8, "64x64");
 scroll_width = 1;
 scroll_height = 1;

 scroll_size2 =new_obj(main_grp, &tmp_parm);

 sprite_width = 0;
 sprite_height = 0;

 PARM(410, 393,41,51, &globl_fg, &globl_bg, CALL_BUTTON|MODULAR|HEX|INACTIVE, proc_knob);
 tmp_parm.d1 = 40;
 tmp_parm.d2 = 0x400;
 tmp_parm.user_flags = KNOB;
 tmp_parm.callback = knob_tick;
 knob = new_obj(main_grp, &tmp_parm);


 PARM(244,410, 23,24,&globl_fg, &globl_bg,
   LOAD_XPM_FROM_ARRAY|SHOW_FOCUS|CALL_BUTTON|SINGLE_RADIO,proc_icon_button);
 tmp_parm.dp1 = small_knob_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 200;
 tmp_parm.callback = knob_select;
 knob_icon = new_obj(main_grp,&tmp_parm);

 PARM(315, 422, 0,0, &globl_fg, &globl_bg, 0, proc_ctext);
 tmp_parm.dp1 = (void *)malloc(64);
 snprintf( tmp_parm.dp1, 64, ":<");
 knob_text = new_obj(main_grp,&tmp_parm);


 PARM(272, 256, 11, 82, &globl_fg, &globl_bg, 0, proc_scroll_bar_special)
 tmp_parm.d1 = 2;
 tmp_parm.d2 = 2;
 tmp_parm.user_flags = HORIZONTAL;
 horizontal_scroll_bar = new_obj(main_grp, &tmp_parm);

 PARM(493,385, 82,11, &globl_fg, &globl_bg, 0, proc_scroll_bar_special);
 tmp_parm.d1 = 0;
 tmp_parm.d2 = 1;
 tmp_parm.user_flags = VERTICAL;
 vertical_scroll_bar = new_obj(main_grp, &tmp_parm);

 PARM(462, 401, 0,0, &globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.d1 = TRUE;
 tmp_parm.d2 = 5;
 tmp_parm.dp1 = (void *)scroll_a_edit_xpm;
 tmp_parm.callback = knob_tick;
 tmp_parm.user_flags = SELECT_A;
 select_a_object = new_obj(main_grp, &tmp_parm);

 PARM(462, 423, 0,0, &globl_fg, &globl_bg, SHOW_FOCUS|CALL_BUTTON|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 5;
 tmp_parm.dp1 = (void *)scroll_b_edit_xpm;
 tmp_parm.callback = knob_tick;
 tmp_parm.user_flags = SELECT_B;
 new_obj(main_grp, &tmp_parm);

 tmp_parm.proc = load_default_mega;
 select_b_object = new_obj(main_grp, &tmp_parm);

 PARM(172, 177, 0,0, &globl_fg, &globl_bg, SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
// tmp_parm.callback = stop_bot;
 tmp_parm.dp1 = (void *)clob_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 clob_object = new_obj(main_grp, &tmp_parm);

 PARM(172, 202, 0,0, &globl_fg, &globl_bg, CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.callback = stop_bot;
 tmp_parm.dp1 = (void *)stop_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 stop_object = new_obj(main_grp, &tmp_parm);

 PARM(172, 227, 0,0, &globl_fg, &globl_bg, CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.callback = go_bot;
 tmp_parm.dp1 = (void *)clear_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 new_obj(main_grp, &tmp_parm);

 PARM(172, 252, 0,0, &globl_fg, &globl_bg, CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,
   proc_icon_button);
 tmp_parm.callback = new_bot;
 tmp_parm.dp1 = (void *)new_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 new_obj(main_grp, &tmp_parm);

 PARM(490, 400, 140, 45, &globl_fg, &globl_bg, DROP_SHADOW, proc_info);
 info_object = new_obj(main_grp, &tmp_parm);

/* SHADOW BOX */

 PARM(170, 175, 25, 100, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(460, 400, 25, 45, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);


 PARM(270, 254, 14, 86, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(491,383, 86, 14, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(240, 407, 150, 30, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 knob_message_box = new_obj(main_grp, &tmp_parm);

 PARM(405, 400, 50, 45, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(340, 21, 58, 50, &globl_fg,&globl_bg, DROP_SHADOW, proc_shadow_box);
 scroll_size1 = new_obj(main_grp, &tmp_parm);

 PARM(340+67, 21, 58, 50, &globl_fg,&globl_bg, DROP_SHADOW, proc_shadow_box);
 sprite_size1 = new_obj(main_grp, &tmp_parm);


 PARM(340+67+67+((58/4)-6), 20+((50/4)-6)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.callback = sprite_overlay;
 tmp_parm.dp1 = (void *)minus_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 minus_object = new_obj(main_grp, &tmp_parm);

 PARM(340+67+67+((58/4)-6), 20+((50/2)+2)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.dp1 = (void *)plus_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 plus_object =  new_obj(main_grp, &tmp_parm);


 PARM(340+67+67+((58/4)+15), 20+((50/4)-6)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.dp1 = (void *)a_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 a_object = new_obj(main_grp, &tmp_parm);

 PARM(340+67+67+((58/4)+15), 20+((50/2)+2)-1, 20, 20, &globl_fg, &globl_bg, 
   CALL_BUTTON|SHOW_FOCUS|SINGLE_RADIO|LOAD_XPM_FROM_ARRAY,proc_icon_button);
 tmp_parm.dp1 = (void *)b_xpm;
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 401;
 b_object = new_obj(main_grp, &tmp_parm);





 PARM(340+67+67,21,58,50, &globl_fg, &globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp,&tmp_parm);
 
 
 PARM(228, 94, 50, 148-24-24, &globl_fg,&globl_bg, DROP_SHADOW, proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(8,19,152,266,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 PARM(8,295,198,179,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 new_obj(main_grp, &tmp_parm);

 

 PARM(288,80,340,300,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 preview_box_object =  new_obj(main_grp, &tmp_parm);

 red.r = 0x7f;
 red.g = 0;
 red.b = 0;

 green.r = 0;
 green.g = 0x7f;
 green.b = 0;
  
 blue.r = 0;
 blue.g = 0;
 blue.b = 0x7f;

 PARM(168,22,100,11,&red,&globl_bg,SHOW_FOCUS|CALL_BUTTON,proc_scroll_bar);
 tmp_parm.d2 = 7;
 tmp_parm.d1 = 
  current_vdp->palette[current_palette][current_palette_index].r / (0xff/7);
 tmp_parm.callback = color_change_bot;
 rgb_red_object = new_obj(main_grp, &tmp_parm);

 tmp_parm.d1 = 
  current_vdp->palette[current_palette][current_palette_index].g / (0xff/7);
 tmp_parm.y+=18;
 tmp_parm.fg = &green;
 rgb_green_object = new_obj(main_grp, &tmp_parm);


 tmp_parm.d1 = 
  current_vdp->palette[current_palette][current_palette_index].b / (0xff/7);
 tmp_parm.y+=18;
 tmp_parm.fg = &blue;
 rgb_blue_object = new_obj(main_grp, &tmp_parm);

 PARM(301,38,24,8,&current_color_text_color,&globl_bg,0,proc_ctext);
 tmp_parm.dp1 = (void *)malloc(4);
 current_color_text_object = new_obj(main_grp,&tmp_parm);

 PARM(301,52,24,8, &current_color_text_color, &globl_bg, 0,proc_ctext);
 tmp_parm.dp1 = (void *)malloc(4);
 current_color_text2_object = new_obj(main_grp, &tmp_parm);
  
 update_color_text();

 PARM(276,30,50,30,&globl_fg,&current_vdp->palette[0][0],0,proc_shadow_box);
 current_color_object = new_obj(main_grp, &tmp_parm);

 PARM(165,19,170,55,&globl_fg,&globl_bg,DROP_SHADOW,proc_shadow_box);
 rgb_box_object = new_obj(main_grp, &tmp_parm);



 overlay_sel = setup_overlay_window(400,300, LOAD, "an image", load_ovr_callback);
 background_sel = setup_overlay_window(400,300, LOAD, "an image", load_background_callback);


 pointers = new_group(200, 300, 151,151,globl_flags,globl_drop_depth);
 simple_window(pointers, 150, 150);

 PARM( 25, 100, 100, 30, &globl_fg, &globl_bg, QUIT_BUTTON|SHOW_FOCUS, proc_button_box);
 tmp_parm.dp1 = (char *)"OK";
 new_obj(pointers, &tmp_parm);

 PARM(30, 20, 0,0, &hscroll_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"hscroll";
 hscroll_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 31, 0,0, &sprite_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"sprite";
 sprite_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 42, 0,0, &scroll_a_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"scroll_a";
 scroll_a_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 53, 0,0, &scroll_b_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"scroll_b";
 scroll_b_radio = new_obj(pointers, &tmp_parm);

 PARM(30, 64, 0,0, &window_color, &globl_bg, SHOW_FOCUS|SINGLE_RADIO, proc_radio_button);
 tmp_parm.d1 = FALSE;
 tmp_parm.d2 = 50;
 tmp_parm.dp1 = (char *)"window";
 window_radio = new_obj(pointers, &tmp_parm);

 load_sel = setup_overlay_window(400,300, LOAD, "123456", load_save_bottom);
 save_sel = setup_overlay_window(400,300, SAVE, "123456", load_save_bottom);
}
Ejemplo n.º 26
0
static int Vertex_newIndex(lua_State* L){
	int argc = lua_gettop(L);

	lua_pushstring(L, "vertex");
	lua_gettable(L, 1);
	ge_Vertex* vertex = *toVertexArray(L, -1);

	const char* key = luaL_checkstring(L, 2);
//	printf("Vertex_newIndex(%s)\n", key);

	if(!strcmp(key, "r")){
		vertex->color[0] = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "g")){
		vertex->color[1] = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "b")){
		vertex->color[2] = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "a")){
		vertex->color[3] = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "color")){
		u32 color = luaL_checkunsigned(L, 3);
		SET_COLOR(vertex->color, color);
		return 1;
	}
	if(!strcmp(key, "x")){
		vertex->x = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "y")){
		vertex->y = lua_tonumber(L, 3);
		return 1;
		return 1;
	}
	if(!strcmp(key, "z")){
		vertex->z = lua_tonumber(L, 3);
		return 1;
		return 1;
	}
	if(!strcmp(key, "u")){
		vertex->u = lua_tonumber(L, 3);
		return 1;
		return 1;
	}
	if(!strcmp(key, "v")){
		vertex->v = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "w")){
		vertex->w = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "nx")){
		vertex->nx = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "ny")){
		vertex->ny = lua_tonumber(L, 3);
		return 1;
	}
	if(!strcmp(key, "nz")){
		vertex->nz = lua_tonumber(L, 3);
		return 1;
	}

	return 1;
}
Ejemplo n.º 27
0
static Bool 
initlisa(ModeInfo * mi, lisas * loop)
{
  lisacons   *lc = &Lisa[MI_SCREEN(mi)];
  lisafuncs **lf = loop->function;
  XPoint     *lp;
  int         phase, pctr, fctr, xctr, yctr, extra_points;
  double      xprod, yprod, xsum, ysum;
  
  xMaxLines = (XMaxRequestSize(MI_DISPLAY(mi))-3)/2;
  /*  printf("Got xMaxLines = %d\n", xMaxLines); */
  loop->nsteps = MI_CYCLES(mi);
  if (loop->nsteps == 0)
	loop->nsteps = 1;
  if (MI_NPIXELS(mi) > 2) {
	loop->color = STARTCOLOR;
	loop->cstep = (loop->nsteps > MI_NPIXELS(mi)) ? loop->nsteps / MI_NPIXELS(mi) : 1;
  } else {
	loop->color = MI_WHITE_PIXEL(mi);
	loop->cstep = 0;
  }
  extra_points = loop->cstep - (loop->nsteps % loop->cstep);
  lc->maxcycles = (MAXCYCLES * loop->nsteps) - 1;
  loop->cstep = ( loop->nsteps > MI_NPIXELS(mi) ) ? loop->nsteps / MI_NPIXELS(mi) : 1;
  /*  printf("Got cstep = %d\n", loop->cstep); */
  loop->melting = 0;
  loop->nfuncs = 1;
  loop->pistep = 2.0 * M_PI / (double) loop->nsteps;
  loop->center.x = lc->width / 2;
  loop->center.y = lc->height / 2;
  loop->radius = (int) MI_SIZE(mi);
  CHECK_RADIUS(loop, lc);
  loop->dx = NRAND(XVMAX);
  loop->dy = NRAND(YVMAX);
  loop->dx++;
  loop->dy++;
#if defined STARTFUNC
  lf[0] = &Function[STARTFUNC];
#else  /* STARTFUNC */
  lf[0] = &Function[NRAND(NUMSTDFUNCS)];
#endif  /* STARTFUNC */	
  
  if ((lp = loop->lastpoint = (XPoint *)
	   calloc(loop->nsteps+extra_points, sizeof (XPoint))) == NULL) {
	free_lisa(lc);
	return False;
  }
  phase = lc->loopcount % loop->nsteps;
  
#if defined DEBUG
  printf( "nsteps = %d\tcstep = %d\tmrs = %d\textra_points = %d\n", 
		  loop->nsteps, loop->cstep, xMaxLines, extra_points );
  PRINT_FUNC(lf[0]);
#endif  /* DEBUG */
  
  for (pctr = 0; pctr < loop->nsteps; pctr++) {
	loop->phi = (double) (pctr - phase) * loop->pistep;
	loop->theta = (double) (pctr + phase) * loop->pistep;
	fctr = loop->nfuncs;
	xsum = ysum = 0.0;
	while (fctr--) {
	  xprod = yprod = (double) loop->radius;
	  xctr = lf[fctr]->nx;
	  yctr = lf[fctr]->ny;
	  while (xctr--)
		xprod *= sin(lf[fctr]->xcoeff[xctr] * loop->theta);
	  while (yctr--)
		yprod *= sin(lf[fctr]->ycoeff[yctr] * loop->phi);
	  xsum += xprod;
	  ysum += yprod;
	}
	if (loop->nfuncs > 1) {
	  xsum /= 2.0;
	  ysum /= 2.0;
	}
	xsum += (double) loop->center.x;
	ysum += (double) loop->center.y;
	
	lp[pctr].x = (int) ceil(xsum);
	lp[pctr].y = (int) ceil(ysum);
  }
  /* this fills in the extra points, so we can use segment-drawing calls */
  for (pctr = loop->nsteps; pctr < loop->nsteps + extra_points; pctr++) {
	lp[pctr].x=lp[pctr - loop->nsteps].x;
	lp[pctr].y=lp[pctr - loop->nsteps].y;
  }
#if defined DRAWLINES
  loop->linewidth = LINEWIDTH;	/* #### make this a resource */
  
  if (loop->linewidth == 0)
	loop->linewidth = 1;
  if (loop->linewidth < 0)
	loop->linewidth = NRAND(-loop->linewidth) + 1;
  XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), loop->linewidth,
					 LINESTYLE, LINECAP, LINEJOIN);
#endif  /* DRAWLINES */
  
  if ( loop->cstep < xMaxLines ) { 
	/* we can send each color segment in a single request 
	 * because the max request length is long enough 
	 * and because we have padded out the array to have extra elements 
	 * to support calls which would otherwise fall off the end*/
	for (pctr = 0; pctr < loop->nsteps; pctr+=loop->cstep) {
	  /* Set the color */
	  SET_COLOR();
	  
#if defined DRAWLINES
	  XDrawLines(MI_DISPLAY(mi), MI_WINDOW(mi),
				 MI_GC(mi), &lp[pctr], loop->cstep, CoordModeOrigin );
#else  /* DRAWLINES */
	  XDrawPoints(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
				  &lp[pctr], loop->cstep, CoordModeOrigin );
#endif  /* DRAWLINES */
	}
  } else { /* do it one by one as before */
	for (pctr = 0; pctr < loop->nsteps; pctr++ ) {
	  SET_COLOR();
	  
#if defined DRAWLINES
	  XDrawLine(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
				lp[pctr].x, lp[pctr].y,
				lp[pctr+1 % loop->nsteps].x, lp[pctr+1 % loop->nsteps].y);
#else  /* DRAWLINES */
	  XDrawPoint(MI_DISPLAY(mi), MI_WINDOW(mi), MI_GC(mi),
				 lp[pctr].x, lp[pctr].y);
#endif  /* DRAWLINES */
	}
  }
  
#if defined DRAWLINES
  XSetLineAttributes(MI_DISPLAY(mi), MI_GC(mi), 1,
					 LINESTYLE, LINECAP, LINEJOIN);
#endif  /* DRAWLINES */
  return True;
}
Ejemplo n.º 28
0
void prepareRecordScreen() {
  SET_COLOR(COLOR_BLUE);
  graph0();
  fillRect1(FILLRECTARGS(108, PLAYFIELD_Y+18, 274, PLAYFIELD_Y+156)); 
}
Ejemplo n.º 29
0
/* =============================================================================
 * fixAfterDeletion
 * =============================================================================
 */
static void
fixAfterDeletion (rbtree_t* s, node_t* x)
{
    while (x != LDNODE(s,root) && COLOR_OF(x) == BLACK) {
        if (x == LEFT_OF(PARENT_OF(x))) {
            node_t* sib = RIGHT_OF(PARENT_OF(x));
            if (COLOR_OF(sib) == RED) {
                SET_COLOR(sib, BLACK);
                SET_COLOR(PARENT_OF(x), RED);
                ROTATE_LEFT(s, PARENT_OF(x));
                sib = RIGHT_OF(PARENT_OF(x));
            }
            if (COLOR_OF(LEFT_OF(sib)) == BLACK &&
                COLOR_OF(RIGHT_OF(sib)) == BLACK) {
                SET_COLOR(sib, RED);
                x = PARENT_OF(x);
            } else {
                if (COLOR_OF(RIGHT_OF(sib)) == BLACK) {
                    SET_COLOR(LEFT_OF(sib), BLACK);
                    SET_COLOR(sib, RED);
                    ROTATE_RIGHT(s, sib);
                    sib = RIGHT_OF(PARENT_OF(x));
                }
                SET_COLOR(sib, COLOR_OF(PARENT_OF(x)));
                SET_COLOR(PARENT_OF(x), BLACK);
                SET_COLOR(RIGHT_OF(sib), BLACK);
                ROTATE_LEFT(s, PARENT_OF(x));
                /* TODO: consider break ... */
                x = LDNODE(s,root);
            }
        } else { /* symmetric */
            node_t* sib = LEFT_OF(PARENT_OF(x));
            if (COLOR_OF(sib) == RED) {
                SET_COLOR(sib, BLACK);
                SET_COLOR(PARENT_OF(x), RED);
                ROTATE_RIGHT(s, PARENT_OF(x));
                sib = LEFT_OF(PARENT_OF(x));
            }
            if (COLOR_OF(RIGHT_OF(sib)) == BLACK &&
                COLOR_OF(LEFT_OF(sib)) == BLACK) {
                SET_COLOR(sib,  RED);
                x = PARENT_OF(x);
            } else {
                if (COLOR_OF(LEFT_OF(sib)) == BLACK) {
                    SET_COLOR(RIGHT_OF(sib), BLACK);
                    SET_COLOR(sib, RED);
                    ROTATE_LEFT(s, sib);
                    sib = LEFT_OF(PARENT_OF(x));
                }
                SET_COLOR(sib, COLOR_OF(PARENT_OF(x)));
                SET_COLOR(PARENT_OF(x), BLACK);
                SET_COLOR(LEFT_OF(sib), BLACK);
                ROTATE_RIGHT(s, PARENT_OF(x));
                /* TODO: consider break ... */
                x = LDNODE(s, root);
            }
        }
    }

    if (x != NULL && LDF(x,c) != BLACK) {
       STF(x, c, BLACK);
    }
}
void
vtkTimeSliderActor::CreateSlider(vtkViewport *viewport)
{
    double BL[2] = {this->GetPosition()[0], this->GetPosition()[1]};
    double TR[2] = {this->GetPosition()[0] + this->GetPosition2()[0],
                   this->GetPosition()[1] + this->GetPosition2()[1]};

#ifdef CREATE_POLYDATA_IN_SCREEN_SPACE
    viewport->NormalizedDisplayToDisplay(BL[0], BL[1]);
    viewport->NormalizedDisplayToDisplay(TR[0], TR[1]);
#endif

    //
    // If we're drawing endcaps, move the bar in a little to make room.
    //
    double BarHeight = TR[1] - BL[1];
    if(BarHeight < 0.f) BarHeight = -BarHeight;
    double EndCapRadius = BarHeight / 2.;
    if(this->DrawEndCaps != 0)
    {
        BL[0] += EndCapRadius;
        TR[0] -= EndCapRadius;
    }

    double CY = (TR[1] + BL[1]) / 2.;
    double CX = BL[0];
    double CX2 = TR[0];

    double midX(this->ParametricTime * TR[0] + (1.-this->ParametricTime) * BL[0]);

    int numPts = 4 * (this->VerticalDivisions + 1);
    int nNewPtsPerAngle = this->VerticalDivisions / 2;
    int nNewPtsPerEndCap = nNewPtsPerAngle * (this->RadialDivisions+1) + 1;

    if(this->DrawEndCaps)
        numPts += (nNewPtsPerEndCap * 2 );
    vtkPoints *points = vtkPoints::New();
    points->SetNumberOfPoints(numPts);
    vtkCellArray *polys = vtkCellArray::New();
    polys->Allocate(polys->EstimateSize(2, 4));
    vtkUnsignedCharArray *colors = vtkUnsignedCharArray::New();
    colors->SetNumberOfComponents(N_COLOR_COMPONENTS);
    colors->SetNumberOfTuples(numPts);

    this->SliderPolyData = vtkPolyData::New();
    this->SliderPolyData->Initialize();
    this->SliderPolyData->SetPoints(points);
    this->SliderPolyData->SetPolys(polys);
    this->SliderPolyData->GetPointData()->SetScalars(colors);
    points->Delete(); polys->Delete(); colors->Delete();

    //
    // Create the points and colors to use for the cells.
    //
    double pt[3]; pt[2] = 0.;
    int i, index = 0;
    unsigned char *rgb = colors->GetPointer(0);
    vtkIdType ptIds[4];
    double lColor[N_COLOR_COMPONENTS], rColor[N_COLOR_COMPONENTS];

    for(i = 0; i < this->VerticalDivisions + 1; ++i)
    {
        double t = double(i) / double(this->VerticalDivisions);
        double omt = 1.f - t;
        double y = t * TR[1] + omt * BL[1];

        pt[0] = BL[0];
        pt[1] = y;
        points->SetPoint(index++, pt);
        pt[0] = midX;
        pt[1] = y;
        points->SetPoint(index++, pt);
        pt[0] = midX;
        pt[1] = y;
        points->SetPoint(index++, pt);
        pt[0] = TR[0];
        pt[1] = y;
        points->SetPoint(index++, pt);

        if(this->Draw3D)
        {
            // If we're making it look 3D, then use shading in the colors.
            double angle = omt * 3.14159;
            double colorT = sin(angle) * 0.7;
            for(int j = 0; j < N_COLOR_COMPONENTS; ++j)
            {
                lColor[j] = colorT * this->StartColor[j] + 0.3 * this->StartColor[j];
                rColor[j] = colorT * this->EndColor[j] + 0.3 * this->EndColor[j];
            }
        }
        else
        {
            for(int j = 0; j < N_COLOR_COMPONENTS; ++j)
            {
                lColor[j] = this->StartColor[j];
                rColor[j] = this->EndColor[j];
            }
        }

#if N_COLOR_COMPONENTS == 4
        // Don't allow opacity to vary with shading. That's weird.
        lColor[3] = this->StartColor[3];
        rColor[3] = this->EndColor[3];
#endif

        SET_COLOR(rgb, lColor);
        SET_COLOR(rgb, lColor);
        SET_COLOR(rgb, rColor);
        SET_COLOR(rgb, rColor);
    }

    //
    // Create the cells.
    //
    for(i = 0; i < this->VerticalDivisions; ++i)
    {
        int index1 = i * 4;
        int index2 = index1 + 4;

        ptIds[0] = index1;
        ptIds[1] = index1 + 1;
        ptIds[2] = index2 + 1;
        ptIds[3] = index2;
        polys->InsertNextCell(4, ptIds);

        ptIds[0] = index1 + 2;
        ptIds[1] = index1 + 3;
        ptIds[2] = index2 + 3;
        ptIds[3] = index2 + 2;
        polys->InsertNextCell(4, ptIds);
    }

    //
    // Create the end caps if we want to draw them.
    //
    if(this->DrawEndCaps)
    {
        double startColor[N_COLOR_COMPONENTS];
        double endColor[N_COLOR_COMPONENTS];
        int ci;
        for(ci = 0; ci < N_COLOR_COMPONENTS; ++ci)
        {
            startColor[ci] = this->StartColor[ci];
            endColor[ci] = this->EndColor[ci];
        }

        if(this->ParametricTime <= 0.)
        {
            for(ci = 0; ci < N_COLOR_COMPONENTS; ++ci)
                startColor[ci] = this->EndColor[ci];
#if N_COLOR_COMPONENTS == 4
            startColor[3] = this->EndColor[3];
#endif
        }

        if(this->ParametricTime >= 1.)
        {
            for(ci = 0; ci < N_COLOR_COMPONENTS; ++ci)
                endColor[ci] = this->StartColor[ci];
#if N_COLOR_COMPONENTS == 4
            endColor[3] = this->StartColor[3];
#endif
        }

        int center = index;
        pt[0] = CX;
        pt[1] = CY;
        points->SetPoint(index++, pt);
        SET_COLOR(rgb, startColor);

        int nRings = this->VerticalDivisions / 2;

        for(i = 0; i < this->RadialDivisions+1; ++i)
        {
            double t = double(i) / double(this->RadialDivisions);
            double angle = t * 3.14159;
            double x = cos(angle);
            double y = sin(angle);
            for(int j = 0; j < nRings; ++j)
            {
                // Set the points for the endcap.
                double tr = double(j+1) / double(nRings);
                pt[0] = CX - tr * EndCapRadius * y;
                pt[1] = CY + tr * EndCapRadius * x;
                points->SetPoint(index++, pt);

                // Set the colors for the points in the endcap.
                if(this->Draw3D)
                {
                    double a2 = tr * 3.14159f / 2. + 3.14159f / 2.;
                    double colorT = sin(a2) * 0.7f;
                    double lColor[N_COLOR_COMPONENTS];
                    for(ci = 0; ci < N_COLOR_COMPONENTS; ++ci)
                        lColor[ci] = colorT * startColor[ci] + 0.3 * startColor[ci];
#if N_COLOR_COMPONENTS == 4
                    lColor[3] = startColor[3];
#endif
                    SET_COLOR(rgb, lColor);
                }
                else
                {
                    SET_COLOR(rgb, startColor);
                }
            }
        }
        // Create the cells for the endcap.
        AddEndCapCells(center, polys);

        //
        // Create the right end cap.
        //
        center = index;
        pt[0] = CX2;
        pt[1] = CY;
        points->SetPoint(index++, pt);
        SET_COLOR(rgb, endColor);
        for(i = 0; i < this->RadialDivisions+1; ++i)
        {
            double t = double(i) / double(this->RadialDivisions);
            double angle = t * 3.14159;
            double x = cos(angle);
            double y = sin(angle);
            for(int j = 0; j < nRings; ++j)
            {
                // Set the points for the endcap.
                double tr = double(j+1) / double(nRings);
                pt[0] = CX2 + tr * EndCapRadius * y;
                pt[1] = CY - tr * EndCapRadius * x;
                points->SetPoint(index++, pt);

                // Set the colors for the points in the endcap.
                if(this->Draw3D)
                {
                    double a2 = tr * 3.14159f / 2. + 3.14159f / 2.;
                    double colorT = sin(a2) * 0.7f;
                    double rColor[N_COLOR_COMPONENTS];
                    for(ci = 0; ci < N_COLOR_COMPONENTS; ++ci)
                        rColor[ci] = colorT * endColor[ci] + 0.3 * endColor[ci];
#if N_COLOR_COMPONENTS == 4
                    rColor[3] = endColor[3];
#endif
                    SET_COLOR(rgb, rColor);
                }
                else
                {
                    SET_COLOR(rgb, endColor);
                }
            }
        }
        // Create the cells for the endcap.
        AddEndCapCells(center, polys);
    }

    //
    // Create the actors, etc.
    //
    this->SliderMapper = vtkPolyDataMapper2D::New();
    this->SliderMapper->SetInput(this->SliderPolyData);
#ifndef CREATE_POLYDATA_IN_SCREEN_SPACE
    // If we're not creating the polydata in screen space then we're defining it
    // once in viewport coordinates. Set the transform coordinate so the mapper
    // knows to convert the points to display points before rendering.
    vtkCoordinate *transformCoord = vtkCoordinate::New();
    transformCoord->SetCoordinateSystemToNormalizedViewport();
    this->SliderMapper->SetTransformCoordinate(transformCoord);
    transformCoord->Delete();
#endif

    this->SliderActor = vtkActor2D::New();
    this->SliderActor->SetMapper(this->SliderMapper);
}