diff options
Diffstat (limited to 'src/yuv_draw.cc')
-rw-r--r-- | src/yuv_draw.cc | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/yuv_draw.cc b/src/yuv_draw.cc index a444fa7..bb8b23f 100644 --- a/src/yuv_draw.cc +++ b/src/yuv_draw.cc @@ -143,7 +143,42 @@ void YUVDraw::draw() } } +static QImage *loadIcon( char *name, int height ) +{ + QImage scaled; + QImage *img; + + img = new QImage(); + img->load( name ); + + int h = height; + int w = (int)((float)img->width() / (float)(img->height() / (float)h)); + scaled = img->smoothScale(w, h); + delete img; + img = new QImage(scaled); + + return img; +} +#include "mainwindow.h" +void YUVDraw::mute(bool muted) +{ + int xoffset = 0; + int yoffset = 0; + int width = 48; + int height = 48; + + QImage *img = loadIcon(PIXMAP_UNMUTE, height); + + // Swicth the bool and draw an mute/unmute symbol + for(int x = 0; x < width; x++) { + for(int y = 0; y < height; y++) { + unsigned char color = qGray(img->pixel(x, y)); + if(!qAlpha(img->pixel(x, y))) color = 0; + addPixel(x + xoffset, y + yoffset, color); + } + } +} |