Exemplo n.º 1
0
static void
_gtk_css_image_win32_class_init (GtkCssImageWin32Class *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  object_class->finalize = gtk_css_image_win32_finalize;

  image_class->snapshot = gtk_css_image_win32_snapshot;
  image_class->parse = gtk_css_image_win32_parse;
  image_class->print = gtk_css_image_win32_print;
}
Exemplo n.º 2
0
static void
_gtk_css_image_gradient_class_init (GtkCssImageGradientClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->compute = gtk_css_image_gradient_compute;
  image_class->draw = gtk_css_image_gradient_draw;
  image_class->parse = gtk_css_image_gradient_parse;
  image_class->print = gtk_css_image_gradient_print;

  object_class->dispose = gtk_css_image_gradient_dispose;
}
Exemplo n.º 3
0
static void
_gtk_css_image_surface_class_init (GtkCssImageSurfaceClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->get_width = gtk_css_image_surface_get_width;
  image_class->get_height = gtk_css_image_surface_get_height;
  image_class->draw = gtk_css_image_surface_draw;
  image_class->print = gtk_css_image_surface_print;

  object_class->dispose = gtk_css_image_surface_dispose;
}
Exemplo n.º 4
0
static void
gtk_css_image_builtin_class_init (GtkCssImageBuiltinClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->draw = gtk_css_image_builtin_real_draw;
  image_class->parse = gtk_css_image_builtin_parse;
  image_class->print = gtk_css_image_builtin_print;
  image_class->compute = gtk_css_image_builtin_compute;
  image_class->equal = gtk_css_image_builtin_equal;

  object_class->dispose = gtk_css_image_builtin_dispose;
}
Exemplo n.º 5
0
static void
_gtk_css_image_icon_theme_class_init (GtkCssImageIconThemeClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->get_aspect_ratio = gtk_css_image_icon_theme_get_aspect_ratio;
  image_class->draw = gtk_css_image_icon_theme_draw;
  image_class->parse = gtk_css_image_icon_theme_parse;
  image_class->print = gtk_css_image_icon_theme_print;
  image_class->compute = gtk_css_image_icon_theme_compute;
  image_class->equal = gtk_css_image_icon_theme_equal;

  object_class->dispose = gtk_css_image_icon_theme_dispose;
}
Exemplo n.º 6
0
static void
_gtk_css_image_radial_class_init (GtkCssImageRadialClass *klass)
{
    GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
    GObjectClass *object_class = G_OBJECT_CLASS (klass);

    image_class->draw = gtk_css_image_radial_draw;
    image_class->parse = gtk_css_image_radial_parse;
    image_class->print = gtk_css_image_radial_print;
    image_class->compute = gtk_css_image_radial_compute;
    image_class->transition = gtk_css_image_radial_transition;
    image_class->equal = gtk_css_image_radial_equal;

    object_class->dispose = gtk_css_image_radial_dispose;
}
Exemplo n.º 7
0
static void
_gtk_css_image_linear_class_init (GtkCssImageLinearClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->snapshot = gtk_css_image_linear_snapshot;
  image_class->parse = gtk_css_image_linear_parse;
  image_class->print = gtk_css_image_linear_print;
  image_class->compute = gtk_css_image_linear_compute;
  image_class->equal = gtk_css_image_linear_equal;
  image_class->transition = gtk_css_image_linear_transition;

  object_class->dispose = gtk_css_image_linear_dispose;
}
Exemplo n.º 8
0
static void
_gtk_css_image_cross_fade_class_init (GtkCssImageCrossFadeClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->get_width = gtk_css_image_cross_fade_get_width;
  image_class->get_height = gtk_css_image_cross_fade_get_height;
  image_class->equal = gtk_css_image_cross_fade_equal;
  image_class->draw = gtk_css_image_cross_fade_draw;
  image_class->parse = gtk_css_image_cross_fade_parse;
  image_class->print = gtk_css_image_cross_fade_print;

  object_class->dispose = gtk_css_image_cross_fade_dispose;
}
Exemplo n.º 9
0
static GtkCssImage *
gtk_css_image_gradient_transition (GtkCssImage *start_image,
                                   GtkCssImage *end_image,
                                   guint        property_id,
                                   double       progress)
{
  GtkGradient *start_gradient, *end_gradient, *gradient;
  cairo_pattern_t *start_pattern, *end_pattern;
  GtkCssImageGradient *result;

  start_gradient = GTK_CSS_IMAGE_GRADIENT (start_image)->gradient;
  start_pattern = GTK_CSS_IMAGE_GRADIENT (start_image)->pattern;
  if (end_image == NULL)
    {
      end_gradient = NULL;
      end_pattern = NULL;
    }
  else
    {
      if (!GTK_IS_CSS_IMAGE_GRADIENT (end_image))
        return GTK_CSS_IMAGE_CLASS (_gtk_css_image_gradient_parent_class)->transition (start_image, end_image, property_id, progress);

      end_gradient = GTK_CSS_IMAGE_GRADIENT (end_image)->gradient;
      end_pattern = GTK_CSS_IMAGE_GRADIENT (end_image)->pattern;
    }

  gradient = _gtk_gradient_transition (start_gradient, end_gradient, property_id, progress);
  if (gradient == NULL)
    return GTK_CSS_IMAGE_CLASS (_gtk_css_image_gradient_parent_class)->transition (start_image, end_image, property_id, progress);

  result = g_object_new (GTK_TYPE_CSS_IMAGE_GRADIENT, NULL);
  result->gradient = gradient;
  result->pattern = transition_pattern (start_pattern, end_pattern, progress);

  return GTK_CSS_IMAGE (result);
}
Exemplo n.º 10
0
static void
_gtk_css_image_url_class_init (GtkCssImageUrlClass *klass)
{
  GtkCssImageClass *image_class = GTK_CSS_IMAGE_CLASS (klass);
  GObjectClass *object_class = G_OBJECT_CLASS (klass);

  image_class->get_width = gtk_css_image_url_get_width;
  image_class->get_height = gtk_css_image_url_get_height;
  image_class->get_aspect_ratio = gtk_css_image_url_get_aspect_ratio;
  image_class->compute = gtk_css_image_url_compute;
  image_class->draw = gtk_css_image_url_draw;
  image_class->parse = gtk_css_image_url_parse;
  image_class->print = gtk_css_image_url_print;

  object_class->dispose = gtk_css_image_url_dispose;
}
Exemplo n.º 11
0
static GtkCssImage *
gtk_css_image_radial_transition (GtkCssImage *start_image,
                                 GtkCssImage *end_image,
                                 guint        property_id,
                                 double       progress)
{
    GtkCssImageRadial *start, *end, *result;
    guint i;

    start = GTK_CSS_IMAGE_RADIAL (start_image);

    if (end_image == NULL)
        return GTK_CSS_IMAGE_CLASS (_gtk_css_image_radial_parent_class)->transition (start_image, end_image, property_id, progress);

    if (!GTK_IS_CSS_IMAGE_RADIAL (end_image))
        return GTK_CSS_IMAGE_CLASS (_gtk_css_image_radial_parent_class)->transition (start_image, end_image, property_id, progress);

    end = GTK_CSS_IMAGE_RADIAL (end_image);

    if (start->repeating != end->repeating ||
            start->stops->len != end->stops->len ||
            start->size != end->size ||
            start->circle != end->circle)
        return GTK_CSS_IMAGE_CLASS (_gtk_css_image_radial_parent_class)->transition (start_image, end_image, property_id, progress);

    result = g_object_new (GTK_TYPE_CSS_IMAGE_RADIAL, NULL);
    result->repeating = start->repeating;
    result->circle = start->circle;
    result->size = start->size;

    result->position = _gtk_css_value_transition (start->position, end->position, property_id, progress);
    if (result->position == NULL)
        goto fail;

    if (start->sizes[0] && end->sizes[0])
    {
        result->sizes[0] = _gtk_css_value_transition (start->sizes[0], end->sizes[0], property_id, progress);
        if (result->sizes[0] == NULL)
            goto fail;
    }
    else
        result->sizes[0] = 0;

    if (start->sizes[1] && end->sizes[1])
    {
        result->sizes[1] = _gtk_css_value_transition (start->sizes[1], end->sizes[1], property_id, progress);
        if (result->sizes[1] == NULL)
            goto fail;
    }
    else
        result->sizes[1] = 0;

    for (i = 0; i < start->stops->len; i++)
    {
        GtkCssImageRadialColorStop stop, *start_stop, *end_stop;

        start_stop = &g_array_index (start->stops, GtkCssImageRadialColorStop, i);
        end_stop = &g_array_index (end->stops, GtkCssImageRadialColorStop, i);

        if ((start_stop->offset != NULL) != (end_stop->offset != NULL))
            goto fail;

        if (start_stop->offset == NULL)
        {
            stop.offset = NULL;
        }
        else
        {
            stop.offset = _gtk_css_value_transition (start_stop->offset,
                          end_stop->offset,
                          property_id,
                          progress);
            if (stop.offset == NULL)
                goto fail;
        }

        stop.color = _gtk_css_value_transition (start_stop->color,
                                                end_stop->color,
                                                property_id,
                                                progress);
        if (stop.color == NULL)
        {
            if (stop.offset)
                _gtk_css_value_unref (stop.offset);
            goto fail;
        }

        g_array_append_val (result->stops, stop);
    }

    return GTK_CSS_IMAGE (result);

fail:
    g_object_unref (result);
    return GTK_CSS_IMAGE_CLASS (_gtk_css_image_radial_parent_class)->transition (start_image, end_image, property_id, progress);
}
Exemplo n.º 12
0
static GtkCssImage *
gtk_css_image_linear_transition (GtkCssImage *start_image,
                                 GtkCssImage *end_image,
                                 guint        property_id,
                                 double       progress)
{
  GtkCssImageLinear *start, *end, *result;
  guint i;

  start = GTK_CSS_IMAGE_LINEAR (start_image);

  if (end_image == NULL)
    return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress);

  if (!GTK_IS_CSS_IMAGE_LINEAR (end_image))
    return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress);

  end = GTK_CSS_IMAGE_LINEAR (end_image);

  if ((start->repeating != end->repeating)
      || (start->stops->len != end->stops->len))
    return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress);

  result = g_object_new (GTK_TYPE_CSS_IMAGE_LINEAR, NULL);
  result->repeating = start->repeating;

  if (start->side != end->side)
    goto fail;

  result->side = start->side;
  if (result->side == 0)
    result->angle = _gtk_css_value_transition (start->angle, end->angle, property_id, progress);
  if (result->angle == NULL)
    goto fail;
  
  for (i = 0; i < start->stops->len; i++)
    {
      GtkCssImageLinearColorStop stop, *start_stop, *end_stop;

      start_stop = &g_array_index (start->stops, GtkCssImageLinearColorStop, i);
      end_stop = &g_array_index (end->stops, GtkCssImageLinearColorStop, i);

      if ((start_stop->offset != NULL) != (end_stop->offset != NULL))
        goto fail;

      if (start_stop->offset == NULL)
        {
          stop.offset = NULL;
        }
      else
        {
          stop.offset = _gtk_css_value_transition (start_stop->offset,
                                                   end_stop->offset,
                                                   property_id,
                                                   progress);
          if (stop.offset == NULL)
            goto fail;
        }

      stop.color = _gtk_css_value_transition (start_stop->color,
                                              end_stop->color,
                                              property_id,
                                              progress);
      if (stop.color == NULL)
        {
          if (stop.offset)
            _gtk_css_value_unref (stop.offset);
          goto fail;
        }

      g_array_append_val (result->stops, stop);
    }

  return GTK_CSS_IMAGE (result);

fail:
  g_object_unref (result);
  return GTK_CSS_IMAGE_CLASS (_gtk_css_image_linear_parent_class)->transition (start_image, end_image, property_id, progress);
}