Download lib/Shutter/Pixbuf/Border.pm from abr00kx/shutter: direct link, hf CLI and curl.
- Browser
- Download file 2.05 kB
-
https://huggingface.co/abr00kx/shutter/resolve/main/lib/Shutter/Pixbuf/Border.pm
- Command line
-
hf download hf://abr00kx/shutter/lib/Shutter/Pixbuf/Border.pm
-
curl -L -o Border.pm https://huggingface.co/abr00kx/shutter/resolve/main/lib/Shutter/Pixbuf/Border.pm
2.05 kB
| ################################################### | |
| # | |
| # Copyright (C) 2008-2013 Mario Kemper <mario.kemper@gmail.com> | |
| # | |
| # This file is part of Shutter. | |
| # | |
| # Shutter 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. | |
| # | |
| # Shutter 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 Shutter; if not, write to the Free Software | |
| # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| # | |
| ################################################### | |
| package Shutter::Pixbuf::Border; | |
| #modules | |
| #-------------------------------------- | |
| use utf8; | |
| use strict; | |
| use warnings; | |
| use Gtk3; | |
| #Glib | |
| use Glib qw/TRUE FALSE/; | |
| #-------------------------------------- | |
| sub new { | |
| my $class = shift; | |
| #constructor | |
| my $self = {_common => shift}; | |
| bless $self, $class; | |
| return $self; | |
| } | |
| #~ sub DESTROY { | |
| #~ my $self = shift; | |
| #~ print "$self dying at\n"; | |
| #~ } | |
| sub create_border { | |
| my $self = shift; | |
| my $pixbuf = shift; | |
| my $width = shift; | |
| my $color = shift; | |
| #create new pixbuf | |
| my $tmp_pbuf = Gtk3::Gdk::Pixbuf->new('rgb', TRUE, 8, $pixbuf->get_width + 2 * $width, $pixbuf->get_height + 2 * $width); | |
| #Create a pixel specification | |
| my $pixel = 0; | |
| $pixel += ($color->red / 257) << 24; | |
| $pixel += ($color->green / 257) << 16; | |
| $pixel += ($color->blue / 257) << 8; | |
| $pixel += 255; | |
| #fill tmp pixbuf | |
| $tmp_pbuf->fill($pixel); | |
| #copy source pixbuf to new pixbuf | |
| eval { $pixbuf->copy_area(0, 0, $pixbuf->get_width, $pixbuf->get_height, $tmp_pbuf, $width, $width); }; | |
| if ($@) { | |
| print "create border failed: $@\n" if $self->{_common}->get_debug; | |
| return $pixbuf; | |
| } | |
| return $tmp_pbuf; | |
| } | |
| 1; | |