Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2007-10-24 12:45:23 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-10-24 12:45:23 +0400
commit05768a38e571b413e069ef5bea2a989c39a1d549 (patch)
treea7d55608a40ec543d26f1645d5dcec96aabfe6ad /source/blender/blenkernel/intern/image.c
parent94dfb616a933280cb92f98e0665c97ac6a6223ca (diff)
==Image Stamp - Patch by GSR==
When using non opaque background, some overlap lines appear due to filling some pixel lines twice. Before it did not matter as only opaque bg was allowed, and it even compacted the text a bit. The fix spreads a bit the lines to overcome the issue. As a plus no text should touch the top edge ever (slashes did, for example). Compare: http://www.infernal-iceberg.com/blender/stamp-alpha-overlap.png http://www.infernal-iceberg.com/blender/stamp-alpha-cleanup.png
Diffstat (limited to 'source/blender/blenkernel/intern/image.c')
-rw-r--r--source/blender/blenkernel/intern/image.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index 56fd15cedb1..ea086481bac 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -819,18 +819,20 @@ void BKE_stamp(struct ImBuf *ibuf)
}
font_height = BMF_GetFontHeight(font);
+ /* All texts get halfspace+1 pixel on each side and 1 pix
+ above and below as padding against their backing rectangles */
text_pad = BMF_GetStringWidth(font, " ");
IMB_imginfo_change_field (ibuf, "File", G.sce);
if (G.scene->r.stamp & R_STAMP_DRAW) {
/* Top left corner */
- x = 1; /* Inits for everyone */
- y = ibuf->y - font_height; /* Also inits for everyone */
+ x = 1; /* Inits for everyone, text position, so 1 for padding, not 0 */
+ y = ibuf->y - font_height - 1; /* Also inits for everyone, notice padding pixel */
sprintf(text, "File %s", G.sce);
text_width = BMF_GetStringWidth(font, text);
IMB_rectfill_area(ibuf, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
BMF_DrawStringBuf(font, text, x+(text_pad/2), y, G.scene->r.fg_stamp, (unsigned char *)ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y);
- y -= font_height+1;
+ y -= font_height+2; /* Top and bottom 1 pix padding each */
}
if (G.scene->r.stamp & R_STAMP_NOTE) {
@@ -841,7 +843,7 @@ void BKE_stamp(struct ImBuf *ibuf)
text_width = BMF_GetStringWidth(font, G.scene->r.stamp_udata);
IMB_rectfill_area(ibuf, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
BMF_DrawStringBuf(font, G.scene->r.stamp_udata, x+(text_pad/2), y, G.scene->r.fg_stamp, (unsigned char *)ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y);
- y -= font_height+1;
+ y -= font_height+2; /* Top and bottom 1 pix padding each */
}
}
@@ -877,7 +879,7 @@ void BKE_stamp(struct ImBuf *ibuf)
if (G.scene->r.stamp & R_STAMP_DRAW) {
/* Bottom left corner, leaving space for timing */
x = 1;
- y = font_height+1;
+ y = font_height+2+1; /* 2 for padding in TIME|FRAME fields below and 1 for padding in this one */
sprintf (text, "Marker %s", infotext);
text_width = BMF_GetStringWidth(font, text);
IMB_rectfill_area(ibuf, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
@@ -915,7 +917,7 @@ void BKE_stamp(struct ImBuf *ibuf)
text_width = BMF_GetStringWidth(font, text);
IMB_rectfill_area(ibuf, G.scene->r.bg_stamp, x-1, y-1, x+text_width+text_pad+1, y+font_height+1);
BMF_DrawStringBuf(font, text, x+(text_pad/2), y, G.scene->r.fg_stamp, (unsigned char *)ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y);
- x += text_width+text_pad;
+ x += text_width+text_pad+2; /* Both sides have 1 pix additional padding each */
}
}