예제 #1
0
 function __create_box()
 {
     $vbox = new GtkVBox();
     $vbox->show();
     $drawing_area = new GtkDrawingArea();
     $drawing_area->set_size_request(300, 300);
     $vbox->pack_start($drawing_area);
     //        $drawing_area->realize();
     $drawing_area->connect('expose_event', array($this, 'expose_event'));
     $drawing_area->connect('configure_event', array($this, 'configure_event'));
     $drawing_area->connect('motion_notify_event', array($this, 'motion_notify_event'));
     $drawing_area->connect('button_press_event', array($this, 'button_press_event'));
     $drawing_area->set_events(Gdk::EXPOSURE_MASK | Gdk::LEAVE_NOTIFY_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::POINTER_MOTION_MASK | Gdk::POINTER_MOTION_HINT_MASK);
     return $vbox;
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->connect('expose-event', array($this, 'expose'));
     $this->connect('button-press-event', array($this, 'button_press'));
     $this->connect('button-release-event', array($this, 'button_release'));
     $this->connect('motion-notify-event', array($this, 'motion_notify'));
     $this->add_events(Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK | Gdk::POINTER_MOTION_MASK);
     $this->update();
     Gtk::timeout_add(1000, array($this, 'update'));
 }
        $r = $radius + $radius / 3.0 * sin($f * 2.0 * pi());
        $xpos = floor($xmid + $r * cos($ang) - $iw / 2.0 + 0.5);
        $ypos = floor($ymid + $r * sin($ang) - $ih / 2.0 + 0.5);
        $k = $i & 1 ? sin($f * 2.0 * pi()) : cos($f * 2.0 * pi());
        $k = 2.0 * $k * $k;
        $k = max(0.25, $k);
        $r1 = new GdkRectangle($xpos, $ypos, $iw * $k, $ih * $k);
        $r2 = new GdkRectangle(0, 0, $back_width, $back_height);
        $dest = $r1->intersect($r2);
        $images[$i]->composite($frame, $dest->x, $dest->y, $dest->width, $dest->height, $xpos, $ypos, $k, $k, Gdk::INTERP_NEAREST, $i & 1 ? max(127, abs(255 * sin($f * 2.0 * pi()))) : max(127, abs(255 * cos($f * 2.0 * pi()))));
    }
    $da->queue_draw();
    $frame_num++;
    return true;
}
$timeout_id = 0;
//pixbuf_init ();
if (!load_pixbufs()) {
    die("main(): Could not load all the pixbufs!");
}
$frame = new GdkPixbuf(Gdk::COLORSPACE_RGB, false, 8, $back_width, $back_height);
$window = new GtkWindow(Gtk::WINDOW_TOPLEVEL);
$window->set_size_request($back_width, $back_height);
$window->set_resizable(false);
$window->connect_simple('destroy', array('gtk', 'main_quit'));
$da = new GtkDrawingArea();
$da->connect('expose_event', 'expose_cb');
$window->add($da);
Gtk::timeout_add(FRAME_DELAY, 'timeout');
$window->show_all();
Gtk::main();
예제 #4
0
    }
    return true;
}
function draw_brush($widget, $x, $y)
{
    global $pixmap;
    gdk::draw_arc($pixmap, $widget->style->black_gc, true, $x - 4, $y - 4, 8, 8, 0, 64 * 360);
    $widget->draw(new GdkRectangle($x - 4, $y - 4, 8, 8));
}
$window = new GtkWindow();
$window->set_name('Test Input');
$window->set_position(GTK_WIN_POS_CENTER);
$window->connect_object('destroy', array('gtk', 'main_quit'));
$vbox = new GtkVBox();
$window->add($vbox);
$vbox->show();
$drawing_area = new GtkDrawingArea();
$drawing_area->size(300, 300);
$vbox->pack_start($drawing_area);
$drawing_area->show();
$drawing_area->connect('expose_event', 'expose_event');
$drawing_area->connect('configure_event', 'configure_event');
$drawing_area->connect('motion_notify_event', 'motion_notify_event');
$drawing_area->connect('button_press_event', 'button_press_event');
$drawing_area->set_events(GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK);
$button = new GtkButton('Quit');
$vbox->pack_start($button, false, false);
$button->connect_object('clicked', array($window, 'destroy'));
$button->show();
$window->show();
gtk::main();