当前位置: 首页>>代码示例>>C++>>正文


C++ clutter_actor_get_allocation_box函数代码示例

本文整理汇总了C++中clutter_actor_get_allocation_box函数的典型用法代码示例。如果您正苦于以下问题:C++ clutter_actor_get_allocation_box函数的具体用法?C++ clutter_actor_get_allocation_box怎么用?C++ clutter_actor_get_allocation_box使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了clutter_actor_get_allocation_box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mex_content_box_paint

static void
mex_content_box_paint (ClutterActor *actor)
{
  MexContentBoxPrivate *priv = MEX_CONTENT_BOX (actor)->priv;
  gboolean clipped = FALSE;

  CLUTTER_ACTOR_CLASS (mex_content_box_parent_class)->paint (actor);

  if (G_UNLIKELY (priv->clip_to_allocation))
    {
      ClutterActorBox box;
      clutter_actor_get_allocation_box (actor, &box);
      cogl_clip_push_rectangle (0, 0, box.x2 - box.x1, box.y2 - box.y1);
      clipped = TRUE;
    }

  clutter_actor_paint (priv->tile);

  if (G_UNLIKELY (priv->extras_visible))
    {
      ClutterActorBox box;

      clutter_actor_paint (priv->action_list);
      clutter_actor_paint (priv->info_panel);

      /* separator */
      cogl_set_source_color4ub (255, 255, 255, 51);
      clutter_actor_get_allocation_box (priv->info_panel, &box);
      cogl_path_line (box.x1, box.y1, box.x2, box.y1);
      cogl_path_stroke ();
    }

  if (G_UNLIKELY (clipped))
    cogl_clip_pop ();
}
开发者ID:Cyrene,项目名称:media-explorer,代码行数:35,代码来源:mex-content-box.c

示例2: clutter_clone_apply_transform

static void
clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
{
  ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
  ClutterActorBox box, source_box;
  gfloat x_scale, y_scale;

  /* First chain up and apply all the standard ClutterActor
   * transformations... */
  CLUTTER_ACTOR_CLASS (clutter_clone_parent_class)->apply_transform (self,
                                                                     matrix);

  /* if we don't have a source, nothing else to do */
  if (priv->clone_source == NULL)
    return;

  /* get our allocated size */
  clutter_actor_get_allocation_box (self, &box);

  /* and get the allocated size of the source */
  clutter_actor_get_allocation_box (priv->clone_source, &source_box);

  /* We need to scale what the clone-source actor paints to fill our own
   * allocation...
   */
  x_scale = clutter_actor_box_get_width (&box)
          / clutter_actor_box_get_width (&source_box);
  y_scale = clutter_actor_box_get_height (&box)
          / clutter_actor_box_get_height (&source_box);

  cogl_matrix_scale (matrix, x_scale, y_scale, x_scale);
}
开发者ID:ChrisCummins,项目名称:clutter,代码行数:32,代码来源:clutter-clone.c

示例3: mx_progress_bar_allocate_fill

static void
mx_progress_bar_allocate_fill (MxProgressBar         *self,
                               const ClutterActorBox *box,
                               ClutterAllocationFlags flags)
{
  ClutterActorBox box_data;
  MxProgressBarPrivate *priv = self->priv;

  if (!box)
    {
      clutter_actor_get_allocation_box (CLUTTER_ACTOR (self), &box_data);
      box = &box_data;
    }

  if (priv->progress)
    {
      ClutterActorBox child_box;
      MxPadding padding;

      mx_widget_get_padding (MX_WIDGET (self), &padding);

      child_box.x1 = padding.left;
      child_box.y1 = padding.top;
      child_box.y2 = (box->y2 - box->y1) - padding.bottom;
      child_box.x2 = ((box->x2 - box->x1 - padding.left - padding.right) *
                      priv->progress) + padding.left;

      clutter_actor_allocate (priv->fill, &child_box, flags);
    }
}
开发者ID:GunioRobot,项目名称:mx,代码行数:30,代码来源:mx-progress-bar.c

示例4: st_icon_paint

static void
st_icon_paint (ClutterActor *actor)
{
  StIconPrivate *priv = ST_ICON (actor)->priv;

  /* Chain up to paint background */
  CLUTTER_ACTOR_CLASS (st_icon_parent_class)->paint (actor);

  if (priv->icon_texture)
    {
      if (priv->shadow_material)
        {
          ClutterActorBox allocation;
          float width, height;

          clutter_actor_get_allocation_box (priv->icon_texture, &allocation);
          clutter_actor_box_get_size (&allocation, &width, &height);

          allocation.x1 = (width - priv->shadow_width) / 2;
          allocation.y1 = (height - priv->shadow_height) / 2;
          allocation.x2 = allocation.x1 + priv->shadow_width;
          allocation.y2 = allocation.y1 + priv->shadow_height;

          _st_paint_shadow_with_opacity (priv->shadow_spec,
                                         priv->shadow_material,
                                         &allocation,
                                         clutter_actor_get_paint_opacity (priv->icon_texture));
        }

      clutter_actor_paint (priv->icon_texture);
    }
}
开发者ID:Ak-,项目名称:Cinnamon,代码行数:32,代码来源:st-icon.c

示例5: glide_image_paint

static void
glide_image_paint (ClutterActor *self)
{
  GlideImage *image = GLIDE_IMAGE (self);
  GlideImagePrivate *priv = image->priv;
  ClutterActorBox box = {0, };
  gfloat t_w, t_h;
  guint8 paint_opacity = clutter_actor_get_paint_opacity (self);

  if (paint_opacity == 0)
    {
      return;
    }
  
  GLIDE_NOTE (PAINT,
	      "painting image '%s'",
	      GLIDE_ACTOR_DISPLAY_NAME (self));
  
  cogl_material_set_color4ub (priv->material, paint_opacity, paint_opacity, paint_opacity, paint_opacity);
  clutter_actor_get_allocation_box (self, &box);
  
  GLIDE_NOTE (PAINT, "paint to x1: %f, y1: %f x2: %f, y2: %f "
	      "opacity: %i",
	      box.x1, box.y1, box.x2, box.y2,
	      clutter_actor_get_opacity (self));
  
  t_w = 1.0;
  t_h = 1.0;
  
  cogl_set_source (priv->material);
  cogl_rectangle_with_texture_coords (0, 0,
				      box.x2 - box.x1, box.y2 - box.y1,
				      0, 0, t_w, t_h);
}
开发者ID:racarr,项目名称:Glide,代码行数:34,代码来源:glide-image.c

示例6: clarity_cover_set_album_item

void clarity_cover_set_album_item (ClarityCover *self, AlbumItem *item) {
    g_return_if_fail(CLARITY_IS_COVER(self));

    ClarityCoverPrivate *priv = CLARITY_COVER_GET_PRIVATE (self);
    g_return_if_fail(priv);

    GError *error = NULL;
    gint y_offset;

    if (!priv->texture) {
        priv->texture = gtk_clutter_texture_new();
        clutter_container_add_actor(CLUTTER_CONTAINER(self), priv->texture);
    }

    // Set cover artwork
    gtk_clutter_texture_set_from_pixbuf (GTK_CLUTTER_TEXTURE(priv->texture), item->albumart, &error);
    if (error) {
        g_warning("%s", error->message);
        g_error_free(error);
        return;
    }

    // Add reflection
    if (! priv->reflection) {
        y_offset = clutter_actor_get_height (priv->texture) + V_PADDING;

        priv->reflection = clutter_clone_new (priv->texture);
        clutter_actor_add_constraint (priv->reflection, clutter_bind_constraint_new (priv->texture, CLUTTER_BIND_X, 0.0));
        clutter_actor_add_constraint (priv->reflection, clutter_bind_constraint_new (priv->texture, CLUTTER_BIND_Y, y_offset));
        clutter_actor_add_constraint (priv->reflection, clutter_bind_constraint_new (priv->texture, CLUTTER_BIND_WIDTH, 0.0));
        clutter_actor_add_constraint (priv->reflection, clutter_bind_constraint_new (priv->texture, CLUTTER_BIND_HEIGHT, 0.0));
        g_signal_connect (priv->reflection,
                       "paint",
                       G_CALLBACK (_clone_paint_cb),
                       NULL);

        clutter_container_add_actor(CLUTTER_CONTAINER(self), priv->reflection);
    }

    ClutterActorBox box;
    gfloat w, h;
    clutter_actor_get_allocation_box (priv->texture, &box);
    clutter_actor_box_get_size (&box, &w, &h);

    if( h > DEFAULT_IMG_SIZE) {
        gfloat temp = w * DEFAULT_IMG_SIZE / h;
        clutter_actor_set_size(priv->texture, temp, DEFAULT_IMG_SIZE);
    }

    // Add title / artist data
    if (priv->title)
        g_free(priv->title);

    priv->title = g_strdup(item->albumname);

    if (priv->artist)
            g_free(priv->artist);

    priv->artist = g_strdup(item->artist);
}
开发者ID:Sprezzatech,项目名称:gtkpod,代码行数:60,代码来源:clarity_cover.c

示例7: actor_show_cb

static void
actor_show_cb (ClutterActor *actor, MnbInputLayer layer)
{
  ClutterActorBox  box;
  MnbInputRegion  *mir = g_object_get_qdata (G_OBJECT (actor), quark_mir);
  Display         *xdpy;

  g_assert (mgr_singleton);

  xdpy = meta_plugin_get_xdisplay (mgr_singleton->plugin);

  clutter_actor_get_allocation_box (actor, &box);

  if (!mir)
    {
      mir = mnb_input_manager_push_region (box.x1, box.y1,
                                           box.x2 - box.x1, box.y2 - box.y1,
                                           META_IS_WINDOW_ACTOR (actor), layer);

      g_object_set_qdata (G_OBJECT (actor), quark_mir, mir);
    }
  else
    {
      XRectangle    rect;

      rect.x      = box.x1;
      rect.y      = box.y1;
      rect.width  = box.x2 - box.x1;
      rect.height = box.y2 - box.y1;

      XFixesSetRegion (xdpy, mir->region, &rect, 1);

      mnb_input_manager_apply_stack ();
    }
}
开发者ID:xclaesse,项目名称:dawati-shell,代码行数:35,代码来源:mnb-input-manager.c

示例8: _xfdashboard_box_layout_allocate

/* Re-layout and allocate children of container we manage */
static void _xfdashboard_box_layout_allocate(ClutterLayoutManager *inLayoutManager,
													ClutterContainer *inContainer,
													const ClutterActorBox *inAllocation,
													ClutterAllocationFlags inFlags)
{
	ClutterTextDirection				textDirection;
	ClutterActor						*child;
	ClutterActorIter					iter;
	ClutterActorBox						childBox;
	gfloat								containerWidth;

	g_return_if_fail(XFDASHBOARD_IS_BOX_LAYOUT(inLayoutManager));
	g_return_if_fail(CLUTTER_IS_CONTAINER(inContainer));


	/* Chain up to calculate and store the allocation of children */
	CLUTTER_LAYOUT_MANAGER_CLASS(xfdashboard_box_layout_parent_class)->allocate(inLayoutManager,
																				inContainer,
																				inAllocation,
																				inFlags);

	/* Right-to-left text direction only affects horizontal orientation.
	 * If orientation is not horizontal or text direction is not right-to-left
	 * then there is nothing to do.
	 */
	if(clutter_box_layout_get_orientation(CLUTTER_BOX_LAYOUT(inLayoutManager))!=CLUTTER_ORIENTATION_HORIZONTAL)
	{
		return;
	}

	textDirection=clutter_actor_get_text_direction(CLUTTER_ACTOR(inContainer));
	if(textDirection==CLUTTER_TEXT_DIRECTION_DEFAULT) textDirection=clutter_get_default_text_direction();
	if(textDirection!=CLUTTER_TEXT_DIRECTION_RTL)
	{
		return;
	}

	/* Iterate through children and recalculate x-coordination of each
	 * children allocation by "mirroring" x-coordinate.
	 */
	containerWidth=clutter_actor_box_get_width(inAllocation);

	clutter_actor_iter_init(&iter, CLUTTER_ACTOR(inContainer));
	while(clutter_actor_iter_next(&iter, &child))
	{
		gfloat							x1, x2;

		/* Get position and size of child */
		clutter_actor_get_allocation_box(child, &childBox);

		/* Set new allocation of child */
		x1=containerWidth-childBox.x2;
		x2=containerWidth-childBox.x1;

		childBox.x1=x1;
		childBox.x2=x2;

		clutter_actor_allocate(child, &childBox, inFlags);
	}
}
开发者ID:AtheistSpacePirate,项目名称:xfdashboard,代码行数:61,代码来源:box-layout.c

示例9: key_group_paint

static void
key_group_paint (ClutterActor *actor)
{
  KeyGroup *self = KEY_GROUP (actor);
  GList *children, *l;
  gint i;

  children = clutter_container_get_children (CLUTTER_CONTAINER (self));

  for (l = children, i = 0; l != NULL; l = l->next, i++)
    {
      ClutterActor *child = l->data;

      /* paint the selection rectangle */
      if (i == self->selected_index)
        {
          ClutterActorBox box = { 0, };

          clutter_actor_get_allocation_box (child, &box);

          box.x1 -= 2;
          box.y1 -= 2;
          box.x2 += 2;
          box.y2 += 2;

          cogl_set_source_color4ub (255, 255, 0, 224);
          cogl_rectangle (box.x1, box.y1, box.x2, box.y2);
        }

      clutter_actor_paint (child);
    }

  g_list_free (children);
}
开发者ID:rib,项目名称:clutter,代码行数:34,代码来源:test-binding-pool.c

示例10: _clutter_actor_set_default_paint_volume

/*<private>
 * _clutter_actor_set_default_paint_volume:
 * @self: a #ClutterActor
 * @check_gtype: if not %G_TYPE_INVALID, match the type of @self against
 *   this type
 * @volume: the #ClutterPaintVolume to set
 *
 * Sets the default paint volume for @self.
 *
 * This function should be called by #ClutterActor sub-classes that follow
 * the default assumption that their paint volume is defined by their
 * allocation.
 *
 * If @check_gtype is not %G_TYPE_INVALID, this function will check the
 * type of @self and only compute the paint volume if the type matches;
 * this can be used to avoid computing the paint volume for sub-classes
 * of an actor class
 *
 * Return value: %TRUE if the paint volume was set, and %FALSE otherwise
 */
gboolean
_clutter_actor_set_default_paint_volume (ClutterActor       *self,
                                         GType               check_gtype,
                                         ClutterPaintVolume *volume)
{
  ClutterActorBox box;

  if (check_gtype != G_TYPE_INVALID)
    {
      if (G_OBJECT_TYPE (self) != check_gtype)
        return FALSE;
    }

  /* calling clutter_actor_get_allocation_* can potentially be very
   * expensive, as it can result in a synchronous full stage relayout
   * and redraw
   */
  if (!clutter_actor_has_allocation (self))
    return FALSE;

  clutter_actor_get_allocation_box (self, &box);

  /* we only set the width and height, as the paint volume is defined
   * to be relative to the actor's modelview, which means that the
   * allocation's origin has already been applied
   */
  clutter_paint_volume_set_width (volume, box.x2 - box.x1);
  clutter_paint_volume_set_height (volume, box.y2 - box.y1);

  return TRUE;
}
开发者ID:halfline,项目名称:mutter,代码行数:51,代码来源:clutter-paint-volume.c

示例11: clutter_box_real_paint

static void
clutter_box_real_paint (ClutterActor *actor)
{
  ClutterBoxPrivate *priv = CLUTTER_BOX (actor)->priv;

  if (priv->color_set)
    {
      ClutterActorBox box = { 0, };
      gfloat width, height;
      guint8 tmp_alpha;

      clutter_actor_get_allocation_box (actor, &box);
      clutter_actor_box_get_size (&box, &width, &height);

      tmp_alpha = clutter_actor_get_paint_opacity (actor)
                * priv->color.alpha
                / 255;

      cogl_set_source_color4ub (priv->color.red,
                                priv->color.green,
                                priv->color.blue,
                                tmp_alpha);

      cogl_rectangle (0, 0, width, height);
    }

  g_list_foreach (priv->children, (GFunc) clutter_actor_paint, NULL);
}
开发者ID:nobled,项目名称:clutter,代码行数:28,代码来源:clutter-box.c

示例12: st_icon_paint

static void
st_icon_paint (ClutterActor *actor)
{
  StIconPrivate *priv = ST_ICON (actor)->priv;

  st_widget_paint_background (ST_WIDGET (actor));

  if (priv->icon_texture)
    {
      if (priv->shadow_material)
        {
          ClutterActorBox allocation;
          float width, height;

          clutter_actor_get_allocation_box (priv->icon_texture, &allocation);
          clutter_actor_box_get_size (&allocation, &width, &height);

          _st_paint_shadow_with_opacity (priv->shadow_spec,
                                         priv->shadow_material,
                                         &allocation,
                                         clutter_actor_get_paint_opacity (priv->icon_texture));
        }

      clutter_actor_paint (priv->icon_texture);
    }
}
开发者ID:fanpenggogo,项目名称:gnome-shel,代码行数:26,代码来源:st-icon.c

示例13: _xfdashboard_viewpad_update_scrollbars

/* Allocation of a view changed */
static void _xfdashboard_viewpad_update_scrollbars(XfdashboardViewpad *self)
{
	XfdashboardViewpadPrivate	*priv;
	gfloat						w, h;

	g_return_if_fail(XFDASHBOARD_IS_VIEWPAD(self));

	priv=self->priv;

	/* Set range of scroll bar to width and height of active view
	 * But we need to check for nan-values here - I do not get rid of it :(
	 */
	if(priv->activeView) clutter_actor_get_size(CLUTTER_ACTOR(priv->activeView), &w, &h);
		else w=h=1.0f;

	xfdashboard_scrollbar_set_range(XFDASHBOARD_SCROLLBAR(priv->hScrollbar), isnan(w)==0 ? w : 0.0f);
	xfdashboard_scrollbar_set_range(XFDASHBOARD_SCROLLBAR(priv->vScrollbar), isnan(h)==0 ? h : 0.0f);

	/* If any scroll bar policy is automatic then reallocate the
	 * same allocation again in an unkindly way to force a recalculation
	 * if scroll bars needed to shown (or hidden what is unlikely)
	 */
	if(CLUTTER_ACTOR_IS_VISIBLE(self) &&
		(priv->hScrollbarPolicy==XFDASHBOARD_POLICY_AUTOMATIC ||
			priv->vScrollbarPolicy==XFDASHBOARD_POLICY_AUTOMATIC))
	{
		ClutterActorBox			box;

		clutter_actor_get_allocation_box(CLUTTER_ACTOR(self), &box);
		_xfdashboard_viewpad_allocate(CLUTTER_ACTOR(self), &box, CLUTTER_DELEGATE_LAYOUT);
	}
}
开发者ID:tydaikho,项目名称:xfdashboard,代码行数:33,代码来源:viewpad.c

示例14: mex_column_pick

static void
mex_column_pick (ClutterActor *actor, const ClutterColor *color)
{
  GList *c;
  gdouble value;
  MxPadding padding;
  ClutterActorBox box;

  MexColumn *self = MEX_COLUMN (actor);
  MexColumnPrivate *priv = self->priv;

  CLUTTER_ACTOR_CLASS (mex_column_parent_class)->pick (actor, color);

  /* Don't pick children when we don't have focus */
  if (!priv->has_focus)
    return;

  mx_widget_get_padding (MX_WIDGET (actor), &padding);
  clutter_actor_get_allocation_box (actor, &box);
  if (priv->adjustment)
    value = priv->adjustment_value;
  else
    value = 0;

  cogl_clip_push_rectangle (padding.left,
                            padding.top + value,
                            box.x2 - box.x1 - padding.right,
                            box.y2 - box.y1 - padding.bottom + value);

  for (c = priv->children; c; c = c->next)
    clutter_actor_paint (c->data);

  cogl_clip_pop ();
}
开发者ID:ocrete,项目名称:media-explorer,代码行数:34,代码来源:mex-column.c

示例15: empathy_rounded_effect_paint

static void
empathy_rounded_effect_paint (ClutterEffect *effect,
    ClutterEffectPaintFlags flags)
{
  EmpathyRoundedEffect *self = EMPATHY_ROUNDED_EFFECT (effect);
  ClutterActor *actor;
  ClutterActorBox allocation = { 0, };
  gfloat width, height;

  actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (self));
  clutter_actor_get_allocation_box (actor, &allocation);
  clutter_actor_box_get_size (&allocation, &width, &height);

  cogl_path_new ();

  /* Create and store a path describing a rounded rectangle. The small
   * size of the preview window makes the radius of the rounded corners
   * very small too, so we can safely use a very coarse angle step
   * without loosing rendering accuracy. It also significantly reduces
   * the time spent in the underlying internal cogl path functions */
  cogl_path_round_rectangle (0, 0, width, height, height / 16., 15);

  cogl_clip_push_from_path ();

  /* Flip */
  cogl_push_matrix ();
  cogl_translate (width, 0, 0);
  cogl_scale (-1, 1, 1);

  clutter_actor_continue_paint (actor);

  cogl_pop_matrix ();
  cogl_clip_pop ();
}
开发者ID:GNOME,项目名称:empathy,代码行数:34,代码来源:empathy-rounded-effect.c


注:本文中的clutter_actor_get_allocation_box函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。