コード例 #1
0
ファイル: warp.c プロジェクト: AjayRamanathan/gegl
static gdouble
get_stamp_force (GeglChantO *o,
                 gdouble     x,
                 gdouble     y)
{
  WarpPrivate  *priv = (WarpPrivate*) o->chant_data;
  gfloat        radius;

  if (!priv->lookup)
    {
      calc_lut (o);
    }

  radius = sqrt(x*x+y*y);

  if (radius < 0.5 * o->size + 1)
    {
      /* linear interpolation */
      gdouble a, ratio;
      gdouble before, after;

      a = floor (radius);
      ratio = (radius - a);

      before = priv->lookup[(gint) a];
      after = priv->lookup[(gint) a + 1];

      return ratio * before + (1.0 - ratio) * after;
    }

  return 0.0;
}
コード例 #2
0
ファイル: warp.c プロジェクト: Distrotech/gegl
static gdouble
get_stamp_force (GeglProperties *o,
                 gdouble         x,
                 gdouble         y)
{
  WarpPrivate  *priv = (WarpPrivate*) o->user_data;
  gfloat        radius;

  if (!priv->lookup)
    {
      calc_lut (o);
    }

  radius = sqrt(x*x+y*y);

  if (radius < 0.5 * o->size + 1)
    {
      /* linear interpolation */
      gint a;
      gdouble ratio;
      gdouble before, after;

      a = (gint)(radius);
      ratio = (radius - a);

      before = priv->lookup[a];
      after = priv->lookup[a + 1];

      return (1.0 - ratio) * before + ratio * after;
    }

  return 0.0;
}