Exemple #1
0
void
font::init (Glib::RefPtr<Gdk::Window> a_window)
{
    m_black_pixmap = Gdk::Pixmap::create_from_xpm
    (
        a_window->get_colormap(), m_clip_mask, font_b_xpm
    );
    m_white_pixmap = Gdk::Pixmap::create_from_xpm
    (
        a_window->get_colormap(), m_clip_mask, font_w_xpm
    );
    m_b_on_y_pixmap = Gdk::Pixmap::create_from_xpm
    (
        a_window->get_colormap(), m_clip_mask, font_y_xpm
    );
    m_y_on_b_pixmap = Gdk::Pixmap::create_from_xpm
    (
        a_window->get_colormap(), m_clip_mask, font_yb_xpm
    );
}
Exemple #2
0
Gdk::Cursor
IconController::get_tool_cursor(const Glib::ustring& name,const Glib::RefPtr<Gdk::Window>& window)
{
	//this function is never called
	//it is commented out in WorkArea::refresh_cursor()
	assert(0);
	// \todo Do we still need it?

	Glib::RefPtr<Gdk::Pixmap> pixmap;
	pixmap=Gdk::Pixmap::create(window, 64, 64, 8);
	pixmap->set_colormap(window->get_colormap());
	//pixmap->set_colormap(Gdk::Colormap::create(pixmap->get_visual(),false));
	Glib::RefPtr<Gdk::Pixbuf> pixbuf;
	pixbuf=Gtk::Button().render_icon(Gtk::StockID("synfig-"+name),Gtk::ICON_SIZE_SMALL_TOOLBAR);

	pixbuf->render_to_drawable_alpha(
		pixmap,
		0,0,	// SOURCE X,Y
		0,0,	// DEST X Y
		-1,-1,	// WIDTH HEIGHT
		Gdk::PIXBUF_ALPHA_FULL,	// (ignored)
		64,		//int alpha_threshold,
		Gdk::RGB_DITHER_MAX,		//RgbDither dither,
		2,2	//int x_dither, int y_dither
	);
/*
	pixmap->draw_pixbuf(
		Glib::RefPtr<const Gdk::GC>(0),	// GC
		pixbuf,
		0, 0, // Source X,Y
		0, 0, // Dest X,Y
		-1, -1, // Width, Height
		Gdk::RGB_DITHER_MAX, // Dither
		0,0 // Dither X,Y
	);
*/

	Gdk::Color FG("#000000");
	Gdk::Color BG("#FF00FF");

  	return Gdk::Cursor(pixmap, pixmap, FG, BG, 0, 0);
}
Exemple #3
0
OSG::ImageRecPtr takeSnapshot() {
    Gtk::DrawingArea* drawArea = 0;
    VRGuiBuilder()->get_widget("glarea", drawArea);
    Glib::RefPtr<Gdk::Drawable> src = drawArea->get_window(); // 24 bits per pixel ( src->get_depth() )
    int w = drawArea->get_width();
    int h = drawArea->get_height();
    w -= w%4; h -= h%4;
    //cout << "PIC FORMAT " << w << " " << h << " " << src->get_depth() << endl;
    Glib::RefPtr<Gdk::Image> img = Glib::wrap( gdk_drawable_get_image(src->gobj(), 0, 0, w, h) );
    Glib::RefPtr<Gdk::Pixbuf> pxb = Glib::wrap( gdk_pixbuf_get_from_image(NULL, img->gobj(), src->get_colormap()->gobj(), 0,0,0,0,w,h) );

    OSG::ImageRecPtr res = OSG::Image::create();
    //Image::set(pixFormat, width, height, depth, mipmapcount, framecount, framedelay, data, type, aloc, sidecount);
    res->set(OSG::Image::OSG_RGB_PF, w, h, 1, 0, 1, 0, (const unsigned char*)pxb->get_pixels(), OSG::Image::OSG_UINT8_IMAGEDATA, true, 1);
    return res;
}
Exemple #4
0
void
font::init (Glib::RefPtr<Gdk::Window> wp)
{
    if (m_use_new_font)
    {
        m_black_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, wenfont_b_xpm
        );
        m_white_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, wenfont_w_xpm
        );
        m_b_on_y_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, wenfont_y_xpm
        );
        m_y_on_b_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, wenfont_yb_xpm
        );
        m_b_on_c_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, cyan_wenfont_y_xpm
        );
        m_c_on_b_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, cyan_wenfont_yb_xpm
        );
    }
    else
    {
        m_black_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, font_b_xpm
        );
        m_white_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, font_w_xpm
        );
        m_b_on_y_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, font_y_xpm
        );
        m_y_on_b_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, font_yb_xpm
        );
        m_b_on_c_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, font_y_xpm
        );
        m_c_on_b_pixmap = Gdk::Pixmap::create_from_xpm
        (
            wp->get_colormap(), m_clip_mask, font_yb_xpm
        );
    }
}