diff options
author | Ton Roosendaal <ton@blender.org> | 2005-05-03 14:54:42 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-05-03 14:54:42 +0400 |
commit | 422b69fe1ec7f4fbce9a1adff2a3924b454a9941 (patch) | |
tree | 44dfdfe02c24e8b9f909c159d17d0277510bb42f /source/blender/src/resources.c | |
parent | cdca939c2cd4c382f2713b14bc95b7e6a9d1455f (diff) |
UI cleanup work;
Proportional edit:
- Proportional mode added to header as button/menu. Including new option
to have only connected geometry influenced.
- Added icons for proportional & proportional modes
- Make proportional edit data part of Scene, so all gets saved.
The Global flag G_PROPORTIONAL was removed
- Made sure #defines get used properly, also tweaked order for proportional
so it starts with regular 'smooth' by default.
- Use ALT+O in editmode to switch to new proportional 'connected' mode
Other UI stuff:
- in EditMode, the layer buttons get hidden... the amount of icons in
3d header grows to fast. :)
- made less ugly icons for the Manipulators. Still can be better.
- Added alpha-filter for pre-processing Icon-image, giving nicer display
of icon-antialising on dark or bright backdrops
- disabled Manipulators when in editmode, and current layers don't show
the edited data.
- Added the value used to define Normal size (editmode draw) in Scene too,
so it gets saved.
Diffstat (limited to 'source/blender/src/resources.c')
-rw-r--r-- | source/blender/src/resources.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c index 0d3e345b016..6dc656dce30 100644 --- a/source/blender/src/resources.c +++ b/source/blender/src/resources.c @@ -227,22 +227,37 @@ static void def_icon(ImBuf *bbuf, GLuint texid, BIFIconID icon, int xidx, int yi } } -/***/ +/* this only works for the hardcoded buttons image, turning the grey AA pixels to alpha, and slight off-grey to half alpha */ static void clear_transp_rect_soft(unsigned char *transp, unsigned char *rect, int w, int h, int rowstride) { - int x,y; + int x, y, val; - for (y=0; y<h; y++) { + for (y=1; y<h-1; y++) { + unsigned char *row0= &rect[(y-1)*rowstride]; unsigned char *row= &rect[y*rowstride]; - for (x=0; x<w; x++) { + unsigned char *row1= &rect[(y+1)*rowstride]; + for (x=1; x<w-1; x++) { + unsigned char *pxl0= &row0[x*4]; unsigned char *pxl= &row[x*4]; + unsigned char *pxl1= &row1[x*4]; - if (*((unsigned int*) pxl)==*((unsigned int*) transp)) { - pxl[3]= 0; - } - else if( abs(pxl[0]-transp[0])<10 && abs(pxl[1]-transp[1])<10 && abs(pxl[2]-transp[2])<10) { - pxl[3]= 40; + if(pxl[3]!=0) { + val= (abs(pxl[0]-transp[0]) + abs(pxl[1]-transp[1]) + abs(pxl[2]-transp[2]))/3; + if(val<20) { + pxl[3]= 128; + } + else if(val<60) { + // one of pixels surrounding has alpha null? + if(pxl[3-4]==0 || pxl[3+4]==0 || pxl0[3]==0 || pxl1[3]==0) { + + if(pxl[0]>val) pxl[0]-= val; else pxl[0]= 0; + if(pxl[1]>val) pxl[1]-= val; else pxl[1]= 0; + if(pxl[2]>val) pxl[2]-= val; else pxl[2]= 0; + + pxl[3]= 128; + } + } } } } @@ -282,12 +297,15 @@ void BIF_resources_init(void) transp[1]= start[1]; transp[2]= start[2]; transp[3]= start[3]; + clear_transp_rect(transp, start, 20, 21, rowstride); clear_transp_rect_soft(transp, start, 20, 21, rowstride); - + /* this sets outside of icon to zero alpha */ start= ((unsigned char*) bbuf->rect) + (y*21)*rowstride + (x*20)*4; QUATCOPY(transp, start); clear_transp_rect(transp, start, 20, 21, rowstride); + + } } |