bin/gui/imgview.rb in origami-1.2.7 vs bin/gui/imgview.rb in origami-2.0.0

- old
+ new

@@ -1,72 +1,69 @@ =begin -= File - imgview.rb + This file is part of PDF Walker, a graphical PDF file browser + Copyright (C) 2016 Guillaume Delugré. -= Info - This file is part of PDF Walker, a graphical PDF file browser - Copyright (C) 2010 Guillaume Delugré <guillaume AT security-labs DOT org> - All right reserved. - - PDF Walker is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. + PDF Walker is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. - PDF Walker is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + PDF Walker is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. - You should have received a copy of the GNU General Public License - along with PDF Walker. If not, see <http://www.gnu.org/licenses/>. + You should have received a copy of the GNU General Public License + along with PDF Walker. If not, see <http://www.gnu.org/licenses/>. =end module PDFWalker - class ImgViewer < Window - attr_reader :image + class ImgViewer < Window + attr_reader :image - def initialize - super() + def initialize + super() - set_title "Image view" - set_decorated false - set_resizable false + set_title "Image view" + set_decorated false + set_resizable false - add_events(Gdk::Event::KEY_RELEASE_MASK) - signal_connect('key_release_event') { |w, event| - destroy if event.keyval == Gdk::Keyval::GDK_Escape - } - end + add_events(Gdk::Event::KEY_RELEASE_MASK) + signal_connect('key_release_event') { |w, event| + destroy if event.keyval == Gdk::Keyval::GDK_Escape + } + end - def show_raw_img(data, w, h, bpc, bpr) - set_default_size w,h + def show_raw_img(data, w, h, bpc, bpr) + set_default_size w,h - pixbuf = Gdk::Pixbuf.new data, - Gdk::Pixbuf::ColorSpace::RGB, false, bpc, - w, h, - bpr + pixbuf = GdkPixbuf::Pixbuf.new data: data, + colorspace: GdkPixbuf::Colorspace::RGB, + has_alpha: false, + bits_per_sample: bpc, + width: w, height: h, + row_stride: bpr - @image = Gtk::Image.new(pixbuf) - add @image + @image = Gtk::Image.new(pixbuf) + add @image - show_all - end + show_all + end - def show_compressed_img(data) - loader = Gdk::PixbufLoader.new - loader.last_write data + def show_compressed_img(data) + loader = Gdk::PixbufLoader.new + loader.last_write data - pixbuf = loader.pixbuf - set_default_size pixbuf.width, pixbuf.height + pixbuf = loader.pixbuf + set_default_size pixbuf.width, pixbuf.height - @image = Gtk::Image.new(pixbuf) - add @image + @image = Gtk::Image.new(pixbuf) + add @image - show_all + show_all + end end - end end