コード例 #1
0
static void
mnb_toolbar_property_changed (MnbToolbarShadow *self,
                              GParamSpec       *param,
                              gpointer          data)
{
  MxTextureFrame *texture = MX_TEXTURE_FRAME (self);
  MnbToolbarShadowPrivate *priv = self->priv;

  priv->parent_texture =
    mx_texture_frame_get_parent_texture (texture);
  mx_texture_frame_get_border_values (texture,
                                      &priv->top,
                                      &priv->right,
                                      &priv->bottom,
                                      &priv->left);
}
コード例 #2
0
/*
 * MxWidget::paint_background vfunction implementation.
 */
static void
mpl_panel_background_paint_background (MxWidget           *self,
                                       ClutterActor       *background,
                                       const ClutterColor *color)
{
  MxPadding padding = { 0, };

  mx_widget_get_padding (self, &padding);

  /*
   * Paint any solid background colour that is not completely transparent.
   */
  if (color && color->alpha != 0)
    {
      ClutterActor *actor = CLUTTER_ACTOR (self);
      ClutterActorBox allocation = { 0, };
      ClutterColor bg_color = *color;
      gfloat w, h;

      bg_color.alpha = clutter_actor_get_paint_opacity (actor)
                       * bg_color.alpha
                       / 255;

      clutter_actor_get_allocation_box (actor, &allocation);

      w = allocation.x2 - allocation.x1;
      h = allocation.y2 - allocation.y1;

      cogl_set_source_color4ub (bg_color.red,
                                bg_color.green,
                                bg_color.blue,
                                bg_color.alpha);
      cogl_rectangle (padding.left, padding.top,
                      w - padding.left - padding.right,
                      h - padding.top - padding.bottom);
    }

  /*
   * Now paint the asset.
   */
  if (background)
    mpl_panel_background_paint_border_image (MX_TEXTURE_FRAME (background),
                                             &padding);
}