本文整理汇总了C++中GDK_DRAWABLE函数的典型用法代码示例。如果您正苦于以下问题:C++ GDK_DRAWABLE函数的具体用法?C++ GDK_DRAWABLE怎么用?C++ GDK_DRAWABLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GDK_DRAWABLE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: expose_event_top_right
gboolean expose_event_top_right(GtkWidget *widget,GdkEventExpose *event, gpointer user){
static GdkGC *this_gc = NULL;
TimeLinePrivate *priv;
gint new_cursor_pos;
gint width;
gint height;
priv = (TimeLinePrivate *)user;
if(priv->top_right_evb->window == NULL || priv->display_buffer_top_right == NULL){
return TRUE;
}
if (NULL == this_gc)
{
this_gc = gdk_gc_new(GDK_DRAWABLE(priv->top_right_evb->window));
}
width = ((get_current_slide_duration() +1) * time_line_get_pixels_per_second());
height = (get_current_slide_num_layers() *priv->row_height)+10;
if(width<priv->main_table->allocation.width)
width = priv->main_table->allocation.width;
if(height<priv->main_table->allocation.height)
height = priv->main_table->allocation.height;
new_cursor_pos = round(time_line_get_cursor_position(priv->main_table->parent) * time_line_get_pixels_per_second());
time_line_internal_draw_cursor(priv->main_table->parent, new_cursor_pos);
gdk_draw_drawable(GDK_DRAWABLE(priv->top_right_evb->window), GDK_GC(this_gc),
GDK_PIXMAP(priv->display_buffer_top_right),0,0,0,0,width, priv->top_border_height);
return TRUE;
}
示例2: gdk_gl_window_new
/**
* gdk_gl_window_new:
* @glconfig: a #GdkGLConfig.
* @window: the #GdkWindow to be used as the rendering area.
* @attrib_list: (array) (allow-none): this must be set to NULL or empty (first attribute of None).
*
* Creates an on-screen rendering area.
* attrib_list is currently unused. This must be set to NULL or empty
* (first attribute of None). See GLX 1.3 spec.
*
* Return value: the new #GdkGLWindow.
**/
GdkGLWindow *
gdk_gl_window_new (GdkGLConfig *glconfig, GdkWindow *window, const int *attrib_list)
{
GDK_GL_NOTE_FUNC ();
g_return_val_if_fail (GDK_IS_GL_CONFIG (glconfig), NULL);
g_return_val_if_fail (GDK_IS_WINDOW (window), NULL);
/*
* Get X Window.
*/
Window glxwindow = GDK_DRAWABLE_XID (GDK_DRAWABLE (window));
/*
* Instantiate the GdkGLWindowImplX11 object.
*/
GdkGLWindow *glwindow = g_object_new (GDK_TYPE_GL_WINDOW, NULL);
glwindow->drawable = GDK_DRAWABLE (window);
g_object_add_weak_pointer (G_OBJECT (glwindow->drawable), (gpointer *) &(glwindow->drawable));
glwindow->glxwindow = glxwindow;
glwindow->glconfig = glconfig;
g_object_ref (G_OBJECT (glwindow->glconfig));
glwindow->is_destroyed = FALSE;
return glwindow;
}
示例3: meta_ui_get_pixbuf_from_pixmap
GdkPixbuf *
meta_ui_get_pixbuf_from_pixmap (Pixmap pmap)
{
GdkPixmap *gpmap;
GdkScreen *screen;
GdkPixbuf *pixbuf;
GdkColormap *cmap;
int width, height, depth;
gpmap = gdk_pixmap_foreign_new (pmap);
screen = gdk_drawable_get_screen (gpmap);
gdk_drawable_get_size (GDK_DRAWABLE (gpmap), &width, &height);
depth = gdk_drawable_get_depth (GDK_DRAWABLE (gpmap));
if (depth <= 24)
cmap = gdk_screen_get_rgb_colormap (screen);
else
cmap = gdk_screen_get_rgba_colormap (screen);
pixbuf = gdk_pixbuf_get_from_drawable (NULL, gpmap, cmap, 0, 0, 0, 0,
width, height);
g_object_unref (gpmap);
return pixbuf;
}
示例4: gdk_colormap_get_system
void WebBrowserObject::BrowserSnapshot(const char *fname)
{
int width, height;
char *c, *buf = 0;
GdkColormap *cmap = gdk_colormap_get_system();
gdk_drawable_get_size(GDK_DRAWABLE(mozilla->window), &width, &height);
GdkPixbuf *pix = gdk_pixbuf_get_from_drawable(0, GDK_DRAWABLE(mozilla->window), cmap, 0, 0, 0, 0, width, height);
if (pix) {
if (!fname) {
buf = strdup(location ? location : "lmboxweb");
buf = (char*)realloc(buf, strlen(buf) + 16);
fname = buf;
if ((c = strrchr(buf, '/'))) {
//fname = c + 1;
}
if ((c = strrchr(fname, '.'))) {
*c = 0;
}
strcat((char*)fname, ".png");
}
gdk_pixbuf_save (pix, fname, "png", NULL, NULL);
gdk_pixbuf_unref(pix);
printf("Webbrowser snapshot %s\n",fname);
}
gdk_colormap_unref(cmap);
lmbox_free(buf);
}
示例5: expose_callback
static gboolean
expose_callback (GtkWidget *event_box,
GdkEventButton *,
TSignalData *sigdata)
{
cairo_t *cr;
if (sigdata->event_box != NULL)
cr = gdk_cairo_create (GDK_DRAWABLE (sigdata->event_box->window));
else
{
cr = gdk_cairo_create (GDK_DRAWABLE (event_box->window));
sigdata->event_box = event_box;
}
if (sigdata->image != NULL)
{
GdkPixbuf *pxbf = gtk_image_get_pixbuf(GTK_IMAGE(sigdata->image));
gdk_cairo_set_source_pixbuf (cr, pxbf, 0,0);
cairo_paint (cr);
draw_grid(cr, sigdata->idata);
}
return TRUE;
}
示例6: gdk_wmspec_change_state
static void
gdk_wmspec_change_state (gboolean add,
GdkWindow *window,
GdkAtom state1,
GdkAtom state2)
{
GdkDisplay *display =
gdk_screen_get_display (gdk_drawable_get_screen (GDK_DRAWABLE (window)));
XEvent xev;
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
#define _NET_WM_STATE_ADD 1 /* add/set property */
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
xev.xclient.type = ClientMessage;
xev.xclient.serial = 0;
xev.xclient.send_event = True;
xev.xclient.window = GDK_WINDOW_XID (window);
xev.xclient.message_type =
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE");
xev.xclient.format = 32;
xev.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
xev.xclient.data.l[1] = gdk_x11_atom_to_xatom_for_display (display, state1);
xev.xclient.data.l[2] = gdk_x11_atom_to_xatom_for_display (display, state2);
XSendEvent (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (gdk_drawable_get_screen (GDK_DRAWABLE (window)))),
False, SubstructureRedirectMask | SubstructureNotifyMask,
&xev);
}
示例7: xfwmPixmapRenderGdkPixbuf
gboolean
xfwmPixmapRenderGdkPixbuf (xfwmPixmap * pm, GdkPixbuf *pixbuf)
{
GdkPixbuf *src;
GdkPixmap *destw;
GdkVisual *gvisual;
GdkColormap *cmap;
gint width, height;
gint dest_x, dest_y;
g_return_val_if_fail (pm != NULL, FALSE);
g_return_val_if_fail (pm->pixmap != None, FALSE);
g_return_val_if_fail (pm->mask != None, FALSE);
destw = gdk_xid_table_lookup (pm->pixmap);
if (destw)
{
g_object_ref (G_OBJECT (destw));
}
else
{
destw = gdk_pixmap_foreign_new (pm->pixmap);
}
if (!destw)
{
g_warning ("Cannot get pixmap");
return FALSE;
}
gvisual = gdk_screen_get_system_visual (pm->screen_info->gscr);
cmap = gdk_x11_colormap_foreign_new (gvisual, pm->screen_info->cmap);
if (!cmap)
{
g_warning ("Cannot create colormap");
g_object_unref (destw);
return FALSE;
}
width = MIN (gdk_pixbuf_get_width (pixbuf), pm->width);
height = MIN (gdk_pixbuf_get_height (pixbuf), pm->height);
/* Add 1 for rounding */
dest_x = (pm->width - width + 1) / 2;
dest_y = (pm->height - height + 1) / 2;
src = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE (destw), cmap,
dest_x, dest_y, 0, 0, width, height);
gdk_pixbuf_composite (pixbuf, src, 0, 0, width, height,
0, 0, 1.0, 1.0, GDK_INTERP_NEAREST, 0xFF);
gdk_draw_pixbuf (GDK_DRAWABLE (destw), NULL, src, 0, 0, dest_x, dest_y,
width, height, GDK_RGB_DITHER_NONE, 0, 0);
g_object_unref (cmap);
g_object_unref (src);
g_object_unref (destw);
return TRUE;
}
示例8: SetUpStatusBarStuff
void SetUpStatusBarStuff (GtkWidget* aWindow)
{
_String fName = baseDirectory & "GTKResources/striped.xpm";
statusBarLayout = pango_layout_new (screenPContext);
statusBarFontDesc = pango_font_description_new ();
stripedFill = gdk_pixmap_create_from_xpm (GDK_DRAWABLE(aWindow->window), NULL, NULL, fName.sData);
stripedFillGC = gdk_gc_new (GDK_DRAWABLE(aWindow->window));
if (stripedFill)
{
gdk_gc_set_fill (stripedFillGC,GDK_TILED);
gdk_gc_set_tile (stripedFillGC,stripedFill);
}
else
{
printf ("Failed to load a status bar .xpm from %s\n", fName.sData);
}
gdk_gc_set_line_attributes (stripedFillGC, 1, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
GdkColor saveFG = {0,0,0,0};
gdk_gc_set_foreground (stripedFillGC, &saveFG);
pango_font_description_set_family (statusBarFontDesc, statusBarFont.face.sData);
pango_font_description_set_style (statusBarFontDesc, (statusBarFont.style & HY_FONT_ITALIC) ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL);
pango_font_description_set_weight (statusBarFontDesc, (statusBarFont.style & HY_FONT_BOLD) ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL);
pango_font_description_set_size (statusBarFontDesc, statusBarFont.size*PANGO_SCALE);
pango_layout_set_font_description (statusBarLayout, statusBarFontDesc ); // ref ?
pango_layout_set_width (statusBarLayout, -1);
redButtonIcon = (GdkPixbuf*)ProcureIconResource(4000);
yellowButtonIcon = (GdkPixbuf*)ProcureIconResource(4001);
greenButtonIcon = (GdkPixbuf*)ProcureIconResource(4002);
orangeButtonIcon = (GdkPixbuf*)ProcureIconResource(4003);
}
示例9: time_line_internal_draw_layer_name
gboolean time_line_internal_draw_layer_name(TimeLinePrivate *priv, gint layer_number)
{
// Local variables
const GdkColor colour_black = {0, 0, 0, 0 };
static GdkColormap *colourmap = NULL; // Colourmap used for drawing
static GdkGC *display_buffer_gc = NULL;
static PangoContext *font_context = NULL;
static PangoFontDescription *font_description = NULL;
static PangoLayout *font_layout = NULL;
layer *layer_data;
GList *layer_pointer; // Points to the layers in the selected slide
GString *message = NULL;
message = g_string_new(NULL);
// Initialisation
if (NULL == colourmap)
{
colourmap = gdk_colormap_get_system();
gdk_drawable_set_colormap(GDK_DRAWABLE(priv->display_buffer_bot_left), GDK_COLORMAP(colourmap));
}
if (NULL == font_context)
{
font_context = gdk_pango_context_get();
}
if (NULL == font_layout)
{
font_layout = pango_layout_new(font_context);
}
if (NULL == display_buffer_gc)
{
display_buffer_gc = gdk_gc_new(GDK_DRAWABLE(priv->display_buffer_bot_left));
}
if (NULL == font_description)
{
font_description = pango_font_description_from_string("Sans , 15px");
pango_layout_set_font_description(font_layout, font_description);
}
// Retrieve the layer name string
layer_pointer = get_current_slide_layers_pointer();
layer_pointer = g_list_first(layer_pointer);
layer_data = g_list_nth_data(layer_pointer, layer_number);
// g_string_printf(message, "%d %s ",layer_number,layer_data->name->str);
pango_layout_set_text(font_layout, layer_data->name->str, -1);
// Set a clip mask
// clip_region.x = 0;
// clip_region.y = (layer_number <= 0)?0:(layer_number * priv->row_height);
// clip_region.width = priv->left_border_width - 1;
// clip_region.height = priv->row_height * 2;
// gdk_gc_set_clip_rectangle(GDK_GC(display_buffer_gc), &clip_region);
// Draw the text string
gdk_gc_set_rgb_fg_color(GDK_GC(display_buffer_gc), &colour_black);
gdk_draw_layout(GDK_DRAWABLE(priv->display_buffer_bot_left), GDK_GC(display_buffer_gc), 5, (layer_number * priv->row_height)+1,font_layout);
return TRUE;
}
示例10: gdk_gl_pixmap_impl_x11_make_context_current
static gboolean
gdk_gl_pixmap_impl_x11_make_context_current (GdkGLDrawable *draw,
GdkGLDrawable *read,
GdkGLContext *glcontext)
{
GdkGLConfig *glconfig;
GLXPixmap glxpixmap;
GLXContext glxcontext;
g_return_val_if_fail (GDK_IS_GL_PIXMAP_IMPL_X11 (draw), FALSE);
g_return_val_if_fail (GDK_IS_GL_CONTEXT_IMPL_X11 (glcontext), FALSE);
glconfig = GDK_GL_PIXMAP_IMPL_X11 (draw)->glconfig;
glxpixmap = GDK_GL_PIXMAP_IMPL_X11 (draw)->glxpixmap;
glxcontext = GDK_GL_CONTEXT_GLXCONTEXT (glcontext);
if (glxpixmap == None || glxcontext == NULL)
return FALSE;
#ifdef GDKGLEXT_MULTIHEAD_SUPPORT
GDK_GL_NOTE (MISC,
g_message (" -- Pixmap: screen number = %d",
GDK_SCREEN_XNUMBER (gdk_drawable_get_screen (GDK_DRAWABLE (draw)))));
#endif /* GDKGLEXT_MULTIHEAD_SUPPORT */
GDK_GL_NOTE (MISC,
g_message (" -- Pixmap: visual id = 0x%lx",
GDK_VISUAL_XVISUAL (gdk_drawable_get_visual (GDK_DRAWABLE (draw)))->visualid));
GDK_GL_NOTE_FUNC_IMPL ("glXMakeCurrent");
if (!glXMakeCurrent (GDK_GL_CONFIG_XDISPLAY (glconfig), glxpixmap, glxcontext))
{
g_warning ("glXMakeCurrent() failed");
_gdk_gl_context_set_gl_drawable (glcontext, NULL);
/* currently unused. */
/* _gdk_gl_context_set_gl_drawable_read (glcontext, NULL); */
return FALSE;
}
_gdk_gl_context_set_gl_drawable (glcontext, draw);
/* currently unused. */
/* _gdk_gl_context_set_gl_drawable_read (glcontext, read); */
if (_GDK_GL_CONFIG_AS_SINGLE_MODE (glconfig))
{
/* We do this because we are treating a double-buffered frame
buffer as a single-buffered frame buffer because the system
does not appear to export any suitable single-buffered
visuals (in which the following are necessary). */
glDrawBuffer (GL_FRONT);
glReadBuffer (GL_FRONT);
}
GDK_GL_NOTE (MISC, _gdk_gl_print_gl_info ());
return TRUE;
}
示例11: gtk_widget_get_root_window
GdkPixmap *make_pixmap(GtkScrollbox *self, gchar *value)
{
GdkWindow *rootwin;
PangoLayout *pl;
gint width, height, middle;
GdkPixmap *pixmap;
GtkRequisition widgsize = {0, };
GtkWidget *widget = (GtkWidget *)self;
/* If we can't draw yet, don't do anything to avoid screwing things */
if (!GDK_IS_GC(widget->style->bg_gc[0]))
return NULL;
rootwin = gtk_widget_get_root_window(widget);
pl = gtk_widget_create_pango_layout(widget, NULL);
pango_layout_set_markup(pl, value, -1);
pango_layout_get_pixel_size(pl, &width, &height);
pixmap = gdk_pixmap_new(GDK_DRAWABLE(rootwin), width, height, -1);
gdk_draw_rectangle(GDK_DRAWABLE(pixmap),
widget->style->bg_gc[0],
TRUE, 0, 0, width, height);
gdk_draw_layout(GDK_DRAWABLE(pixmap), widget->style->fg_gc[0], 0, 0, pl);
g_object_unref(pl);
gtk_widget_size_request(widget, &widgsize);
if (width <= widgsize.width)
width = widgsize.width;
if (height <= widgsize.height)
height = widgsize.height;
else
self->draw_maxoffset = -height;
if (width != widgsize.width || height != widgsize.height)
gtk_widget_set_size_request(widget, width, height);
middle = width / 2;
if (self->draw_maxmiddle < middle)
self->draw_maxmiddle = middle;
return pixmap;
}
示例12: debug_save_widget
void debug_save_widget(GtkWidget *widget)
{
GdkPixmap *pixmap;
GdkPixbuf *pixbuf;
gint w, h;
pixmap = gtk_widget_get_snapshot(widget, NULL);
gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &w, &h);
pixbuf = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE(pixmap),
NULL, 0, 0, 0, 0, w, h);
debug_save_pixbuf(pixbuf);
gdk_pixmap_unref(pixmap);
g_object_unref(pixbuf);
}
示例13: gtk_experiment_transcript_expose
static gboolean
gtk_experiment_transcript_expose(GtkWidget *widget, GdkEventExpose *event)
{
GtkExperimentTranscript *trans = GTK_EXPERIMENT_TRANSCRIPT(widget);
gdk_draw_drawable(GDK_DRAWABLE(gtk_widget_get_window(widget)),
widget->style->fg_gc[gtk_widget_get_state(widget)],
GDK_DRAWABLE(trans->priv->layer_text),
event->area.x, event->area.y,
event->area.x, event->area.y,
event->area.width, event->area.height);
return FALSE;
}
示例14: UI_buildui
void UI_buildui(IBusHandwriteEngine * engine)
{
GdkPixmap * pxmp;
GdkGC * gc;
GdkColor black, white;
GdkColormap* colormap = gdk_colormap_get_system();
gdk_color_black(colormap, &black);
gdk_color_white(colormap, &white);
g_object_unref(colormap);
int R = 5;
if (!engine->drawpanel)
//建立绘图窗口, 建立空点
{
engine->drawpanel = gtk_window_new(GTK_WINDOW_POPUP);
gtk_window_move((GtkWindow*) engine->drawpanel, 500, 550);
gtk_widget_add_events(GTK_WIDGET(engine->drawpanel),
GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_BUTTON_PRESS_MASK | GDK_EXPOSURE_MASK);
g_signal_connect_after(G_OBJECT(engine->drawpanel),"motion_notify_event",G_CALLBACK(on_mouse_move),engine);
g_signal_connect(G_OBJECT(engine->drawpanel),"expose-event",G_CALLBACK(paint_ui),engine);
g_signal_connect(G_OBJECT(engine->drawpanel),"button-release-event",G_CALLBACK(on_button),engine);
g_signal_connect(G_OBJECT(engine->drawpanel),"button-press-event",G_CALLBACK(on_button),engine);
gtk_window_resize(GTK_WINDOW(engine->drawpanel), 200, 250);
gtk_widget_show(engine->drawpanel);
pxmp = gdk_pixmap_new(NULL, 200, 250, 1);
gc = gdk_gc_new(GDK_DRAWABLE(pxmp));
gdk_gc_set_foreground(gc, &black);
gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, 0, 0, 200, 250);
gdk_gc_set_foreground(gc, &white);
gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 0, 0, R*2, R*2, 0, 360 * 64);
gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 200 - R*2, 0, R*2, R*2, 0, 360
* 64);
gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 200 - R*2, 250 - R*2, R*2, R*2, 0,
360 * 64);
gdk_draw_arc(GDK_DRAWABLE(pxmp), gc, 1, 0, 250 - R*2, R*2, R*2, 0, 360
* 64);
gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, 0, R, 200, 250 - R*2);
gdk_draw_rectangle(GDK_DRAWABLE(pxmp), gc, 1, R, 0, 200 - R*2, 250);
gdk_window_shape_combine_mask(engine->drawpanel->window, pxmp, 0, 0);
g_object_unref(gc);
g_object_unref(pxmp);
gtk_window_set_opacity(GTK_WINDOW(engine->drawpanel), 0.62);
// engine->GdkPoints = NULL;
}
// gtk_widget_show_all(engine->drawpanel);
}
示例15: _VisibleContents
void _HYSequencePane::_Paint (Ptr p)
{
_HYRect* destR = (_HYRect*)p;
_HYRect srcRect,
destRect = *destR;
//printf ("Sequence Paint Called %d %d %d %d\n", destR->left, destR->top, destR->right, destR->bottom);
if (HasHScroll())
destRect.bottom-= HY_SCROLLER_WIDTH;
if (HasVScroll())
destRect.right -= HY_SCROLLER_WIDTH;
//destRect.left = destR->left;
//destRect.top = destR->top;
_HYRect srcR = _VisibleContents (p);
gdk_draw_drawable (GDK_DRAWABLE(parentWindow->window), theContext, thePane, 0, 0,
parentWindow->allocation.x+destRect.left, parentWindow->allocation.y+destRect.top, destRect.Width(), destRect.Height());
long saveBorder = settings.width & HY_COMPONENT_BORDER;
settings.width -= saveBorder;
_HYPlatformComponent::_Paint(p);
settings.width += saveBorder;
}