Created
April 15, 2013 02:11
-
-
Save ozcan/5385211 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void capture_screen() | |
{ | |
Glib::RefPtr<Gdk::Window> root_win = Gdk::Window::get_default_root_window(); | |
int width = root_win->get_width(); | |
int height = root_win->get_height(); | |
int x_orig, y_orig; | |
root_win->get_origin(x_orig, y_orig); | |
Glib::RefPtr<Gdk::Pixbuf> screenshot = Gdk::Pixbuf::create(root_win, x_orig, y_orig, width, height); | |
screenshot->save("/tmp/testshot0.png", "png"); | |
} | |
void capture_window() | |
{ | |
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default(); | |
Glib::RefPtr<Gdk::Window> active_win = screen->get_active_window(); | |
int width = active_win->get_width(); | |
int height = active_win->get_height(); | |
//int x_orig, y_orig; | |
//active_win->get_origin(x_orig, y_orig); | |
Glib::RefPtr<Gdk::Pixbuf> screenshot = Gdk::Pixbuf::create(active_win, 0, 0, width, height); | |
screenshot->save("/tmp/testshot1.png", "png"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment