103
103
$self->{_root}->{h}
106
$self->{_view}->set_pixbuf($clean_pixbuf);
107
109
if($self->{_show_help}) {
109
#we display the tip only on the current monitor
110
#if we would use the root window we would display the next
111
#right in the middle of both screens, this is pretty ugly
112
my $mon1 = $self->get_current_monitor;
114
print "Using monitor: "
117
. $mon1->width . " - "
118
. $mon1->height . "\n"
119
if $self->{_sc}->get_debug;
121
#obtain current colors and font_desc from the main window
122
my $style = $self->{_sc}->get_mainwindow->get_style;
123
#~ my $sel_bg = $style->bg('selected');
124
my $sel_bg = Gtk2::Gdk::Color->parse('#131313');
125
my $sel_tx = $style->text('selected');
126
my $font_fam = $style->font_desc->get_family;
127
my $font_size = $style->font_desc->get_size / Gtk2::Pango->scale;
129
#create cairo context und layout
130
my $surface = Cairo::ImageSurface->create( 'argb32', $self->{_root}->{w}, $self->{_root}->{h} );
131
my $cr = Cairo::Context->create($surface);
134
Gtk2::Gdk::Cairo::Context::set_source_pixbuf( $cr, $clean_pixbuf, 0, 0 );
137
my $layout = Gtk2::Pango::Cairo::create_layout($cr);
138
$layout->set_width( int( $mon1->width / 2 ) * Gtk2::Pango->scale );
139
$layout->set_alignment('left');
140
$layout->set_wrap('word');
143
my $size1 = int ($font_size * 2.0);
144
my $size2 = int ($font_size * 1.5);
145
my $size3 = int ($font_size * 1.0);
148
$d->get("Draw a rectangular area using the mouse.");
151
$d->get("To take a screenshot, press the Enter key. Press Esc to quit.");
154
$d->get("<b>shift/right-click</b> → selection dialog on/off")."\n".
155
$d->get("<b>ctrl + scrollwheel</b> → zoom in/out")."\n".
156
$d->get("<b>space</b> → zoom window on/off")."\n".
157
$d->get("<b>cursor keys</b> → move cursor")."\n".
158
$d->get("<b>cursor keys + alt</b> → move selection")."\n".
159
$d->get("<b>cursor keys + ctrl</b> → resize selection");
161
#use this one for white font-color
162
$layout->set_markup("<span font_desc=\"$font_fam $size1\" foreground=\"#FFFFFF\">$text1</span>\n<span font_desc=\"$font_fam $size2\" foreground=\"#FFFFFF\">$text2</span>\n\n<span font_desc=\"$font_fam $size3\" foreground=\"#FFFFFF\">$text3</span>");
165
$cr->set_source_rgba( $sel_bg->red / 257 / 255, $sel_bg->green / 257 / 255, $sel_bg->blue / 257 / 255, 0.85 );
167
my ( $lw, $lh ) = $layout->get_pixel_size;
169
my $w = $lw + $size1 * 2;
170
my $h = $lh + $size1 * 2;
171
my $x = int( ( $mon1->width - $w ) / 2 ) + $mon1->x;
172
my $y = int( ( $mon1->height - $h ) / 2 ) + $mon1->y;
175
$cr->move_to( $x + $r, $y );
176
$cr->line_to( $x + $w - $r, $y );
177
$cr->curve_to( $x + $w, $y, $x + $w, $y, $x + $w, $y + $r );
178
$cr->line_to( $x + $w, $y + $h - $r );
179
$cr->curve_to( $x + $w, $y + $h, $x + $w, $y + $h, $x + $w - $r, $y + $h );
180
$cr->line_to( $x + $r, $y + $h );
181
$cr->curve_to( $x, $y + $h, $x, $y + $h, $x, $y + $h - $r );
182
$cr->line_to( $x, $y + $r );
183
$cr->curve_to( $x, $y, $x, $y, $x + $r, $y );
186
$cr->move_to( $x + $size1, $y + $size1 );
188
#draw the pango layout
189
Gtk2::Pango::Cairo::show_layout( $cr, $layout );
191
#write surface to pixbuf
192
my $loader = Gtk2::Gdk::PixbufLoader->new;
193
$surface->write_to_png_stream(
195
my ( $closure, $data ) = @_;
196
$loader->write($data);
202
$self->{_view}->set_pixbuf($loader->get_pixbuf);
207
$self->{_view}->set_pixbuf($clean_pixbuf);
113
#we display the tip only on the current monitor
114
#if we would use the root window we would display the next
115
#right in the middle of both screens, this is pretty ugly
116
my $mon1 = $self->get_current_monitor;
118
print "Using monitor: "
121
. $mon1->width . " - "
122
. $mon1->height . "\n"
123
if $self->{_sc}->get_debug;
125
#obtain current colors and font_desc from the main window
126
my $style = $self->{_sc}->get_mainwindow->get_style;
127
#~ my $sel_bg = $style->bg('selected');
128
my $sel_bg = Gtk2::Gdk::Color->parse('#131313');
129
my $sel_tx = $style->text('selected');
130
my $font_fam = $style->font_desc->get_family;
131
my $font_size = $style->font_desc->get_size / Gtk2::Pango->scale;
133
#create cairo context und layout
134
my $surface = Cairo::ImageSurface->create( 'argb32', $self->{_root}->{w}, $self->{_root}->{h} );
135
my $cr = Cairo::Context->create($surface);
138
Gtk2::Gdk::Cairo::Context::set_source_pixbuf( $cr, $clean_pixbuf, 0, 0 );
141
my $layout = Gtk2::Pango::Cairo::create_layout($cr);
142
$layout->set_width( int( $mon1->width / 2 ) * Gtk2::Pango->scale );
143
$layout->set_alignment('left');
144
$layout->set_wrap('word');
147
my $size1 = int ($font_size * 2.0);
148
my $size2 = int ($font_size * 1.5);
149
my $size3 = int ($font_size * 1.0);
152
$d->get("Draw a rectangular area using the mouse.");
155
$d->get("To take a screenshot, press the Enter key. Press Esc to quit.");
158
$d->get("<b>shift/right-click</b> → selection dialog on/off")."\n".
159
$d->get("<b>ctrl + scrollwheel</b> → zoom in/out")."\n".
160
$d->get("<b>space</b> → zoom window on/off")."\n".
161
$d->get("<b>cursor keys</b> → move cursor")."\n".
162
$d->get("<b>cursor keys + alt</b> → move selection")."\n".
163
$d->get("<b>cursor keys + ctrl</b> → resize selection");
165
#use this one for white font-color
166
$layout->set_markup("<span font_desc=\"$font_fam $size1\" foreground=\"#FFFFFF\">$text1</span>\n<span font_desc=\"$font_fam $size2\" foreground=\"#FFFFFF\">$text2</span>\n\n<span font_desc=\"$font_fam $size3\" foreground=\"#FFFFFF\">$text3</span>");
169
$cr->set_source_rgba( $sel_bg->red / 257 / 255, $sel_bg->green / 257 / 255, $sel_bg->blue / 257 / 255, 0.85 );
171
my ( $lw, $lh ) = $layout->get_pixel_size;
173
my $w = $lw + $size1 * 2;
174
my $h = $lh + $size1 * 2;
175
my $x = int( ( $mon1->width - $w ) / 2 ) + $mon1->x;
176
my $y = int( ( $mon1->height - $h ) / 2 ) + $mon1->y;
179
$cr->move_to( $x + $r, $y );
180
$cr->line_to( $x + $w - $r, $y );
181
$cr->curve_to( $x + $w, $y, $x + $w, $y, $x + $w, $y + $r );
182
$cr->line_to( $x + $w, $y + $h - $r );
183
$cr->curve_to( $x + $w, $y + $h, $x + $w, $y + $h, $x + $w - $r, $y + $h );
184
$cr->line_to( $x + $r, $y + $h );
185
$cr->curve_to( $x, $y + $h, $x, $y + $h, $x, $y + $h - $r );
186
$cr->line_to( $x, $y + $r );
187
$cr->curve_to( $x, $y, $x, $y, $x + $r, $y );
190
$cr->move_to( $x + $size1, $y + $size1 );
192
#draw the pango layout
193
Gtk2::Pango::Cairo::show_layout( $cr, $layout );
195
#write surface to pixbuf
196
my $loader = Gtk2::Gdk::PixbufLoader->new;
197
$surface->write_to_png_stream(
199
my ( $closure, $data ) = @_;
200
$loader->write($data);
206
$self->{_view}->set_pixbuf($loader->get_pixbuf);
211
213
#define zoom window