V4.27 15-10-2021
- FCLT#69004 Labels pas op papercolor reageren (in plaats van contour kleur)
als alpha<128. Bij grotere alpha 'wint' contour kleuring
Label achtergrondkleur en alpha via [cff00ff,00ff00,128]
svn path=/Slnkdwf/trunk/; revision=53409
This commit is contained in:
@@ -358,8 +358,8 @@ void CSLNKContourImpl::SerializeLabel(WT_File &my_file,
|
||||
double scale,
|
||||
HDC myDC)
|
||||
{
|
||||
if (m_Color.rgba().m_rgb.a==255)
|
||||
{ // Volle achtergrond kleur
|
||||
if (m_Color.rgba().m_rgb.a >= 128)
|
||||
{ // Vrij volle achtergrond kleur
|
||||
COLORREF DCclr = RGB(m_Color.rgba().m_rgb.r,
|
||||
m_Color.rgba().m_rgb.g,
|
||||
m_Color.rgba().m_rgb.b);
|
||||
@@ -371,7 +371,9 @@ void CSLNKContourImpl::SerializeLabel(WT_File &my_file,
|
||||
my_file.desired_rendition().color() = WT_Color(1,1,1);
|
||||
}
|
||||
else
|
||||
my_file.desired_rendition().color() = WT_Color(255,255,255); //Teksten wit
|
||||
{ // Achtergrond schijnt door, reageer op die kleur
|
||||
my_file.desired_rendition().color() = WT_Color(255, 255, 255); //Teksten wit, toggled automatisch met paperColor
|
||||
}
|
||||
|
||||
CString tok(m_ShowLabel); // strtok seems to modify
|
||||
tok.Replace("~", "\n"); // We ondersteunen ook ~ als newline
|
||||
@@ -461,6 +463,12 @@ pm.serialize(my_file);
|
||||
DrawOneLabel(my_file, ptTxt, tok, l_fontheight, scale, myDC, width);
|
||||
}
|
||||
|
||||
WT_Logical_Point rotatedpoint(double angle, WT_Integer32 x, WT_Integer32 y)
|
||||
{
|
||||
return WT_Logical_Point(myRound(x * cos(angle) + y * sin(angle)),
|
||||
myRound(y * cos(angle) - x * sin(angle)));
|
||||
}
|
||||
|
||||
// Draw one (possibly multline) label
|
||||
// When width==-2 the drawing is simulated and the result
|
||||
// is the calculated bottomright of the full text
|
||||
@@ -483,6 +491,8 @@ CSize CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
|
||||
int curpos = 0;
|
||||
CString token = tok.Tokenize("\n", curpos);
|
||||
|
||||
long bkgclr; // achtergrond kleur
|
||||
long alpha = 0; // van de achtergrondkleur
|
||||
bool centering=false;
|
||||
if (width != -2)
|
||||
my_file.desired_rendition().font().rotation().set((int)(m_LabelRotation * 65536 / 360));
|
||||
@@ -538,11 +548,19 @@ CSize CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
|
||||
if (end >= 0)
|
||||
{
|
||||
long clr;
|
||||
if (sscanf_s(token, "c%lx]", &clr))
|
||||
int i = sscanf_s(token, "c%lx,%lx,%lx]", &clr, &bkgclr, &alpha);
|
||||
if (i && width != -2)
|
||||
{
|
||||
WT_Color x(clr>>16,(clr&0xff00)>>8,clr&0xff);
|
||||
if (width != -2)
|
||||
my_file.desired_rendition().color() = x;
|
||||
if (i == 1) // Geen achtergrond kleur
|
||||
{
|
||||
alpha = 0;
|
||||
}
|
||||
else if (i==2) // Geen alpha maar wel background
|
||||
{
|
||||
alpha = 255;
|
||||
}
|
||||
WT_Color x(clr >> 16, (clr & 0xff00) >> 8, clr & 0xff);
|
||||
my_file.desired_rendition().color() = x;
|
||||
}
|
||||
token.Delete(0, end);
|
||||
}
|
||||
@@ -599,6 +617,43 @@ CSize CSLNKContourImpl::DrawOneLabel(WT_File &my_file,
|
||||
int rdx = myRound(horoffset * cos(radian) - tot_height * sin(radian));
|
||||
int rdy = myRound(tot_height * cos(radian) + horoffset * sin(radian));
|
||||
|
||||
if (alpha > 0)
|
||||
{
|
||||
WT_Color keep = my_file.desired_rendition().color();
|
||||
WT_Color x(bkgclr >> 16, (bkgclr & 0xff00) >> 8, bkgclr & 0xff, alpha);
|
||||
my_file.desired_rendition().color() = x;
|
||||
WT_Logical_Point rect[4];
|
||||
RECT rc = { 0, 0, 0, 0 };
|
||||
DrawText(myDC, token, token.GetLength(), &rc, DT_CALCRECT); // Grootte bepalen
|
||||
|
||||
TEXTMETRIC tm;
|
||||
int delta = 0; // zo ver moet de box nog omlaag om de descenders er ook in te krijgen
|
||||
if (GetTextMetrics(myDC, &tm) != 0)
|
||||
{
|
||||
delta = MulDiv(tm.tmDescent, thisLineHeight, FONT_SIZER);
|
||||
}
|
||||
|
||||
int padding = MulDiv(tm.tmDescent, l_fontheight, FONT_SIZER * 2); // halve fontheight padding
|
||||
WT_Polygon my_poly(4, rect, WD_False);
|
||||
int ww = MulDiv(rc.right, thisLineHeight, FONT_SIZER); // 'width' zou voor elke regel dezelfde breedte geven
|
||||
my_poly.points()[0] = rotatedpoint(radian, - padding, - padding - delta); // linksonder
|
||||
my_poly.points()[1] = rotatedpoint(radian, - padding, + padding - delta + thisLineHeight); // linksboven
|
||||
my_poly.points()[2] = rotatedpoint(radian, ww + padding, + padding - delta + thisLineHeight); // rechtsboven
|
||||
my_poly.points()[3] = rotatedpoint(radian, ww + padding, - padding - delta); // rechtsonder
|
||||
|
||||
my_poly.points()[0].m_x += ptTxt.m_x + rdx;
|
||||
my_poly.points()[0].m_y += ptTxt.m_y - rdy;
|
||||
my_poly.points()[1].m_x += ptTxt.m_x + rdx;
|
||||
my_poly.points()[1].m_y += ptTxt.m_y - rdy ;
|
||||
my_poly.points()[2].m_x += ptTxt.m_x + rdx ;
|
||||
my_poly.points()[2].m_y += ptTxt.m_y - rdy;
|
||||
my_poly.points()[3].m_x += ptTxt.m_x + rdx;
|
||||
my_poly.points()[3].m_y += ptTxt.m_y - rdy;
|
||||
|
||||
my_poly.serialize(my_file);
|
||||
my_file.desired_rendition().color() = keep;
|
||||
}
|
||||
|
||||
WT_Text my_text(WT_Logical_Point(ptTxt.m_x + rdx, ptTxt.m_y - rdy), txt);
|
||||
my_text.serialize(my_file);
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
V4.27 09-09-2021
|
||||
- FCLT#63646 Lijndikte van symbolen kunnen zetten
|
||||
- FCLT#68480 Geen TIFF ondersteuning meer
|
||||
- FCLT#69004 Labels pas op papercolor reageren (in plaats van contour kleur)
|
||||
als alpha<128. Bij grotere alpha 'wint' contour kleuring
|
||||
Label achtergrondkleur en alpha via [cff00ff,00ff00,128]
|
||||
|
||||
V4.26 16-08-2021
|
||||
- FMHN#67510 ARC ondersteuning fixje #define MAX_BUILDER 1000
|
||||
|
||||
Reference in New Issue
Block a user