本文整理汇总了C++中cogl_texture_get_width函数的典型用法代码示例。如果您正苦于以下问题:C++ cogl_texture_get_width函数的具体用法?C++ cogl_texture_get_width怎么用?C++ cogl_texture_get_width使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cogl_texture_get_width函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: texture_tower_revalidate_fbo
static void
texture_tower_revalidate_fbo (MetaTextureTower *tower,
int level)
{
CoglTexture *source_texture = tower->textures[level - 1];
int source_texture_width = cogl_texture_get_width (source_texture);
int source_texture_height = cogl_texture_get_height (source_texture);
CoglTexture *dest_texture = tower->textures[level];
int dest_texture_width = cogl_texture_get_width (dest_texture);
int dest_texture_height = cogl_texture_get_height (dest_texture);
Box *invalid = &tower->invalid[level];
CoglFramebuffer *fb;
CoglError *catch_error = NULL;
CoglPipeline *pipeline;
if (tower->fbos[level] == NULL)
tower->fbos[level] = cogl_offscreen_new_with_texture (dest_texture);
fb = COGL_FRAMEBUFFER (tower->fbos[level]);
if (!cogl_framebuffer_allocate (fb, &catch_error))
{
cogl_error_free (catch_error);
return;
}
cogl_framebuffer_orthographic (fb, 0, 0, dest_texture_width, dest_texture_height, -1., 1.);
if (!tower->pipeline_template)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
tower->pipeline_template = cogl_pipeline_new (ctx);
cogl_pipeline_set_blend (tower->pipeline_template, "RGBA = ADD (SRC_COLOR, 0)", NULL);
}
pipeline = cogl_pipeline_copy (tower->pipeline_template);
cogl_pipeline_set_layer_texture (pipeline, 0, tower->textures[level - 1]);
cogl_framebuffer_draw_textured_rectangle (fb, pipeline,
invalid->x1, invalid->y1,
invalid->x2, invalid->y2,
(2. * invalid->x1) / source_texture_width,
(2. * invalid->y1) / source_texture_height,
(2. * invalid->x2) / source_texture_width,
(2. * invalid->y2) / source_texture_height);
cogl_object_unref (pipeline);
}
开发者ID:darkxst,项目名称:mtest,代码行数:49,代码来源:meta-texture-tower.c
示例2: rb_cogl_texture_get_width
static VALUE
rb_cogl_texture_get_width (VALUE self)
{
CoglHandle tex = rb_cogl_texture_get_handle (self);
return UINT2NUM (cogl_texture_get_width (tex));
}
开发者ID:orospakr,项目名称:rbclutter,代码行数:7,代码来源:rbcogltexture.c
示例3: pp_super_aa_paint
static void
pp_super_aa_paint (ClutterActor *actor)
{
CoglHandle texture;
gfloat width, height;
PPSuperAAPrivate *priv = PP_SUPER_AA (actor)->priv;
clutter_actor_get_size (actor, &width, &height);
texture = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (actor));
if (!texture ||
(cogl_texture_get_width (texture) != (guint)(width * priv->x_res)) ||
(cogl_texture_get_height (texture) != (guint)(height * priv->y_res)))
{
texture = cogl_texture_new_with_size ((guint)(width * priv->x_res),
(guint)(height * priv->y_res),
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
clutter_texture_set_cogl_texture (CLUTTER_TEXTURE (actor), texture);
cogl_handle_unref (texture);
}
CLUTTER_ACTOR_CLASS (pp_super_aa_parent_class)->paint (actor);
}
开发者ID:GNOME,项目名称:pinpoint,代码行数:25,代码来源:pp-super-aa.c
示例4: _cogl_sub_texture_map_quad
static void
_cogl_sub_texture_map_quad (CoglSubTexture *sub_tex,
float *coords)
{
CoglTexture *tex = COGL_TEXTURE (sub_tex);
/* NB: coords[] always come in as normalized coordinates but may go
* out as non-normalized if sub_tex->full_texture is a
* CoglTextureRectangle.
*
* NB: sub_tex->sub_x/y/width/height are in non-normalized
* coordinates.
*/
if (cogl_is_texture_rectangle (sub_tex->full_texture))
{
coords[0] = coords[0] * tex->width + sub_tex->sub_x;
coords[1] = coords[1] * tex->height + sub_tex->sub_y;
coords[2] = coords[2] * tex->width + sub_tex->sub_x;
coords[3] = coords[3] * tex->height + sub_tex->sub_y;
}
else
{
float width = cogl_texture_get_width (sub_tex->full_texture);
float height = cogl_texture_get_height (sub_tex->full_texture);
coords[0] = (coords[0] * tex->width + sub_tex->sub_x) / width;
coords[1] = (coords[1] * tex->height + sub_tex->sub_y) / height;
coords[2] = (coords[2] * tex->width + sub_tex->sub_x) / width;
coords[3] = (coords[3] * tex->height + sub_tex->sub_y) / height;
}
}
开发者ID:rib,项目名称:cogl,代码行数:31,代码来源:cogl-sub-texture.c
示例5: _st_create_shadow_material
CoglHandle
_st_create_shadow_material (StShadow *shadow_spec,
CoglHandle src_texture)
{
static CoglHandle shadow_material_template = COGL_INVALID_HANDLE;
CoglHandle material;
CoglHandle texture;
guchar *pixels_in, *pixels_out;
gint width_in, height_in, rowstride_in;
gint width_out, height_out, rowstride_out;
g_return_val_if_fail (shadow_spec != NULL, COGL_INVALID_HANDLE);
g_return_val_if_fail (src_texture != COGL_INVALID_HANDLE,
COGL_INVALID_HANDLE);
width_in = cogl_texture_get_width (src_texture);
height_in = cogl_texture_get_height (src_texture);
rowstride_in = (width_in + 3) & ~3;
pixels_in = g_malloc0 (rowstride_in * height_in);
cogl_texture_get_data (src_texture, COGL_PIXEL_FORMAT_A_8,
rowstride_in, pixels_in);
pixels_out = blur_pixels (pixels_in, width_in, height_in, rowstride_in,
shadow_spec->blur,
&width_out, &height_out, &rowstride_out);
g_free (pixels_in);
texture = cogl_texture_new_from_data (width_out,
height_out,
COGL_TEXTURE_NONE,
COGL_PIXEL_FORMAT_A_8,
COGL_PIXEL_FORMAT_A_8,
rowstride_out,
pixels_out);
g_free (pixels_out);
if (G_UNLIKELY (shadow_material_template == COGL_INVALID_HANDLE))
{
shadow_material_template = cogl_material_new ();
/* We set up the material to blend the shadow texture with the combine
* constant, but defer setting the latter until painting, so that we can
* take the actor's overall opacity into account. */
cogl_material_set_layer_combine (shadow_material_template, 0,
"RGBA = MODULATE (CONSTANT, TEXTURE[A])",
NULL);
}
material = cogl_material_copy (shadow_material_template);
cogl_material_set_layer (material, 0, texture);
cogl_handle_unref (texture);
return material;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:60,代码来源:st-private.c
示例6: cogl_pango_glyph_cache_update_position_cb
static void
cogl_pango_glyph_cache_update_position_cb (void *user_data,
CoglTexture *new_texture,
const CoglRectangleMapEntry *rect)
{
CoglPangoGlyphCacheValue *value = user_data;
float tex_width, tex_height;
if (value->texture)
cogl_object_unref (value->texture);
value->texture = cogl_object_ref (new_texture);
tex_width = cogl_texture_get_width (new_texture);
tex_height = cogl_texture_get_height (new_texture);
value->tx1 = rect->x / tex_width;
value->ty1 = rect->y / tex_height;
value->tx2 = (rect->x + value->draw_width) / tex_width;
value->ty2 = (rect->y + value->draw_height) / tex_height;
value->tx_pixel = rect->x;
value->ty_pixel = rect->y;
/* The glyph has changed position so it will need to be redrawn */
value->dirty = TRUE;
}
开发者ID:ChrisCummins,项目名称:cogl,代码行数:26,代码来源:cogl-pango-glyph-cache.c
示例7: _cogl_sub_texture_unmap_quad
static void
_cogl_sub_texture_unmap_quad (CoglSubTexture *sub_tex,
float *coords)
{
CoglTexture *tex = COGL_TEXTURE (sub_tex);
/* NB: coords[] come in as non-normalized if sub_tex->full_texture
* is a CoglTextureRectangle otherwhise they are normalized. The
* coordinates we write out though must always be normalized.
*
* NB: sub_tex->sub_x/y/width/height are in non-normalized
* coordinates.
*/
if (cogl_is_texture_rectangle (sub_tex->full_texture))
{
coords[0] = (coords[0] - sub_tex->sub_x) / tex->width;
coords[1] = (coords[1] - sub_tex->sub_y) / tex->height;
coords[2] = (coords[2] - sub_tex->sub_x) / tex->width;
coords[3] = (coords[3] - sub_tex->sub_y) / tex->height;
}
else
{
float width = cogl_texture_get_width (sub_tex->full_texture);
float height = cogl_texture_get_height (sub_tex->full_texture);
coords[0] = (coords[0] * width - sub_tex->sub_x) / tex->width;
coords[1] = (coords[1] * height - sub_tex->sub_y) / tex->height;
coords[2] = (coords[2] * width - sub_tex->sub_x) / tex->width;
coords[3] = (coords[3] * height - sub_tex->sub_y) / tex->height;
}
}
开发者ID:rib,项目名称:cogl,代码行数:30,代码来源:cogl-sub-texture.c
示例8: shell_grid_desaturate_effect_paint_target
static void
shell_grid_desaturate_effect_paint_target (ClutterOffscreenEffect *effect)
{
ShellGridDesaturateEffect *self = SHELL_GRID_DESATURATE_EFFECT (effect);
ClutterActor *actor;
CoglHandle texture;
guint8 paint_opacity;
texture = clutter_offscreen_effect_get_texture (effect);
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (effect));
paint_opacity = clutter_actor_get_paint_opacity (actor);
cogl_pipeline_set_color4ub (self->pipeline,
paint_opacity,
paint_opacity,
paint_opacity,
paint_opacity);
cogl_push_source (self->pipeline);
cogl_rectangle (0, 0,
cogl_texture_get_width (texture),
cogl_texture_get_height (texture));
cogl_pop_source ();
}
开发者ID:xxl007,项目名称:eos-desktop,代码行数:27,代码来源:shell-grid-desaturate-effect.c
示例9: mx_toggle_get_preferred_width
static void
mx_toggle_get_preferred_width (ClutterActor *actor,
gfloat for_height,
gfloat *min_width_p,
gfloat *pref_width_p)
{
CoglHandle background;
gfloat pref_w;
background = mx_widget_get_background_texture (MX_WIDGET (actor));
if (!background)
{
if (min_width_p)
*min_width_p = 0;
if (pref_width_p)
*pref_width_p = 0;
return;
}
pref_w = cogl_texture_get_width (background);
if (min_width_p)
*min_width_p = pref_w;
if (pref_width_p)
*pref_width_p = pref_w;
}
开发者ID:ManMower,项目名称:mx,代码行数:29,代码来源:mx-toggle.c
示例10: update_unshaded_uniform
static void
update_unshaded_uniform (ShellGridDesaturateEffect *self)
{
float values[4] = { 0., 0., 0., 0.};
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (self);
CoglHandle texture;
float width, height;
if (self->unshaded_uniform == -1)
return;
texture = clutter_offscreen_effect_get_texture (offscreen_effect);
if (texture == COGL_INVALID_HANDLE)
goto out;
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
values[0] = MIN (1.0, self->unshaded_rect->origin.x / width);
values[1] = MIN (1.0, self->unshaded_rect->origin.y / height);
values[2] = MIN (1.0, (self->unshaded_rect->origin.x + self->unshaded_rect->size.width) / width);
values[3] = MIN (1.0, (self->unshaded_rect->origin.y + self->unshaded_rect->size.height) / height);
self->unshaded_uniform_dirty = FALSE;
out:
cogl_pipeline_set_uniform_float (self->pipeline,
self->unshaded_uniform,
4, 1,
values);
}
开发者ID:xxl007,项目名称:eos-desktop,代码行数:31,代码来源:shell-grid-desaturate-effect.c
示例11: set_texture
static void
set_texture (MetaScreenBackground *background,
CoglHandle texture)
{
MetaDisplay *display = meta_screen_get_display (background->screen);
GSList *l;
/* This may trigger destruction of an old texture pixmap, which, if
* the underlying X pixmap is already gone has the tendency to trigger
* X errors inside DRI. For safety, trap errors */
meta_error_trap_push (display);
if (background->texture != COGL_INVALID_HANDLE)
{
cogl_handle_unref (background->texture);
background->texture = COGL_INVALID_HANDLE;
}
meta_error_trap_pop (display);
if (texture != COGL_INVALID_HANDLE)
background->texture = cogl_handle_ref (texture);
background->texture_width = cogl_texture_get_width (background->texture);
background->texture_height = cogl_texture_get_height (background->texture);
for (l = background->actors; l; l = l->next)
set_texture_on_actor (l->data);
update_wrap_mode (background);
}
开发者ID:nbourdau,项目名称:muffin,代码行数:29,代码来源:meta-background-actor.c
示例12: aisleriot_card_get_preferred_width
static void
aisleriot_card_get_preferred_width (ClutterActor *self,
ClutterUnit for_height,
ClutterUnit *min_width_p,
ClutterUnit *natural_width_p)
{
AisleriotCard *card = AISLERIOT_CARD (self);
AisleriotCardPrivate *priv = card->priv;
CoglHandle tex;
guint width;
tex = games_card_textures_cache_get_card_texture (priv->cache,
priv->top_card);
if (G_UNLIKELY (tex == COGL_INVALID_HANDLE))
width = 0;
else
width = cogl_texture_get_width (tex);
if (min_width_p)
*min_width_p = 0;
if (natural_width_p)
*natural_width_p = CLUTTER_UNITS_FROM_DEVICE (width);
}
开发者ID:guillaumebel,项目名称:nibbles-clutter,代码行数:25,代码来源:card.c
示例13: recorder_fetch_cursor_image
static void
recorder_fetch_cursor_image (ShellRecorder *recorder)
{
CoglTexture *texture;
int width, height;
int stride;
guint8 *data;
texture = meta_cursor_tracker_get_sprite (recorder->cursor_tracker);
if (!texture)
return;
width = cogl_texture_get_width (texture);
height = cogl_texture_get_height (texture);
stride = 4 * width;
data = g_new (guint8, stride * height);
cogl_texture_get_data (texture, CLUTTER_CAIRO_FORMAT_ARGB32, stride, data);
/* FIXME: cairo-gl? */
recorder->cursor_image = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
width, height,
stride);
recorder->cursor_memory = data;
}
开发者ID:kenvandine,项目名称:gnome-shell,代码行数:25,代码来源:shell-recorder.c
示例14: _st_create_shadow_pipeline
CoglPipeline *
_st_create_shadow_pipeline (StShadow *shadow_spec,
CoglTexture *src_texture)
{
ClutterBackend *backend = clutter_get_default_backend ();
CoglContext *ctx = clutter_backend_get_cogl_context (backend);
static CoglPipeline *shadow_pipeline_template = NULL;
CoglPipeline *pipeline;
CoglTexture *texture;
guchar *pixels_in, *pixels_out;
gint width_in, height_in, rowstride_in;
gint width_out, height_out, rowstride_out;
g_return_val_if_fail (shadow_spec != NULL, NULL);
g_return_val_if_fail (src_texture != NULL, NULL);
width_in = cogl_texture_get_width (src_texture);
height_in = cogl_texture_get_height (src_texture);
rowstride_in = (width_in + 3) & ~3;
pixels_in = g_malloc0 (rowstride_in * height_in);
cogl_texture_get_data (src_texture, COGL_PIXEL_FORMAT_A_8,
rowstride_in, pixels_in);
pixels_out = blur_pixels (pixels_in, width_in, height_in, rowstride_in,
shadow_spec->blur,
&width_out, &height_out, &rowstride_out);
g_free (pixels_in);
texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width_out, height_out,
COGL_PIXEL_FORMAT_A_8,
rowstride_out,
pixels_out,
NULL));
g_free (pixels_out);
if (G_UNLIKELY (shadow_pipeline_template == NULL))
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
shadow_pipeline_template = cogl_pipeline_new (ctx);
/* We set up the pipeline to blend the shadow texture with the combine
* constant, but defer setting the latter until painting, so that we can
* take the actor's overall opacity into account. */
cogl_pipeline_set_layer_combine (shadow_pipeline_template, 0,
"RGBA = MODULATE (CONSTANT, TEXTURE[A])",
NULL);
}
pipeline = cogl_pipeline_copy (shadow_pipeline_template);
cogl_pipeline_set_layer_texture (pipeline, 0, texture);
cogl_object_unref (texture);
return pipeline;
}
开发者ID:meetparikh7,项目名称:gnome-shell,代码行数:60,代码来源:st-private.c
示例15: aisleriot_slot_renderer_paint_card
static void
aisleriot_slot_renderer_paint_card (AisleriotSlotRenderer *srend,
guint card_num)
{
AisleriotSlotRendererPrivate *priv = srend->priv;
Card card = CARD (priv->slot->cards->data[card_num]);
CoglHandle cogl_tex;
guint tex_width, tex_height;
int cardx, cardy;
cogl_tex = ar_card_textures_cache_get_card_texture (priv->cache, card);
if (G_UNLIKELY (cogl_tex == COGL_INVALID_HANDLE))
return;
tex_width = cogl_texture_get_width (cogl_tex);
tex_height = cogl_texture_get_height (cogl_tex);
aisleriot_game_get_card_offset (priv->slot, card_num,
FALSE,
&cardx, &cardy);
aisleriot_slot_renderer_set_material_for_card
(srend, cogl_tex,
priv->show_highlight && card_num >= priv->highlight_start);
cogl_rectangle (cardx, cardy, cardx + tex_width, cardy + tex_height);
}
开发者ID:mfrasca,项目名称:aisleriot,代码行数:27,代码来源:slot-renderer.c
示例16: st_background_effect_set_property
static void
st_background_effect_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
StBackgroundEffect *self = ST_BACKGROUND_EFFECT (gobject);
switch (prop_id)
{
case PROP_BUMPMAP:
self->bumpmap_location = g_value_dup_string (value);
if (self->bg_bumpmap != NULL)
{
cogl_handle_unref (self->bg_bumpmap);
self->bg_bumpmap = NULL;
}
if (self->bumpmap_location == NULL)
{
break;
}
GFile *file = g_file_new_for_path (g_strdup (self->bumpmap_location));
if (g_file_query_exists (file, NULL))
{
self->bg_bumpmap = cogl_texture_new_from_file (self->bumpmap_location,
COGL_TEXTURE_NO_SLICING,
COGL_PIXEL_FORMAT_RGBA_8888_PRE,
NULL);
}
g_object_unref (file);
if (self->bg_bumpmap != NULL)
{
self->bumptex_width_i = cogl_texture_get_width (self->bg_bumpmap);
self->bumptex_height_i = cogl_texture_get_height (self->bg_bumpmap);
cogl_pipeline_set_layer_texture (self->pipeline0, 1, self->bg_bumpmap);
}
else
{
cogl_pipeline_set_layer_null_texture (self->pipeline0,
1,
COGL_TEXTURE_TYPE_2D);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
开发者ID:branton,项目名称:Cinnamon,代码行数:57,代码来源:st-background-effect.c
示例17: mx_tooltip_allocate
static void
mx_tooltip_allocate (ClutterActor *self,
const ClutterActorBox *box,
ClutterAllocationFlags flags)
{
MxTooltipPrivate *priv = MX_TOOLTIP (self)->priv;
ClutterActorBox child_box;
gfloat arrow_height, arrow_width;
CoglHandle arrow_image;
MxPadding padding;
CLUTTER_ACTOR_CLASS (mx_tooltip_parent_class)->allocate (self,
box,
flags);
mx_widget_get_padding (MX_WIDGET (self), &padding);
arrow_image = mx_widget_get_background_texture (MX_WIDGET (self));
if (arrow_image && !priv->actor_below)
{
arrow_height = cogl_texture_get_height (arrow_image);
arrow_width = cogl_texture_get_width (arrow_image);
priv->arrow_box.x1 = (float)(priv->arrow_offset) - (int)(arrow_width / 2);
priv->arrow_box.y1 = 0;
priv->arrow_box.x2 = priv->arrow_box.x1 + arrow_width;
priv->arrow_box.y2 = arrow_height;
}
else
{
arrow_height = 0;
arrow_width = 0;
}
child_box.x1 = child_box.y1 = 0;
child_box.x2 = (box->x2 - box->x1);
child_box.y2 = (box->y2 - box->y1);
/* remove the space that is used by the arrow */
child_box.y1 += arrow_height;
priv->text_allocation = child_box;
if (priv->label)
{
/* now remove the padding */
child_box.y1 += padding.top;
child_box.x1 += padding.left;
child_box.x2 -= padding.right;
child_box.y2 -= padding.bottom;
clutter_actor_allocate (priv->label, &child_box, flags);
}
}
开发者ID:3v1n0,项目名称:mx,代码行数:55,代码来源:mx-tooltip.c
示例18: penge_magic_texture_paint
static void
penge_magic_texture_paint (ClutterActor *actor)
{
ClutterActorBox box;
CoglHandle *material, *tex;
float bw, bh;
float aw, ah;
float v;
float tx1, tx2, ty1, ty2;
guint8 alpha;
clutter_actor_get_allocation_box (actor, &box);
material = clutter_texture_get_cogl_material (CLUTTER_TEXTURE (actor));
tex = clutter_texture_get_cogl_texture (CLUTTER_TEXTURE (actor));
bw = (float) cogl_texture_get_width (tex); /* base texture width */
bh = (float) cogl_texture_get_height (tex); /* base texture height */
aw = (float) (box.x2 - box.x1); /* allocation width */
ah = (float) (box.y2 - box.y1); /* allocation height */
/* no comment */
if ((float)bw/bh < (float)aw/ah)
{
/* fit width */
v = (((float)ah * bw) / ((float)aw * bh)) / 2;
tx1 = 0;
tx2 = 1;
ty1 = (0.5 - v);
ty2 = (0.5 + v);
} else {
/* fit height */
v = (((float)aw * bh) / ((float)ah * bw)) / 2;
tx1 = (0.5 - v);
tx2 = (0.5 + v);
ty1 = 0;
ty2 = 1;
}
alpha = clutter_actor_get_paint_opacity (actor);
cogl_material_set_color4ub (material,
alpha,
alpha,
alpha,
alpha);
cogl_set_source (material);
cogl_rectangle_with_texture_coords (0, 0,
aw, ah,
tx1, ty1,
tx2, ty2);
}
开发者ID:dudochkin-victor,项目名称:gogoo-panel-myzone,代码行数:53,代码来源:penge-magic-texture.c
示例19: clutter_image_paint_content
static void
clutter_image_paint_content (ClutterContent *content,
ClutterActor *actor,
ClutterPaintNode *root)
{
ClutterImagePrivate *priv = CLUTTER_IMAGE (content)->priv;
ClutterScalingFilter min_f, mag_f;
ClutterContentRepeat repeat;
ClutterPaintNode *node;
ClutterActorBox box;
ClutterColor color;
guint8 paint_opacity;
if (priv->texture == NULL)
return;
clutter_actor_get_content_box (actor, &box);
paint_opacity = clutter_actor_get_paint_opacity (actor);
clutter_actor_get_content_scaling_filters (actor, &min_f, &mag_f);
repeat = clutter_actor_get_content_repeat (actor);
/* ClutterTextureNode will premultiply the blend color, so we
* want it to be white with the paint opacity
*/
color.red = 255;
color.green = 255;
color.blue = 255;
color.alpha = paint_opacity;
node = clutter_texture_node_new (priv->texture, &color, min_f, mag_f);
clutter_paint_node_set_name (node, "Image");
if (repeat == CLUTTER_REPEAT_NONE)
clutter_paint_node_add_rectangle (node, &box);
else
{
float t_w = 1.f, t_h = 1.f;
if ((repeat & CLUTTER_REPEAT_X_AXIS) != FALSE)
t_w = (box.x2 - box.x1) / cogl_texture_get_width (priv->texture);
if ((repeat & CLUTTER_REPEAT_Y_AXIS) != FALSE)
t_h = (box.y2 - box.y1) / cogl_texture_get_height (priv->texture);
clutter_paint_node_add_texture_rectangle (node, &box,
0.f, 0.f,
t_w, t_h);
}
clutter_paint_node_add_child (root, node);
clutter_paint_node_unref (node);
}
开发者ID:ebassi,项目名称:clutter,代码行数:52,代码来源:clutter-image.c
示例20: meta_texture_tower_set_base_texture
/**
* meta_texture_tower_set_base_texture:
* @tower: a #MetaTextureTower
* @texture: the new texture used as a base for scaled down versions
*
* Sets the base texture that is the scaled texture that the
* scaled textures of the tower are derived from. The texture itself
* will be used as level 0 of the tower and will be referenced until
* unset or until the tower is freed.
*/
void
meta_texture_tower_set_base_texture (MetaTextureTower *tower,
CoglTexture *texture)
{
int i;
g_return_if_fail (tower != NULL);
if (texture == tower->textures[0])
return;
if (tower->textures[0] != NULL)
{
for (i = 1; i < tower->n_levels; i++)
{
if (tower->textures[i] != NULL)
{
cogl_object_unref (tower->textures[i]);
tower->textures[i] = NULL;
}
if (tower->fbos[i] != NULL)
{
cogl_object_unref (tower->fbos[i]);
tower->fbos[i] = NULL;
}
}
cogl_object_unref (tower->textures[0]);
}
tower->textures[0] = texture;
if (tower->textures[0] != NULL)
{
int width, height;
cogl_object_ref (tower->textures[0]);
width = cogl_texture_get_width (tower->textures[0]);
height = cogl_texture_get_height (tower->textures[0]);
tower->n_levels = 1 + MAX ((int)(M_LOG2E * log (width)), (int)(M_LOG2E * log (height)));
tower->n_levels = MIN(tower->n_levels, MAX_TEXTURE_LEVELS);
meta_texture_tower_update_area (tower, 0, 0, width, height);
}
else
{
tower->n_levels = 0;
}
}
开发者ID:darkxst,项目名称:mtest,代码行数:62,代码来源:meta-texture-tower.c
注:本文中的cogl_texture_get_width函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论