Ejemplo n.º 1
0
static
void
explode(int row, int col)
{
    chtype bold;
    erase();
    MvPrintw(row, col, "-");
    showit();

    init_pair(1, get_colour(&bold), my_bg);
    (void) attrset(COLOR_PAIR(1) | bold);
    MvPrintw(row - 1, col - 1, " - ");
    MvPrintw(row + 0, col - 1, "-+-");
    MvPrintw(row + 1, col - 1, " - ");
    showit();

    init_pair(1, get_colour(&bold), my_bg);
    (void) attrset(COLOR_PAIR(1) | bold);
    MvPrintw(row - 2, col - 2, " --- ");
    MvPrintw(row - 1, col - 2, "-+++-");
    MvPrintw(row + 0, col - 2, "-+#+-");
    MvPrintw(row + 1, col - 2, "-+++-");
    MvPrintw(row + 2, col - 2, " --- ");
    showit();

    init_pair(1, get_colour(&bold), my_bg);
    (void) attrset(COLOR_PAIR(1) | bold);
    MvPrintw(row - 2, col - 2, " +++ ");
    MvPrintw(row - 1, col - 2, "++#++");
    MvPrintw(row + 0, col - 2, "+# #+");
    MvPrintw(row + 1, col - 2, "++#++");
    MvPrintw(row + 2, col - 2, " +++ ");
    showit();

    init_pair(1, get_colour(&bold), my_bg);
    (void) attrset(COLOR_PAIR(1) | bold);
    MvPrintw(row - 2, col - 2, "  #  ");
    MvPrintw(row - 1, col - 2, "## ##");
    MvPrintw(row + 0, col - 2, "#   #");
    MvPrintw(row + 1, col - 2, "## ##");
    MvPrintw(row + 2, col - 2, "  #  ");
    showit();

    init_pair(1, get_colour(&bold), my_bg);
    (void) attrset(COLOR_PAIR(1) | bold);
    MvPrintw(row - 2, col - 2, " # # ");
    MvPrintw(row - 1, col - 2, "#   #");
    MvPrintw(row + 0, col - 2, "     ");
    MvPrintw(row + 1, col - 2, "#   #");
    MvPrintw(row + 2, col - 2, " # # ");
    showit();
}
Ejemplo n.º 2
0
void Pattern_rain::activate(void *arg)
{
    m_mode = (Mode)(intptr_t)(arg);
    if (m_mode == RAIN_RANDOM ||
	(unsigned) m_mode >= RAIN_NUM_MODES) {
	m_mode = (Mode) random(1, RAIN_NUM_MODES);
    }
    if (m_mode == RAIN_SINGLE_RANDOM_COLOUR) {
	m_wheel = random(MAX_WHEEL);
    }
    m_drop.reset(get_colour());
}
Ejemplo n.º 3
0
bool Pattern_rain::display()
{
    int y = m_drop.m_y.get();
    if (y >= ROW_COUNT) {
	m_drop.reset(get_colour());
	y = m_drop.m_y.get();
    }
    int x = m_drop.m_x.get();

    draw_pixel(x, y, m_drop.m_c);

    return true;
}
Ejemplo n.º 4
0
int		expose(t_sticks *c)
{
	char	*lives;

	lives = ft_itoa(c->life[0]);
	mlx_clear_window(c->mlx, c->win);
	get_colour(c, 0);
	draw(0, 0, c, 0);
	mlx_string_put(c->mlx, c->win, 240, 20, c->act_co, lives);
	free(lives);
	display_one(c);
	display_two(c);
	display_three(c);
	display_four(c);
	display_five(c);
	lives = ft_itoa(c->life[6]);
	get_colour(c, 6);
	draw(65, 135, c, 6);
	mlx_string_put(c->mlx, c->win, 460, 135, c->act_co, lives);
	free(lives);
	return (0);
}
Ejemplo n.º 5
0
static void		set_material_values(t_env *e, char *pt1, char *pt2)
{
	t_split_string	values;

	values = ft_nstrsplit(pt2, ' ');
	if (!ft_strcmp(pt1, "NAME"))
	{
		ft_strdel(&e->material[e->materials]->name);
		e->material[e->materials]->name = ft_strdup(values.strings[0]);
	}
	else if (!ft_strcmp(pt1, "DIFFUSE"))
		e->material[e->materials]->diff = get_colour(e, values);
	else if (!ft_strcmp(pt1, "SPECULAR"))
		e->material[e->materials]->spec = get_colour(e, values);
	else if (!ft_strcmp(pt1, "REFLECT"))
		e->material[e->materials]->reflect =
			to_range(ft_atod(values.strings[0]), 0.0, 1.0);
	else if (!ft_strcmp(pt1, "REFRACT"))
		e->material[e->materials]->refract =
			to_range(ft_atod(values.strings[0]), 0.0, 1.0);
	else if (!ft_strcmp(pt1, "IOR"))
		e->material[e->materials]->ior = ft_atod(values.strings[0]);
	ft_free_split(&values);
}
Ejemplo n.º 6
0
Histogram::Histogram(vector<Reconstructor::Voxel*> cluster_members, vector<Camera*> c, int k, vector<vector<vector<Reconstructor::Voxel*>>> &camera)
{
	centroid.x = 0;
	centroid.y = 0;
	centroid.z = 0;

	cv::Mat frame_rgb0 = c[0]->getVideoFrame(k);
	cv::Mat frame_rgb1 = c[1]->getVideoFrame(k);
	cv::Mat frame_rgb2 = c[2]->getVideoFrame(k);
	cv::Mat frame_rgb3 = c[3]->getVideoFrame(k);
	cv::Mat frame_hsv0;
	cv::Mat frame_hsv1;
	cv::Mat frame_hsv2;
	cv::Mat frame_hsv3;
	cv::cvtColor(frame_rgb0,frame_hsv0,CV_RGB2HSV);
	cv::cvtColor(frame_rgb1,frame_hsv1,CV_RGB2HSV);
	cv::cvtColor(frame_rgb2,frame_hsv2,CV_RGB2HSV);
	cv::cvtColor(frame_rgb3,frame_hsv3,CV_RGB2HSV);
	vector<cv::Mat> hsv;
	hsv.push_back(frame_hsv0);
	hsv.push_back(frame_hsv1);
	hsv.push_back(frame_hsv2);
	hsv.push_back(frame_hsv3);

	// make array empty
	for(int i = 0; i < HISTOGRAM_SIZE; i++)
	{
		histogram[i] = 0;
	}
	for(int i = 0; i < cluster_members.size(); i++)
	{
		if(cluster_members[i]->z < 800)
		{
			continue;
		}
		int h = get_colour(cluster_members[i], c, hsv, camera);
		if(h >= 0)
		{
			histogram[h/(360/HISTOGRAM_SIZE)] ++;
		}
	}

	// normalize the histogram 
	normalize();

}
Ejemplo n.º 7
0
static void edge_printer(NODE *from, NODE *to, void *data)
{
    if (data)
    {
        DFA *dfa = data;
        LIST *output = get_from_hash(dfa->outputs, to, sizeof(void *));
        DAA_SET *set = output->size ? output->items[0] : NULL;
        if (set)
        {
            printf("{");
            HASH_ITERATOR iter;
            for (hash_iterator(set->set, &iter); hash_iterator_valid(&iter); hash_iterator_next(&iter))
            {
                DECLARATION *decl = CAST_TO_DECLARATION(iter.entry->data);
                printf("<font color=\"%s\">%s</font>", get_colour(decl->colour), (char *) iter.entry->key);
                printf(",");
            }
            printf("}");
        }
    }
}
// Get the data for the given QModelIndex.
QVariant Chain::Chain_Table_Model::data(QModelIndex const& index, int role) const
{
    if (role == Qt::BackgroundRole || role == Qt::BackgroundColorRole)
    {
        // get the background colour for this index
        QColor background_colour = get_colour(index);
        return QVariant(QBrush(background_colour));
    }
    else if (role == Qt::DisplayRole)
    {
        // If you want text in the cells, do it here
        return QVariant();
    }
    else if (role == Qt::ToolTipRole)
    {
        // get the tooltip for this index
        QString tooltip = get_tooltip(index);
        return QVariant(tooltip);
    }
    return QVariant();
}
Ejemplo n.º 9
0
Hit TextureMaterial::apply_material(Vector3D view, Light* light, Hit h) const {
  Vector3D l = light->position - h.intersection;
  Vector3D N = h.normal;
  double r = l.length();
  l.normalize();
  N.normalize();
  view.normalize();

  double ldotN = l.dot(N);
  if (ldotN > 0.0) {
	Vector3D reflected = -l + (2 * ldotN * N);
	reflected.normalize();
	double attenuation = light->falloff[0] + light->falloff[1] * r + 
	  light->falloff[2] * r * r;
	attenuation = 1 / attenuation;
	h.diffuse = ldotN * attenuation * light->colour * get_colour(h.tex_coords);
  } else {
	h.diffuse = Colour(0.0, 0.0, 0.0); 
  }

  return h;
}
Ejemplo n.º 10
0
void add_cell(boost::intmax_t val, const std::string& table_name, const std::string& row_name, const std::string& column_heading)
{
   //
   // Load the table, add our data, and re-write:
   //
   std::string table_id = "table_" + sanitize_string(table_name);
   boost::regex table_e("\\[table:" + table_id
      + "\\s[^\\[]++"
      "((\\["
      "([^\\[\\]]*+(?2)?+)*+"
      "\\]\\s*+)*+\\s*+)"
      "\\]"
      );

   boost::smatch table_location;
   if(regex_search(content, table_location, table_e))
   {
      std::vector<std::vector<std::string> > table_data;
      load_table(table_data, table_location[1].first, table_location[1].second);
      //
      // Figure out which column we're on:
      //
      unsigned column_id = 1001u;
      for(unsigned i = 0; i < table_data[0].size(); ++i)
      {
         if(table_data[0][i] == column_heading)
         {
            column_id = i;
            break;
         }
      }
      if(column_id > 1000)
      {
         //
         // Need a new column, must be adding a new compiler to the table!
         //
         table_data[0].push_back(column_heading);
         for(unsigned i = 1; i < table_data.size(); ++i)
            table_data[i].push_back(std::string());
         column_id = table_data[0].size() - 1;
      }
      //
      // Figure out the row:
      //
      unsigned row_id = 1001;
      for(unsigned i = 1; i < table_data.size(); ++i)
      {
         if(table_data[i][0] == row_name)
         {
            row_id = i;
            break;
         }
      }
      if(row_id > 1000)
      {
         //
         // Need a new row, add it now:
         //
         table_data.push_back(std::vector<std::string>());
         table_data.back().push_back(row_name);
         for(unsigned i = 1; i < table_data[0].size(); ++i)
            table_data.back().push_back(std::string());
         row_id = table_data.size() - 1;
      }
      //
      // Find the best result in this row:
      //
      boost::uintmax_t best = (std::numeric_limits<boost::uintmax_t>::max)();
      std::vector<boost::intmax_t> values;
      for(unsigned i = 1; i < table_data[row_id].size(); ++i)
      {
         if(i == column_id)
         {
            if(val < best)
               best = val;
            values.push_back(val);
         }
         else
         {
            std::cout << "Existing cell value was " << table_data[row_id][i] << std::endl;
            boost::uintmax_t cell_val = get_value_from_cell(table_data[row_id][i]);
            std::cout << "Extracted value: " << cell_val << std::endl;
            if(cell_val < best)
               best = cell_val;
            values.push_back(cell_val);
         }
      }
      //
      // Update the row:
      //
      for(unsigned i = 1; i < table_data[row_id].size(); ++i)
      {
         std::string& s = table_data[row_id][i];
         s = "[role ";
         if(values[i - 1] < 0)
         {
            s += "grey -]";
         }
         else
         {
            s += get_colour(values[i - 1], best);
            s += " ";
            s += format_precision(static_cast<double>(values[i - 1]) / best, 2);
            s += "[br](";
            s += boost::lexical_cast<std::string>(values[i - 1]) + "ns)]";
         }
      }
      //
      // Convert back to a string and insert into content:
      std::sort(table_data.begin() + 1, table_data.end(), [](std::vector<std::string> const& a, std::vector<std::string> const& b) { return a[0] < b[0]; } );
      std::string c = save_table(table_data);
      content.replace(table_location.position(1), table_location.length(1), c);
   }
   else
   {
      //
      // Create a new table and try again:
      //
      std::string new_table = "\n[template " + table_id;
      new_table += "[]\n[table:" + table_id;
      new_table += " ";
      new_table += table_name;
      new_table += "\n[[Function][";
      new_table += column_heading;
      new_table += "]]\n";
      new_table += "[[";
      new_table += row_name;
      new_table += "][[role blue 1.00[br](";
      new_table += boost::lexical_cast<std::string>(val);
      new_table += "ns)]]]\n]\n]\n";

      std::string::size_type pos = content.find("[/tables:]");
      if(pos != std::string::npos)
         content.insert(pos + 10, new_table);
      else
         content += "\n\n[/tables:]\n" + new_table;
      //
      // Add a section for this table as well:
      //
      std::string section_id = "section_" + sanitize_string(table_name);
      if(content.find(section_id + "[]") == std::string::npos)
      {
         std::string new_section = "\n[template " + section_id + "[]\n[section:" + section_id + " " + table_name + "]\n[" + table_id + "]\n[endsect]\n]\n";
         pos = content.find("[/sections:]");
         if(pos != std::string::npos)
            content.insert(pos + 12, new_section);
         else
            content += "\n\n[/sections:]\n" + new_section;
         add_to_all_sections(section_id);
      }
      //
      // Add to list of all tables (not in sections):
      //
      add_to_all_sections(table_id, "performance_all_tables");
   }
}
Ejemplo n.º 11
0
Colour SceneNode::get_colour(Point3D origin, Vector3D dir, const Colour& ambient, 
							 const Colour& bg, const std::list<Light*>& lights, 
							 int num_glossy_rays, int limit) {
  HitInfo info = intersects(origin, dir);
  if (!info.empty() && limit > 0) {
	Hit closest = info.get_closest();
	Material* close_mat = closest.material;
	Colour c(0.0, 0.0, 0.0); 
	for (std::list<Light*>::const_iterator it = lights.begin(); it != lights.end(); ++it) {
	  Vector3D shadow_ray = (*it)->position - closest.intersection;
	  HitInfo shadow_info = intersects(closest.intersection, shadow_ray);
	  closest = close_mat->apply_material(-dir, *it, closest);

	  if (!shadow_info.empty()) {
		std::vector<Hit> all_hits = shadow_info.get_all_hits();
		int num_translucent = 0;
		Colour shadow(0.0, 0.0, 0.0);
		for (unsigned int i = 0; i < all_hits.size(); i++) {
		  Hit h = all_hits.at(i);
		  if (!h.in_shadow) {
			if (num_translucent == 0) {
			  shadow = shadow + closest.diffuse;
			  num_translucent = 1;
			}
			break;
		  } else {
			if ((h.material)->get_transparency() > 0.0) {
			  shadow = shadow + (h.material)->get_transparency() * closest.diffuse;
			  num_translucent++;
			} else {
			  num_translucent = 0;
			  break;
			}
		  }
		}
		if (num_translucent > 0) {
		  c = c + (1.0 / num_translucent) * shadow;
		  c = c + closest.specular;
		}
	  } else {
		c = c + closest.diffuse;
		c = c + closest.specular;
	  }
	}

	if ((closest.material)->should_reflect()) {
	  Vector3D V = dir, N = closest.normal; 
	  V.normalize(); N.normalize();
	  Vector3D reflected = V - (2 * V.dot(N) * N);
	  Colour r = get_colour(closest.intersection, reflected, ambient, bg, lights, 
							num_glossy_rays, limit - 1);

	  if (num_glossy_rays > 0) {
		Vector3D w = reflected;
		w.normalize();
		Vector3D u = w.cross(Vector3D(1.0, 0.0, 0.0));
		u.normalize();
		Vector3D v = w.cross(Vector3D(0.0, 1.0, 0.0));
		v.normalize();
		for (int i = 0; i < num_glossy_rays; i++) {
		  double dx = 0.0;
		  double dy = 0.0;
		  while (dx == 0.0 && dy == 0.0) {
			dx = ((double)(rand() % 100) / 100.0) * 0.125;
			dy = ((double)(rand() % 100) / 100.0) * 0.125;
		  }
		  Vector3D refi = reflected + dx * u + dy * v;
		  if (refi.dot(closest.normal) < 0) {
			refi = -refi;
		  }
		  Colour ri = get_colour(closest.intersection, refi, ambient, bg, lights, 
								 num_glossy_rays, limit - 1);
		  r = r + ri;
		}
		r = (double) (1.0 / (num_glossy_rays + 1)) * r;
	  }
	  c = 0.7 * c + 0.3 * close_mat->get_reflect(r);
	}

	Vector3D refracted;
	if (close_mat->should_refract() && close_mat->get_transmit_ray(refracted, dir, closest)) {
	  Colour refr = get_colour(closest.intersection, refracted, ambient, bg, lights, 
							   num_glossy_rays, limit + 1);
	  c = c + close_mat->get_transparency() * refr;
	}
	c = c + (1.0 - close_mat->get_transparency()) * close_mat->get_ambient(ambient);
	return c;
  } else {
	return bg;
  }
}
Ejemplo n.º 12
0
void label::draw_contents()
{
	const SDL_Rect& loc = location();
	if (!text_.empty() && loc.w > 0 && loc.h > 0)
		font::draw_text(&video(), loc, size_, get_colour(), text_, loc.x, loc.y);
}
Ejemplo n.º 13
0
void print_expression(EXPRESSION *expr, DAA_SET *set)
{
    if (expr == NULL)
    {
        printf("?null?");
    }
    else if (tree_is_type(expr, EXPR_VARIABLE))
    {
        VARIABLE *var = CAST_TO_VARIABLE(expr);
        int defined = !set || find_in_hash(set->set, var->name, strlen(var->name));
        if (set)
            printf("<font color=\"%s\">", get_colour(var->decl->colour));
        printf("%s", var->name);
        if (set)
            printf("</font>");
    }
    else if (tree_is_type(expr, EXPR_INTEGER))
    {
        INTEGER *integer = CAST_TO_INTEGER(expr);
        printf("%d", integer->value);
    }
    else if (tree_is_type(expr, EXPR_STRING))
    {
        STRING *str = CAST_TO_STRING(expr);
        printf("\"%s\"", str->value);
    }
    else if (tree_is_type(expr, EXPR_TUPLE))
    {
        printf("(");
        if (tree_num_children(expr) >= 1)
        {
            print_expression(tree_get_child(expr, 0), set);
        }
        int i;
        for (i = 1; i < tree_num_children(expr); i++)
        {
            printf(", ");
            print_expression(tree_get_child(expr, i), set);
        }
        printf(")");
    }
    else if (is_unary_op(expr))
    {
        printf("%s", get_escaped_op_symbol(expr));
        print_expression(tree_get_child(expr, 0), set);
    }
    else if (is_binary_op(expr))
    {
        print_expression(tree_get_child(expr, 0), set);
        printf(" %s ", get_escaped_op_symbol(expr));
        print_expression(tree_get_child(expr, 1), set);
    }
    else if (tree_is_type(expr, STMT_ASSIGN))
    {
        printf("assign ");
        print_expression(tree_get_child(expr, 0), set);
        printf(" = ");
        print_expression(tree_get_child(expr, 1), set);
    }
    else if (tree_is_type(expr, STMT_TEST))
    {
        printf("test ");
        print_expression(tree_get_child(expr, 0), set);
    }
    else if (tree_is_type(expr, EXPR_CALL))
    {
        VARIABLE *var = tree_get_child(expr, 0);
        printf("%s(", var->name);
        print_expression(tree_get_child(expr, 1), set);
        printf(")");
    }
    else if (tree_is_type(expr, STMT_RETURN))
    {
        printf("return ");
        print_expression(tree_get_child(expr, 0), set);
    }
    else if (tree_is_type(expr, STMT_ENTER))
    {
        printf("enter");
    }
    else if (tree_is_type(expr, STMT_EXIT))
    {
        printf("exit");
    }
    else
    {
        printf("?expr %p %s?", expr, tree_get_name(expr));
    }
}
Ejemplo n.º 14
0
/* ------------------------------------------- */
int
main (int argc, char *argv[])
{
	char line[LINESZ];
	FILE *inFile_p, *outFile_p;
	char *ptr;
	int count, largestCount;
	unsigned lineNum;
	char code[LINESZ], newcode[LINESZ];
	int ret;
	double coverage;
	unsigned colour;

	process_cmdline_args (argc, argv);

	// open files
	inFile_p = fopen (inFileName_pG, "r");
	if (inFile_p == NULL) {
		perror ("fopen (inFile)");
		return 1;
	}
	outFile_p = fopen (outFileName_pG, "w");
	if (outFile_p == NULL) {
		perror ("fopen (outFile)");
		return 1;
	}

	largestCount = find_largest_count (inFile_p);

	// start output file
	fprintf (outFile_p, "<html>\n");
	fprintf (outFile_p, "<head><title>%s</title></head>\n", outFileName_pG);
	fprintf (outFile_p, "<body style=\"padding: 2em 1em 2em 110px; background-position: top left; background-attachment: fixed; background-repeat: no-repeat; background-image: url(gcov2html-check.png);\" bgcolor=\"#000000\"><pre>\n");

	// parse through gcov file
	// to create output
	while (fgets (line, LINESZ, inFile_p) != NULL) {
		if (strncmp (line, "function", 8) == 0)
			continue;
		if (strncmp (line, "call", 4) == 0)
			continue;
		if (strncmp (line, "branch", 6) == 0)
			continue;

		// get count
		ret = sscanf (line, " %d", &count);
		if (ret == 0) {
			if (strncmp (line, "    #####", 9) == 0)
				count = 0;
			else
				count = -1;
		}

		// get line number
		// skip ':'
		ptr = strstr (line, ":");
		++ptr;
		sscanf (ptr, " %u", &lineNum);

		// get rest of line (code)
		// skip ':'
		ptr = strstr (ptr, ":");
		++ptr;
		strcpy (code, ptr);

		// remove trailing '\n'
		ptr = code;
		while ((*ptr != '\n') && *ptr) ++ptr;
		*ptr = 0;

		// calculate colour
		if (count == -1)
			colour = 0xffffff;
		else {
			coverage = (double)count / (double)largestCount;
			colour = get_colour (coverage);
		}
		process_code (code, newcode, LINESZ);
		fprintf (outFile_p, "<font color=\"#%06x\">%s</font>\n", colour, newcode);
	}

	// end output file
	fprintf (outFile_p, "</pre></body>\n");
	fprintf (outFile_p, "</html>");

	// done
	free (inFileName_pG);
	free (outFileName_pG);
	fclose (outFile_p);
	fclose (inFile_p);

	return 0;
}
QColor Chain::Chain_Table_Model::get_colour(QModelIndex const& index) const
{
    return get_colour(index.column(), index.row());
}
Ejemplo n.º 16
0
void print_graph(GRAPH *graph, char *name, void *data)
{
    int i;
    
    graph_sequence++;
    
    printf("subgraph cluster_%s_%d {\n", name, graph_sequence);
    printf("    label=\"%s\"; labelloc=\"t\";\n", name);
    printf("    ranksep=0.1\n");
    printf("    node [shape=\"box\", style=\"filled\"];\n");
    
    /* Vertices. */
    for (i = 0; i < tree_num_children(graph); i++)
    {
        NODE *vertex = tree_get_child(graph, i);
        if (vertex == NULL)
            continue;
        
        if (combine_bb && !tree_is_type(vertex, DEF_VARIABLE) && get_bb_next(graph, vertex, 2))
            continue;
        
        printf("    %s_%d_%d [label=<<table border=\"0\">\n", name, graph_sequence, i);
        printf("<tr><td>%d. ", i);
        vertex_printer(vertex, data);
        printf("</td></tr>\n");
        
        if (combine_bb && !tree_is_type(vertex, DEF_VARIABLE))
        {
            NODE *next_vertex = get_bb_next(graph, vertex, 1);
            while (next_vertex)
            {
                vertex = next_vertex;
                int pos = (int) get_from_hash(graph->labels, vertex, sizeof(void *));
                printf("<tr><td>%d. ", pos);
                vertex_printer(vertex, data);
                printf("</td></tr>\n");
                next_vertex = get_bb_next(graph, vertex, 1);
            }
        }
        
        printf("</table>>");
        if (tree_is_type(vertex, DEF_VARIABLE))
        {
            DECLARATION *decl = CAST_TO_DECLARATION(vertex);
            printf(", fillcolor=%s", get_colour(decl->colour));
        }
        printf("];\n");
        
        HASH_ENTRY *he;
        NODE *from = vertex;
        
        he = find_in_hash(graph->forward, from, sizeof(void *));
        if (he)
        {
            HASH *subhash = he->data;
            HASH_ITERATOR iter;
            for (hash_iterator(subhash, &iter); hash_iterator_valid(&iter); hash_iterator_next(&iter))
            {
                NODE *to = iter.entry->key;
                HASH_ENTRY *he2 = find_in_hash(graph->labels, to, sizeof(void *));
                if (he2)
                {
                    EDGE_TYPE type = (EDGE_TYPE) iter.entry->data;
                    if (type == EDGE_SYMMETRICAL)
                        continue;
                    printf("    %s_%d_%d -> %s_%d_%d [label=<", name, graph_sequence, i, name, graph_sequence, (int) he2->data);
                    if (type & EDGE_YES)
                        printf("Y");
                    if (type & EDGE_NO)
                        printf("N");
                    if (type & EDGE_BACK)
                        printf("B");
                    if (type & EDGE_LOOP)
                        printf("L");
                    edge_printer(from, to, data);
                    printf(">];\n");
                }
            }
        }
    }
    printf("}\n");
}
Ejemplo n.º 17
0
const SDL_Color& label::set_colour(const SDL_Color& colour)
{
	colour_ = colour;
	set_dirty();
	return get_colour();
}