Example #1
0
static int
initialize (struct filter *f, struct initdata *i)
{
    inhermisc (f, i);
    /*in/out coloring modes looks better in iter modes. This also saves some
       memory in truecolor. */
    if (f->data != NULL)
        destroypalette ((struct palette *) f->data);
    f->data = createpalette (0, 65536, i->image->bytesperpixel <= 1 ? SMALLITER : LARGEITER, 0, 65536, NULL, NULL, NULL, NULL, NULL);
    if (!inherimage (f, i, TOUCHIMAGE | NEWIMAGE, 0, 0, (struct palette *) f->data, 0, 0))
        return 0;
    return (f->previous->action->initialize (f->previous, i));
}
Example #2
0
static int
initialize (struct filter *f, struct initdata *i)
{
    struct stereogramdata *s = (struct stereogramdata *) f->data;
    inhermisc (f, i);
    if (s->savedpalette == NULL)
        s->savedpalette = clonepalette (i->image->palette);
    mkstereogrampalette (i->image->palette);
    if (!inherimage (f, i, TOUCHIMAGE, i->image->width / 2, (i->image->height) / 2, s->palette, i->image->pixelwidth * 2, i->image->pixelheight * 2))
        return 0;
    setfractalpalette (f, s->savedpalette);
    return (f->previous->action->initialize (f->previous, i));
}
Example #3
0
File: anti.c Project: Azizou/XaoS
static int initialize(struct filter *f, struct initdata *i)
{
    struct antidata *s = (struct antidata *) f->data;
    if (i->image->width * i->image->height * i->image->bytesperpixel * 2 *
	16 > 15 * 1024 * 1024) {
	s->shift = 1;
    } else {
	s->shift = 2;
    }
    inhermisc(f, i);
    if (!inherimage
	(f, i, TOUCHIMAGE | IMAGEDATA,
	 (int) (((unsigned int) i->image->width) << s->shift),
	 (int) (((unsigned int) i->image->height) << s->shift), NULL, 0,
	 0))
	return 0;
    if (i->image == NULL) {
	return 0;
    }
    return (f->previous->action->initialize(f->previous, i));
}
Example #4
0
static int
initialize (struct filter *f, struct initdata *i)
{
  struct subdata *s = (struct subdata *) f->data;
  int x;
  int val = 0;
  pixel_t **lines1, **lines2 = NULL;
  double size;
  int width, height;
  int threed = 0;
  struct filter *f1 = f;

  inhermisc (f, i);
  if (datalost (f, i))
    s->recal = 1;
  while (f1)
    {
      if (f1->action == &threed_filter)
	threed = 1;
      f1 = f1->next;
    }
  f->imageversion = i->image->version;
  if (f->childimage != NULL)
    destroy_image (f->childimage);
  s->image = f->image = i->image;
  s->image->flags |= PROTECTBUFFERS;
  s->currlines = f->image->currlines;
  s->forpversion = f->image->palette->version;
  s->forversion = f->fractalc->version;
  if (f->image->width * f->image->pixelwidth <
      f->image->height * f->image->pixelheight)
    size = f->image->width * f->image->pixelwidth / 2;
  else
    size = f->image->height * f->image->pixelheight / 2;
  width = (int) (size / f->image->pixelwidth);
  height = (int) (size / f->image->pixelheight);
  /*fractalc_resize_to(f->fractalc,size,size); */
  lines1 = (pixel_t **) malloc (sizeof (*lines1) * height);
  if (f->image->nimages == 2)
    lines2 = (pixel_t **) malloc (sizeof (*lines2) * height);
  if (lines1 == NULL)
    return 0;
  if (f->image->nimages == 2 && lines2 == NULL)
    {
      free (lines1);
      return 0;
    }
  for (x = 0; x < height; x++)
    {
      lines1[x] =
	i->image->currlines[x + (threed ? f->image->height / 3 : 0)];
      if (f->image->nimages == 2)
	lines2[x] =
	  i->image->oldlines[x + (threed ? f->image->height / 3 : 0)];
    }
  if (f->image->nimages == 2)
    for (x = 0; x < f->image->height; x++)
      {
	memcpy (f->image->oldlines[x], f->image->currlines[x],
		f->image->width * f->image->bytesperpixel);
      }
  f->childimage = i->image =
    create_image_lines (width, height, f->image->nimages, lines1, lines2,
			i->image->palette, myflip, FREELINES,
			f->image->pixelwidth, f->image->pixelheight);
  if (i->image == NULL)
    {
      free (lines1);
      free (lines2);
      return 0;
    }
  f->childimage->data = s;
  x = f->previous->action->initialize (f->previous, i);
  if (!x)
    return 0;
  if (s->second != NULL)
    {
      i->image = f->image;
      val = s->second->action->initialize (s->second, i);
      if (!val)
	return 0;
    }
  return (x | val);

}