summaryrefslogtreecommitdiffstats
path: root/libmenu/menu.c
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-30 02:52:54 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-03-30 02:52:54 +0000
commit9c301c3e16546f00e9230abfbe36a45793bd9389 (patch)
tree6a9d061f301f41be8a36c1329543bc283d1f8b92 /libmenu/menu.c
parent22e18ebe856009ba68761c24fae14a166b7f0fe5 (diff)
downloadmpv-9c301c3e16546f00e9230abfbe36a45793bd9389.tar.bz2
mpv-9c301c3e16546f00e9230abfbe36a45793bd9389.tar.xz
Add a function to draw flat boxes and use it to make the list
menu and console look much cooler. Idea take from Otvos Atilla's patches (oattila_At_chello--.--hu). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17994 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmenu/menu.c')
-rw-r--r--libmenu/menu.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libmenu/menu.c b/libmenu/menu.c
index e45e16ec28..e0ef965e24 100644
--- a/libmenu/menu.c
+++ b/libmenu/menu.c
@@ -559,3 +559,31 @@ char* menu_text_get_next_line(char* txt, int max_width) {
}
return txt;
}
+
+
+void menu_draw_box(mp_image_t* mpi, char grey, char alpha, int x, int y, int w, int h) {
+ draw_alpha_f draw_alpha = get_draw_alpha(mpi->imgfmt);
+
+ if(!draw_alpha) {
+ printf("Unsupported outformat !!!!\n");
+ return;
+ }
+
+ if(x > mpi->w || y > mpi->h) return;
+
+ if(x < 0) w += x, x = 0;
+ if(x+w > mpi->w) w = mpi->w-x;
+ if(y < 0) h += y, y = 0;
+ if(y+h > mpi->h) h = mpi->h-y;
+
+ {
+ int stride = (w+7)&(~7); // round to 8
+ char pic[stride*h],pic_alpha[stride*h];
+ memset(pic,grey,stride*h);
+ memset(pic_alpha,alpha,stride*h);
+ draw_alpha(w,h,pic,pic_alpha,stride,
+ mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3),
+ mpi->stride[0]);
+ }
+
+}