diff options
author | Campbell Barton <ideasman42@gmail.com> | 2007-10-24 02:51:50 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2007-10-24 02:51:50 +0400 |
commit | 94dfb616a933280cb92f98e0665c97ac6a6223ca (patch) | |
tree | 52bb7bc228e08ef54ba069961c1ff4c1c91380f2 /source/blender/imbuf/intern/rectop.c | |
parent | 5b0a79c7c76d2ddc62ffeec48ccfaf22c5f2bf65 (diff) |
Patch by GSR #7628, I also added alpha for text background.
The list of changes (some are fixes):
- Properly horizontally centered tags in all fields (bug?).
- File area does not have trailing space and has leading "File " at
start instead (probably a bug).
- Small separation between to time related fields, space saving.
- Removed colons, for consistency and space saving again.
- Frame field is zero aligned for higher visual stability.
- Marker name shows a rarer name, "<none>" (using <> is typical for cases
in which there is nothing: <none>, <empty>, <blank>, etc).
- Top area for misc info that can be really long (file, note and render date).
- Bottom area for more constantly changing but short ones (marker, SMPTE,
frame, camera and scene).
- Only render date moves a line (when note field is not used), and frame one
moves if no SMPTE (still in same line, so no big jump), for extra visual
stability (marker is fixed, assuming most people would show frame and or
SMPTE).
- ISO 8601 date format for render date, localization independant.
Comparision images:
http://www.infernal-iceberg.com/blender/stamp-original.png
http://www.infernal-iceberg.com/blender/stamp-cleanup.png
Diffstat (limited to 'source/blender/imbuf/intern/rectop.c')
-rw-r--r-- | source/blender/imbuf/intern/rectop.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index 55cd4b9b6a1..591ab066c57 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -524,7 +524,7 @@ void IMB_rectfill(struct ImBuf *drect, float col[4]) void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, int y2) { int i, j; - + float a, ai; if ((!ibuf) || (!col)) return; @@ -538,6 +538,9 @@ void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, i if (y1>y2) SWAP(int,y1,y2); if (x1==x2 || y1==y2) return; + a = col[3]; + ai = 1-a; + if (ibuf->rect) { unsigned char *img, *pixel; unsigned char chr, chg, chb; @@ -550,9 +553,16 @@ void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, i for (j = 0; j < y2-y1; j++) { for (i = 0; i < x2-x1; i++) { pixel = img + 4 * (((y1 + j) * ibuf->x) + (x1 + i)); - pixel[0] = chr; - pixel[1] = chg; - pixel[2] = chb; + if (a == 1.0) { + pixel[0] = chr; + pixel[1] = chg; + pixel[2] = chb; + } else { + pixel[0] = (char)((chr*a) + (pixel[0]*ai)); + pixel[1] = (char)((chg*a) + (pixel[1]*ai)); + pixel[2] = (char)((chb*a) + (pixel[2]*ai)); + } + } } } @@ -563,9 +573,15 @@ void IMB_rectfill_area(struct ImBuf *ibuf, float *col, int x1, int y1, int x2, i for (j = 0; j < y2-y1; j++) { for (i = 0; i < x2-x1; i++) { pixel = img + 4 * (((y1 + j) * ibuf->x) + (x1 + i)); - pixel[0] = col[0]; - pixel[1] = col[1]; - pixel[2] = col[2]; + if (a == 1.0) { + pixel[0] = col[0]; + pixel[1] = col[1]; + pixel[2] = col[2]; + } else { + pixel[0] = (col[0]*a) + (pixel[0]*ai); + pixel[1] = (col[1]*a) + (pixel[1]*ai); + pixel[2] = (col[2]*a) + (pixel[2]*ai); + } } } } |