コード例 #1
0
ファイル: seed-cairo-matrix.c プロジェクト: dannote/seed
static SeedValue
seed_cairo_matrix_transform_point (SeedContext ctx,
				      SeedObject function,
				      SeedObject this_object,
				      gsize argument_count,
				      const SeedValue arguments[],
				      SeedException *exception)
{
  SeedValue ret[2];
  gdouble x, y;
  cairo_matrix_t m;

  if (argument_count != 3)
    {
      EXPECTED_EXCEPTION("transform_point", "3 arguments");
    }

  if (!seed_value_to_cairo_matrix (ctx, arguments[0], &m, exception))
    {
      seed_make_exception (ctx, exception, "ArgumentError", "transform_point needs an array [xx, yx, xy, yy, x0, y0]");
    }
  x = seed_value_to_double (ctx, arguments[1], exception);
  y = seed_value_to_double (ctx, arguments[2], exception);

  cairo_matrix_transform_point (&m, &x, &y);

  ret[0] = seed_value_from_double (ctx, x, exception);
  ret[1] = seed_value_from_double (ctx, y, exception);

  return seed_make_array (ctx, ret, 2, exception);
}
コード例 #2
0
ファイル: seed-libxml.c プロジェクト: iRi-E/GNOME-Seed
static SeedValue
seed_xml_array_from_nodeset (SeedContext ctx,
			     xmlNodeSetPtr nodeset,
			     SeedException *exception)
{
  SeedValue *ary = g_alloca (nodeset->nodeNr * sizeof (SeedValue));
  int i;

  for (i = 0; i < nodeset->nodeNr; i++)
    {
      ary[i] = seed_make_xml_node (ctx, nodeset->nodeTab[i]);
    }
  return seed_make_array (ctx, ary, nodeset->nodeNr, exception);
}
コード例 #3
0
ファイル: seed-cairo-matrix.c プロジェクト: dannote/seed
SeedValue
seed_value_from_cairo_matrix (SeedContext ctx,
			      const cairo_matrix_t *matrix,
			      SeedException *exception)
{
  SeedValue elems[6];

  elems[0] = seed_value_from_double(ctx, matrix->xx, exception);
  elems[1] = seed_value_from_double(ctx, matrix->yx, exception);
  elems[2] = seed_value_from_double(ctx, matrix->xy, exception);
  elems[3] = seed_value_from_double(ctx, matrix->yy, exception);
  elems[4] = seed_value_from_double(ctx, matrix->x0, exception);
  elems[5] = seed_value_from_double(ctx, matrix->y0, exception);

  return seed_make_array (ctx, elems, 6, exception);
}
コード例 #4
0
ファイル: seed-cairo-surface.c プロジェクト: iRi-E/GNOME-Seed
static SeedValue
seed_cairo_surface_get_fallback_resolution(SeedContext ctx,
					   SeedObject this_object,
					   SeedString property_name,
					   SeedException *exception)
{
  SeedValue offsets[2];
  cairo_surface_t *surf;
  gdouble x, y;
  CHECK_THIS();

  surf = seed_object_to_cairo_surface (ctx, this_object, exception);
  cairo_surface_get_fallback_resolution (surf, &x, &y);

  offsets[0] = seed_value_from_double (ctx, x, exception);
  offsets[1] = seed_value_from_double (ctx, y, exception);

  return seed_make_array (ctx, offsets, 2, exception);
}