Update gtk119
This commit is contained in:
parent
ce64902cc8
commit
e3bb0b1c45
|
@ -16,12 +16,14 @@ bool MyImage::on_draw(const Cairo::RefPtr<Cairo::Context> &cr){
|
||||||
int width = image->get_width();
|
int width = image->get_width();
|
||||||
int height = image->get_height();
|
int height = image->get_height();
|
||||||
|
|
||||||
|
//Set the default size for drawing area
|
||||||
set_size_request(width,height);
|
set_size_request(width,height);
|
||||||
|
|
||||||
// Draw the image in the middle of the drawing area, or (if the image is
|
// Draw the image in the middle of the drawing area, or (if the image is
|
||||||
// larger than the drawing area) draw the middle part of the image.
|
// larger than the drawing area) draw the middle part of the image.
|
||||||
Gdk::Cairo::set_source_pixbuf(cr, image,
|
Gdk::Cairo::set_source_pixbuf(cr, image,
|
||||||
(width - image->get_width())/2, (height - image->get_height())/2);
|
(width - image->get_width())/2, (height - image->get_height())/2);
|
||||||
|
|
||||||
cr->paint();
|
cr->paint();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -29,6 +31,10 @@ bool MyImage::on_draw(const Cairo::RefPtr<Cairo::Context> &cr){
|
||||||
|
|
||||||
void MyImage::set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf> &pixbuf)
|
void MyImage::set_pixbuf(const Glib::RefPtr<Gdk::Pixbuf> &pixbuf)
|
||||||
{
|
{
|
||||||
|
if(image){
|
||||||
|
image.reset();
|
||||||
|
}
|
||||||
|
|
||||||
image = pixbuf;
|
image = pixbuf;
|
||||||
|
|
||||||
//ReDraw the draw area
|
//ReDraw the draw area
|
||||||
|
|
Loading…
Reference in New Issue