/**
 * clutter_rectangle_set_color:
 * @rectangle: a #ClutterRectangle
 * @color: a #ClutterColor
 *
 * Sets the color of @rectangle.
 */
void
clutter_rectangle_set_color (ClutterRectangle   *rectangle,
			     const ClutterColor *color)
{
  ClutterRectanglePrivate *priv;

  g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
  g_return_if_fail (color != NULL);

  g_object_ref (rectangle);

  priv = rectangle->priv;

  priv->color.red = color->red;
  priv->color.green = color->green;
  priv->color.blue = color->blue;
  priv->color.alpha = color->alpha;

#if 0
  /* FIXME - appears to be causing border to always get drawn */
  if (clutter_color_equal (&priv->color, &priv->border_color))
    priv->has_border = FALSE;
  else
    priv->has_border = TRUE;
#endif

  if (CLUTTER_ACTOR_IS_VISIBLE (rectangle))
    clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));

  g_object_notify (G_OBJECT (rectangle), "color");
  g_object_notify (G_OBJECT (rectangle), "has-border");
  g_object_unref (rectangle);
}
Example #2
0
void xfdashboard_stage_interface_set_background_color(XfdashboardStageInterface *self, const ClutterColor *inColor)
{
	XfdashboardStageInterfacePrivate	*priv;

	g_return_if_fail(XFDASHBOARD_IS_STAGE_INTERFACE(self));

	priv=self->priv;


	/* Set value if changed */
	if((priv->backgroundColor && !inColor) ||
		(!priv->backgroundColor && inColor) ||
		(inColor && clutter_color_equal(inColor, priv->backgroundColor)==FALSE))
	{
		/* Set value */
		if(priv->backgroundColor)
		{
			clutter_color_free(priv->backgroundColor);
			priv->backgroundColor=NULL;
		}

		if(inColor) priv->backgroundColor=clutter_color_copy(inColor);

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), XfdashboardStageInterfaceProperties[PROP_BACKGROUND_COLOR]);
	}
}
Example #3
0
/**
 * clutter_rectangle_set_border_color:
 * @rectangle: a #ClutterRectangle
 * @color: the color of the border
 *
 * Sets the color of the border used by @rectangle using @color
 *
 * Deprecated: 1.10: Use #ClutterActor and a #ClutterCanvas to draw
 *   the border with Cairo
 */
void
clutter_rectangle_set_border_color (ClutterRectangle   *rectangle,
                                    const ClutterColor *color)
{
  ClutterRectanglePrivate *priv;

  g_return_if_fail (CLUTTER_IS_RECTANGLE (rectangle));
  g_return_if_fail (color != NULL);

  priv = rectangle->priv;

  if (priv->border_color.red != color->red ||
      priv->border_color.green != color->green ||
      priv->border_color.blue != color->blue ||
      priv->border_color.alpha != color->alpha)
    {
      g_object_ref (rectangle);

      priv->border_color.red = color->red;
      priv->border_color.green = color->green;
      priv->border_color.blue = color->blue;
      priv->border_color.alpha = color->alpha;

      if (clutter_color_equal (&priv->color, &priv->border_color))
        priv->has_border = FALSE;
      else
        priv->has_border = TRUE;

      clutter_actor_queue_redraw (CLUTTER_ACTOR (rectangle));

      g_object_notify (G_OBJECT (rectangle), "border-color");
      g_object_notify (G_OBJECT (rectangle), "has-border");
      g_object_unref (rectangle);
    }
}
Example #4
0
/**
 * mx_fade_effect_set_color:
 * @effect: A #MxFadeEffect
 * @color: A #ClutterColor
 *
 * Sets the color of the fade effect. The effect will fade out towards
 * the set border to this color.
 *
 * Since: 1.2
 */
void
mx_fade_effect_set_color (MxFadeEffect       *effect,
                          const ClutterColor *color)
{
  MxFadeEffectPrivate *priv;

  g_return_if_fail (MX_IS_FADE_EFFECT (effect));

  priv = effect->priv;
  if (!clutter_color_equal (&priv->color, color))
    {
      priv->color = *color;
      priv->update_vbo = TRUE;
      g_object_notify (G_OBJECT (effect), "color");
    }
}
Example #5
0
/**
 * mash_light_set_specular:
 * @light: The #MashLight to modify
 * @specular: The new color value
 *
 * Sets the ‘specular’ color emitted by the light. The specular color
 * is used to add highlights to an object wherever the angle to the
 * light is close to the angle that the object is being viewed
 * from. For example, if you were modelling a snooker ball with a
 * bright light above it, this property will allow you add a bright
 * part where the light can directly reflect off the ball into the
 * eye. It is common to set this to a bright white value.
 */
void
mash_light_set_specular (MashLight *light, const ClutterColor *specular)
{
  MashLightPrivate *priv;

  g_return_if_fail (MASH_IS_LIGHT (light));

  priv = light->priv;

  if (!clutter_color_equal (specular,
                            &priv->light_colors + MASH_LIGHT_COLOR_SPECULAR))
    {
      priv->light_colors[MASH_LIGHT_COLOR_SPECULAR] = *specular;
      priv->dirty_uniforms |= 1 << MASH_LIGHT_COLOR_SPECULAR;
      g_object_notify (G_OBJECT (light), "specular");
    }
}
Example #6
0
/**
 * mash_light_set_diffuse:
 * @light: The #MashLight to modify
 * @diffuse: The new color value
 *
 * Sets the ‘diffuse’ color emitted by the light. The diffuse color is
 * only visible on an object if is facing the light. The orientation
 * of the object is determined per-vertex using the vertex's
 * normal. The diffuse color will be darkened depending on how
 * directly the object faces the light.
 */
void
mash_light_set_diffuse (MashLight *light, const ClutterColor *diffuse)
{
  MashLightPrivate *priv;

  g_return_if_fail (MASH_IS_LIGHT (light));

  priv = light->priv;

  if (!clutter_color_equal (diffuse,
                            &priv->light_colors + MASH_LIGHT_COLOR_DIFFUSE))
    {
      priv->light_colors[MASH_LIGHT_COLOR_DIFFUSE] = *diffuse;
      priv->dirty_uniforms |= 1 << MASH_LIGHT_COLOR_DIFFUSE;
      g_object_notify (G_OBJECT (light), "diffuse");
    }
}
Example #7
0
/**
 * mash_light_set_ambient:
 * @light: The #MashLight to modify
 * @ambient: The new color value
 *
 * Sets the ‘ambient’ color emitted by the light. If the light reaches
 * a vertex at all then the ambient color affects the vertex
 * regardless of its orientation or distance from the light. In
 * real-world lighting, even if an object isn't in a direct line of
 * sight to a light it can still be partially lit due to the fact that
 * light can bounce off other objects to reach it. The Mash lighting
 * model doesn't simulate this bouncing so the ambient color is often
 * used to give an approximation of the effect.
 */
void
mash_light_set_ambient (MashLight *light, const ClutterColor *ambient)
{
  MashLightPrivate *priv;

  g_return_if_fail (MASH_IS_LIGHT (light));

  priv = light->priv;

  if (!clutter_color_equal (ambient,
                            &priv->light_colors + MASH_LIGHT_COLOR_AMBIENT))
    {
      priv->light_colors[MASH_LIGHT_COLOR_AMBIENT] = *ambient;
      priv->dirty_uniforms |= 1 << MASH_LIGHT_COLOR_AMBIENT;
      g_object_notify (G_OBJECT (light), "ambient");
    }
}
Example #8
0
/**
 * st_shadow_equal:
 * @shadow: a #StShadow
 * @other: a different #StShadow
 *
 * Check if two shadow objects are identical. Note that two shadows may
 * compare non-identically if they differ only by floating point rounding
 * errors.
 *
 * Return value: %TRUE if the two shadows are identical
 */
gboolean
st_shadow_equal (StShadow *shadow,
                 StShadow *other)
{
  g_return_val_if_fail (shadow != NULL, FALSE);
  g_return_val_if_fail (other != NULL, FALSE);

  /* We use strict equality to compare double quantities; this means
   * that, for example, a shadow offset of 0.25in does not necessarily
   * compare equal to a shadow offset of 18pt in this test. Assume
   * that a few false negatives are mostly harmless.
   */

  return (clutter_color_equal (&shadow->color, &other->color) &&
          shadow->xoffset == other->xoffset &&
          shadow->yoffset == other->yoffset &&
          shadow->blur == other->blur &&
          shadow->spread == other->spread &&
          shadow->inset == other->inset);
}
Example #9
0
static void
sync_style_selection_color (ArStyle *style,
                            GParamSpec *pspec,
                            AisleriotSlotRenderer *srend)
{
  AisleriotSlotRendererPrivate *priv = srend->priv;
  GdkRGBA color;
  ClutterColor clutter_color;

  ar_style_get_selection_color (style, &color);
  clutter_color_from_gdk_rgba (&clutter_color, &color);

  if (clutter_color_equal (&clutter_color, &priv->highlight_color))
    return;

  priv->highlight_color = clutter_color;

  if (priv->show_highlight)
    clutter_actor_queue_redraw (CLUTTER_ACTOR (srend));
}
Example #10
0
void xfdashboard_text_box_set_hint_text_color(XfdashboardTextBox *self, const ClutterColor *inColor)
{
	XfdashboardTextBoxPrivate	*priv;

	g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self));
	g_return_if_fail(inColor);

	priv=self->priv;

	/* Set value if changed */
	if(!priv->hintTextColor || !clutter_color_equal(inColor, priv->hintTextColor))
	{
		if(priv->hintTextColor) clutter_color_free(priv->hintTextColor);
		priv->hintTextColor=clutter_color_copy(inColor);

		clutter_text_set_color(CLUTTER_TEXT(priv->actorHintLabel), priv->hintTextColor);
		clutter_actor_queue_redraw(CLUTTER_ACTOR(self));

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_HINT_TEXT_COLOR]);
	}
}
Example #11
0
void xfdashboard_text_box_set_text_color(XfdashboardTextBox *self, const ClutterColor *inColor)
{
	XfdashboardTextBoxPrivate	*priv;
	ClutterColor				selectionColor;

	g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self));
	g_return_if_fail(inColor);

	priv=self->priv;

	/* Set value if changed */
	if(!priv->textColor || !clutter_color_equal(inColor, priv->textColor))
	{
		if(priv->textColor) clutter_color_free(priv->textColor);
		priv->textColor=clutter_color_copy(inColor);

		clutter_text_set_color(CLUTTER_TEXT(priv->actorTextBox), priv->textColor);

		/* Selection text and background color is inverted text color if not set */
		if(!priv->selectionColorSet)
		{
			selectionColor.red=0xff-priv->textColor->red;
			selectionColor.green=0xff-priv->textColor->green;
			selectionColor.blue=0xff-priv->textColor->blue;
			selectionColor.alpha=priv->textColor->alpha;
			clutter_text_set_selected_text_color(CLUTTER_TEXT(priv->actorTextBox), &selectionColor);

			/* Selection color is the same as text color */
			clutter_text_set_selection_color(CLUTTER_TEXT(priv->actorTextBox), priv->textColor);
		}

		/* Redraw actor in new color */
		clutter_actor_queue_redraw(CLUTTER_ACTOR(self));

		/* Notify about property change */
		g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_TEXT_COLOR]);
	}
}
Example #12
0
void xfdashboard_text_box_set_selection_background_color(XfdashboardTextBox *self, const ClutterColor *inColor)
{
	XfdashboardTextBoxPrivate	*priv;
	ClutterColor				selectionColor;

	g_return_if_fail(XFDASHBOARD_IS_TEXT_BOX(self));

	priv=self->priv;

	/* Set value if changed */
	if(priv->selectionBackgroundColor!=inColor ||
		(priv->selectionBackgroundColor &&
			inColor &&
			!clutter_color_equal(inColor, priv->selectionBackgroundColor)))
	{
		/* Freeze notifications and collect them */
		g_object_freeze_notify(G_OBJECT(self));

		/* Release old color */
		if(priv->selectionBackgroundColor)
		{
			clutter_color_free(priv->selectionBackgroundColor);
			priv->selectionBackgroundColor=NULL;

			/* Check if any selection color is set */
			priv->selectionColorSet=((priv->selectionTextColor && priv->selectionBackgroundColor) ? TRUE : FALSE);

			/* Notify about property change */
			g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_SELECTION_BACKGROUND_COLOR]);
		}

		/* Set new color if available */
		if(inColor)
		{
			priv->selectionBackgroundColor=clutter_color_copy(inColor);
			clutter_text_set_selection_color(CLUTTER_TEXT(priv->actorTextBox), priv->selectionBackgroundColor);

			/* Any selection color was set */
			priv->selectionColorSet=TRUE;

			/* Notify about property change */
			g_object_notify_by_pspec(G_OBJECT(self), XfdashboardTextBoxProperties[PROP_SELECTION_BACKGROUND_COLOR]);
		}

		/* Selection text and background color is inverted text color if not set */
		if(!priv->selectionColorSet)
		{
			selectionColor.red=0xff-priv->textColor->red;
			selectionColor.green=0xff-priv->textColor->green;
			selectionColor.blue=0xff-priv->textColor->blue;
			selectionColor.alpha=priv->textColor->alpha;
			clutter_text_set_selected_text_color(CLUTTER_TEXT(priv->actorTextBox), &selectionColor);

			/* Selection color is the same as text color */
			clutter_text_set_selection_color(CLUTTER_TEXT(priv->actorTextBox), priv->textColor);
		}

		/* Redraw actor in new color */
		clutter_actor_queue_redraw(CLUTTER_ACTOR(self));

		/* Thaw notifications and send them now */
		g_object_thaw_notify(G_OBJECT(self));
	}
}
Example #13
0
//doc ClutterColor ==(otherColor)
IO_METHOD(IoClutterColor, equals) {
  ClutterColor other = IOCCOLOR(IoMessage_locals_clutterColorArgAt_(m, locals, 0));
  return IOBOOL(self, clutter_color_equal(&(IOCCOLOR(self)), &other));
}