Esempio n. 1
0
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    size_t i = 0;
    cairo_operator_t op;
    cairo_t *bgcr, *fgcr;
    cairo_surface_t *bg, *fg;

    bg = cairo_surface_create_similar (cairo_get_target (cr), 
	    CAIRO_CONTENT_COLOR_ALPHA, SIZE * STEPS, SIZE * STEPS);
    fg = cairo_surface_create_similar (cairo_get_target (cr), 
	    CAIRO_CONTENT_COLOR_ALPHA, SIZE * STEPS, SIZE * STEPS);
    bgcr = cairo_create (bg);
    fgcr = cairo_create (fg);
    cairo_scale (bgcr, SIZE, SIZE);
    cairo_scale (fgcr, SIZE, SIZE);
    create_patterns (bgcr, fgcr);
    cairo_destroy (bgcr);
    cairo_destroy (fgcr);

    for (op = START_OPERATOR; op <= STOP_OPERATOR; op++, i++) {
	cairo_save (cr);
	cairo_translate (cr, 
		SIZE * (STEPS + 1) * (i % COUNT),
		SIZE * (STEPS + 1) * (i / COUNT));
	do_blend (cr, op, bg, fg);
	cairo_restore (cr);
    }

    cairo_surface_destroy (fg);
    cairo_surface_destroy (bg);

    return CAIRO_TEST_SUCCESS;
}
Esempio n. 2
0
static void
subdraw (cairo_t *cr, int width, int height)
{
    size_t i = 0;
    cairo_operator_t op;
    cairo_t *bgcr, *fgcr;
    cairo_surface_t *bg, *fg;

    bg = cairo_surface_create_similar (cairo_get_target (cr),
	    CAIRO_CONTENT_COLOR_ALPHA, SIZE * STEPS, SIZE * STEPS);
    fg = cairo_surface_create_similar (cairo_get_target (cr),
	    CAIRO_CONTENT_COLOR_ALPHA, SIZE * STEPS, SIZE * STEPS);
    bgcr = cairo_create (bg);
    fgcr = cairo_create (fg);
    cairo_scale (bgcr, SIZE, SIZE);
    cairo_scale (fgcr, SIZE, SIZE);
    create_patterns (bgcr, fgcr);
    cairo_destroy (bgcr);
    cairo_destroy (fgcr);

    for (op = START_OPERATOR; op <= STOP_OPERATOR; op++, i++) {
	cairo_save (cr);
	cairo_translate (cr,
		SIZE * (STEPS + 1) * (i % COUNT),
		SIZE * (STEPS + 1) * (i / COUNT));
	cairo_rectangle (cr, 0, 0, SIZE * (STEPS + 1), SIZE * (STEPS+1));
	cairo_clip (cr);
	do_composite (cr, op, bg, fg);
	cairo_restore (cr);
    }

    cairo_surface_destroy (fg);
    cairo_surface_destroy (bg);
}
Esempio n. 3
0
static
void *exec(void *arg)
{
  ws_state_list *p = (ws_state_list *) arg;
  EventRecord event;

  create_window(p);

  init_norm_xform();
  init_colors();
  create_patterns();

  p->run = 1;
  while (p->run)
    {
      pthread_mutex_lock(&p->mutex);
      while (EventAvail(everyEvent, &event))
	{
	  GetNextEvent(everyEvent, &event);
	  if (event.what == kHighLevelEvent)
	    AEProcessAppleEvent(&event);
	}
      pthread_mutex_unlock(&p->mutex);
      usleep(10000);
    }
  DisposeWindow(p->win);

  pthread_exit(0);

  return 0;
}
Esempio n. 4
0
gboolean index_recursively(const char *indexer,
                           struct catalog *catalog,
                           int source_id,
                           handle_file_f callback,
                           gpointer userdata,
                           GError **err)
{
        char *path = NULL;
        gboolean retval = FALSE;


        if(catalog_get_source_attribute_witherrors(indexer,
                        source_id,
                        "path",
                        &path,
                        TRUE/*required*/,
                        err))
        {
                char *depth_str = NULL;
                if(catalog_get_source_attribute_witherrors(indexer,
                                source_id,
                                "depth",
                                &depth_str,
                                FALSE/*not required*/,
                                err)) {
                        char *ignore = NULL;
                        int depth = -1;
                        if(depth_str) {
                                depth=atoi(depth_str);
                                g_free(depth_str);
                        }
                        if(catalog_get_source_attribute_witherrors(indexer,
                                        source_id,
                                        "ignore",
                                        &ignore,
                                        FALSE/*not required*/,
                                        err)) {
                                GPatternSpec **ignore_patterns = create_patterns(ignore);
                                retval=recurse(catalog,
                                               path,
                                               ignore_patterns,
                                               depth,
                                               FALSE/*not slow*/,
                                               source_id,
                                               callback,
                                               userdata,
                                               err);
                                free_patterns(ignore_patterns);
                        }
                }
                g_free(path);
        }
        return retval;
}
void main(int argc,char **argv)
{
FILE *fp;

  printf( "\nNetwork Generator for n-Component Kohonen Networks\n" );
  control_file=argv[1];
  if(argc==2)               
    if((fp=fopen(control_file,"r"))!=NULL){
       control(fp);  /* get information from control file */
       if ((IUnits <= 0) || (OUnits < 0) || (HUnits <= 0))
	 exit( 1 );
       create_network(weight_file);
       create_patterns(pattern_file,no_of_exemplars); /* if any */
       quit();
     }
    else
      printf("\nControl file %s could not be opened!",argv[1]);
else
  printf("\nUsage: convert2snns <control file>");
  printf("\n");

} /* main */
Esempio n. 6
0
static void catalog_index_init()
{
        if(!DEFAULT_IGNORE)
                DEFAULT_IGNORE=create_patterns(DEFAULT_IGNORE_STRINGS);
}