1
我已經創建了一個小的繪圖區類,現在需要在揭示事件回調期間繪製一個像素圖。但是我無法獲得任何我試圖編譯的參數。下面是代碼的相關部分...這次調用gdk_get_pixmap需要什麼?
類定義...
class set_display_drawing_area : public Gtk::DrawingArea
{
public:
set_display_drawing_area ();
virtual ~set_display_drawing_area();
protected:
virtual bool on_expose_event(GdkEventExpose* event);
private:
GdkPixmap *pixmap_ptr;
};
和暴露回調...
bool set_display_drawing_area::on_expose_event(GdkEventExpose* event)
{
Glib::RefPtr<Gdk::Window> window = get_window();
if (window)
{
Gtk::Allocation allocation = get_allocation();
const int width = allocation.get_width();
const int height = allocation.get_height();
pixmap_ptr = gdk_pixmap_new (window, // <-- What is needed here?
width,
height,
-1);
謝謝。這是做的伎倆。 – 2010-08-29 10:18:04