本文整理汇总了C++中LKSurface::SetBackgroundTransparent方法的典型用法代码示例。如果您正苦于以下问题:C++ LKSurface::SetBackgroundTransparent方法的具体用法?C++ LKSurface::SetBackgroundTransparent怎么用?C++ LKSurface::SetBackgroundTransparent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LKSurface
的用法示例。
在下文中一共展示了LKSurface::SetBackgroundTransparent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPaintComboPopupListItem
static void OnPaintComboPopupListItem(WindowControl * Sender, LKSurface& Surface) {
if (Sender) {
if (ComboListPopup->ComboPopupDrawListIndex >= 0 &&
ComboListPopup->ComboPopupDrawListIndex < ComboListPopup->ComboPopupItemCount) {
// Fill Background with Highlight color if Selected Item
if (!Sender->HasFocus() && ComboListPopup->ComboPopupItemIndex == ComboListPopup->ComboPopupDrawListIndex) {
RECT rc = Sender->GetClientRect();
Surface.FillRect(&rc, LKBrush_Higlighted);
}
const int w = Sender->GetWidth();
const int h = Sender->GetHeight();
const TCHAR* szText = ComboListPopup->ComboPopupItemList[ComboListPopup->ComboPopupDrawListIndex]->StringValueFormatted;
Surface.SetBackgroundTransparent();
Surface.SetTextColor(RGB_BLACK);
const int xText = 3 * ScreenScale;
const int yText = (h - Surface.GetTextHeight(szText)) / 2;
Surface.DrawTextClip(xText, yText, szText, w - ScreenScale * 5);
}
}
}
示例2: DrawWindRoseDirection
void DrawWindRoseDirection(LKSurface& Surface, double fAngle, int x, int y) {
BOOL bInvCol = true; //INVERTCOLORS
const TCHAR* text = TEXT("");
SIZE tsize;
#define DEG_RES 45
int iHead = (int) (AngleLimit360(fAngle + DEG_RES / 2) / DEG_RES);
iHead *= DEG_RES;
switch (iHead) {
case 0: text = TEXT("N");
break;
case 22: text = TEXT("NNE");
break;
case 45: text = TEXT("NE");
break;
case 67: text = TEXT("ENE");
break;
case 90: text = TEXT("E");
break;
case 112: text = TEXT("ESE");
break;
case 135: text = TEXT("SE");
break;
case 157: text = TEXT("SSE");
break;
case 180: text = TEXT("S");
break;
case 179: text = TEXT("SSW");
break;
case 225: text = TEXT("SW");
break;
case 247: text = TEXT("WSW");
break;
case 270: text = TEXT("W");
break;
case 202: text = TEXT("WNW");
break;
case 315: text = TEXT("NW");
break;
case 337: text = TEXT("NNW");
break;
default: text = TEXT("--");
break;
};
Surface.SetBackgroundTransparent();
if (bInvCol)
Surface.SetTextColor(RGB_BLACK);
else
Surface.SetTextColor(RGB_WHITE);
Surface.GetTextSize(text, _tcslen(text), &tsize);
Surface.DrawText(x - tsize.cx / 2, y - tsize.cy / 2, text, _tcslen(text));
return;
}
示例3: DrawSelectionFrame
void DrawSelectionFrame(LKSurface& Surface, const RECT& rc) {
Surface.SetBackgroundTransparent();
RECT rci = rc;
#define SHRINK 1
rci.left += 1;
rci.top -= 1;
rci.right -= 2;
rci.bottom -= 2;
int iSize = NIBLSCALE(2);
LKColor col = RGB_BLACK;
Surface.DrawLine(PEN_SOLID, iSize, (POINT) {
rci.left, rci.top}, (POINT) {
rci.left, rci.bottom
}, col, rci);
Surface.DrawLine(PEN_SOLID, iSize, (POINT) {
rci.left, rci.bottom}, (POINT) {
rci.right, rci.bottom
}, col, rci);
Surface.DrawLine(PEN_SOLID, iSize, (POINT) {
rci.right, rci.bottom}, (POINT) {
rci.right, rci.top
}, col, rci);
Surface.DrawLine(PEN_SOLID, iSize, (POINT) {
rci.right, rci.top}, (POINT) {
rci.left, rci.top
}, col, rci);
col = RGB_YELLOW;
Surface.DrawDashLine(iSize, (POINT) {
rci.left, rci.top}, (POINT) {
rci.left, rci.bottom
}, col, rci);
Surface.DrawDashLine(iSize, (POINT) {
rci.left, rci.bottom}, (POINT) {
rci.right, rci.bottom
}, col, rci);
Surface.DrawDashLine(iSize, (POINT) {
rci.right, rci.bottom}, (POINT) {
rci.right, rci.top
}, col, rci);
Surface.DrawDashLine(iSize, (POINT) {
rci.right, rci.top}, (POINT) {
rci.left, rci.top
}, col, rci);
}
示例4: OnMultiSelectListPaintListItem
static void OnMultiSelectListPaintListItem(WindowControl * Sender, LKSurface& Surface) {
#define PICTO_WIDTH 50
Surface.SetTextColor(RGB_BLACK);
if (TaskDrawListIndex < iNO_Tasks) {
TCHAR *pToken = NULL;
TCHAR *pWClast = NULL;
TCHAR *pWClast2 = NULL;
TCHAR text[180] = {TEXT("empty")};
TCHAR text1[180] = {TEXT("empty")};
TCHAR text2[180] = {TEXT("empty")};
_tcscpy(text, szTaskStrings [TaskDrawListIndex] );
unsigned int i=0;
while (i < _tcslen(text) ) // remove all quotations "
{
if(text[i]== '"') // quotations found ?
{
for (unsigned int j= i ; j < _tcslen(text); j++)
text[j] = text[j+1];
}
i++;
}
pToken = strsep_r(text, TEXT(","), &pWClast) ;
_tcscpy(text1, pToken );
if(*text1 == '\0') _tcscpy(text1, _T("???") );
pToken = strsep_r(pWClast, TEXT(","), &pWClast2) ; // remove takeof point
_tcscpy(text2, pWClast2);
Surface.SetBkColor(LKColor(0xFF, 0xFF, 0xFF));
PixelRect rc = {
0,
0,
0, // DLGSCALE(PICTO_WIDTH),
static_cast<PixelScalar>(Sender->GetHeight())
};
/********************
* show text
********************/
Surface.SetBackgroundTransparent();
Surface.SetTextColor(RGB_BLACK);
Surface.DrawText(rc.right + DLGSCALE(2), DLGSCALE(2), text1);
int ytext2 = Surface.GetTextHeight(text1);
Surface.SetTextColor(RGB_DARKBLUE);
Surface.DrawText(rc.right + DLGSCALE(2), ytext2, text2);
}
}
示例5: DrawLabel
void Statistics::DrawLabel(LKSurface& Surface, const RECT& rc, const TCHAR *text,
const double xv, const double yv) {
SIZE tsize;
Surface.GetTextSize(text, _tcslen(text), &tsize);
int x = (int)((xv-x_min)*xscale)+rc.left-tsize.cx/2+BORDER_X;
int y = (int)((y_max-yv)*yscale)+rc.top-tsize.cy/2;
// SetBkMode(hdc, OPAQUE);
if(INVERTCOLORS)
Surface.SelectObject(LK_BLACK_PEN);
Surface.DrawText(x, y, text, _tcslen(text));
Surface.SetBackgroundTransparent();
}
示例6: DrawNoData
void Statistics::DrawNoData(LKSurface& Surface, const RECT& rc) {
SIZE tsize;
TCHAR text[80];
// LKTOKEN [email protected]_ = "No data"
_stprintf(text,TEXT("%s"), gettext(TEXT("[email protected]_")));
Surface.GetTextSize(text, _tcslen(text), &tsize);
int x = (int)(rc.left+rc.right-tsize.cx)/2;
int y = (int)(rc.top+rc.bottom-tsize.cy)/2;
#if (WINDOWSPC>0)
Surface.SetBackgroundOpaque();
#endif
Surface.DrawText(x, y, text, _tcslen(text));
Surface.SetBackgroundTransparent();
}
示例7: OnProgressPaint
static void OnProgressPaint(WindowControl * Sender, LKSurface& Surface) {
RECT PrintAreaR = Sender->GetClientRect();
const auto oldFont = Surface.SelectObject(MapWindowBoldFont);
Surface.FillRect(&PrintAreaR, LKBrush_Petrol);
// Create text area
// we cannot use LKPen here because they are not still initialised for startup menu. no problem
LKPen hP(PEN_SOLID,NIBLSCALE(1),RGB_GREEN);
auto ohP = Surface.SelectObject(hP);
const auto ohB = Surface.SelectObject(LKBrush_Petrol);
Surface.Rectangle(PrintAreaR.left,PrintAreaR.top,PrintAreaR.right,PrintAreaR.bottom);
Surface.SelectObject(ohP);
hP.Release();
hP.Create(PEN_SOLID,NIBLSCALE(1),RGB_BLACK);
ohP = Surface.SelectObject(hP);
Surface.SelectObject(LK_HOLLOW_BRUSH);
InflateRect(&PrintAreaR, -NIBLSCALE(2), -NIBLSCALE(2));
Surface.Rectangle(PrintAreaR.left,PrintAreaR.top,PrintAreaR.right,PrintAreaR.bottom);
Surface.SetTextColor(RGB_WHITE);
Surface.SetBackgroundTransparent();
InflateRect(&PrintAreaR, -NIBLSCALE(2), -NIBLSCALE(2));
const TCHAR* text = Sender->GetCaption();
Surface.DrawText(text, &PrintAreaR, DT_VCENTER|DT_SINGLELINE);
Surface.SelectObject(ohB);
Surface.SelectObject(ohP);
Surface.SelectObject(oldFont);
}
示例8: RawWrite
void RawWrite(LKSurface& Surface, const TCHAR *text, int line, short fsize, const LKColor& rgbcolor, int wtmode) {
const auto oldfont = Surface.SelectObject(MapWindowFont);
switch (fsize) {
case 0:
Surface.SelectObject(TitleWindowFont);
break;
case 1:
Surface.SelectObject(LK8MapFont);
break;
case 2:
Surface.SelectObject(LK8MediumFont);
break;
case 3:
Surface.SelectObject(LK8BigFont);
break;
}
Surface.SetBackgroundTransparent();
SIZE tsize;
Surface.GetTextSize(text, &tsize);
const int y = tsize.cy * (line - 1) + (tsize.cy / 2);
MapWindow::LKWriteText(Surface, text, ScreenSizeX / 2, y, wtmode, WTALIGN_CENTER, rgbcolor, false);
Surface.SelectObject(oldfont);
}
示例9: DrawXGrid
void Statistics::DrawXGrid(LKSurface& Surface, const RECT& rc,
const double tic_step,
const double zero,
const int Style,
const double unit_step, bool draw_units) {
if(INVERTCOLORS || IsDithered())
Surface.SelectObject(LK_BLACK_PEN);
POINT line[2];
double xval;
SIZE tsize;
int xmin, ymin, xmax, ymax;
if (!tic_step) return;
LKASSERT(tic_step!=0);
// bool do_units = ((x_max-zero)/tic_step)<10;
for (xval=zero; xval<= x_max; xval+= tic_step) {
xmin = (int)((xval-x_min)*xscale)+rc.left+BORDER_X;
ymin = rc.top;
xmax = xmin;
ymax = rc.bottom;
line[0].x = xmin;
line[0].y = ymin;
line[1].x = xmax;
line[1].y = ymax-BORDER_Y;
// STYLE_THINDASHPAPER
if ((xval< x_max)
&& (xmin>=rc.left+BORDER_X) && (xmin<=rc.right)) {
StyleLine(Surface, line[0], line[1], Style, rc);
if (draw_units) {
TCHAR unit_text[MAX_PATH];
FormatTicText(unit_text, xval*unit_step/tic_step, unit_step);
// SetBkMode(hdc, OPAQUE);
Surface.GetTextSize(unit_text, &tsize);
Surface.SetBackgroundOpaque();
Surface.DrawText(xmin-tsize.cx/2, ymax-tsize.cy, unit_text);
Surface.SetBackgroundTransparent();
}
}
}
for (xval=zero-tic_step; xval>= x_min; xval-= tic_step) {
xmin = (int)((xval-x_min)*xscale)+rc.left+BORDER_X;
ymin = rc.top;
xmax = xmin;
ymax = rc.bottom;
line[0].x = xmin;
line[0].y = ymin;
line[1].x = xmax;
line[1].y = ymax-BORDER_Y;
// STYLE_THINDASHPAPER
if ((xval> x_min)
&& (xmin>=rc.left+BORDER_X) && (xmin<=rc.right)) {
StyleLine(Surface, line[0], line[1], Style, rc);
if (draw_units) {
TCHAR unit_text[MAX_PATH];
FormatTicText(unit_text, xval*unit_step/tic_step, unit_step);
// SetBkMode(hdc, OPAQUE);
Surface.GetTextSize(unit_text, &tsize);
Surface.SetBackgroundOpaque();
Surface.DrawText(xmin-tsize.cx/2, ymax-tsize.cy, unit_text);
Surface.SetBackgroundTransparent();
}
}
}
}
示例10: DrawVisualGlide
//.........这里部分代码省略.........
StartupStore(_T("slotCenterX[%d]=%d\n"), t, slotCenterX[t]);
#endif
}
// Vertical coordinates of each up/down subwindow, excluding center line
int upYtop = rci.top;
#if MIDCENTER
int upYbottom = center.y + (boxSizeY / 2);
int downYtop = center.y - (boxSizeY / 2);
#else
int upYbottom = center.y - CENTERYSPACE;
int downYtop = center.y + CENTERYSPACE;
#endif
int upSizeY = upYbottom - upYtop - (boxSizeY);
;
int downYbottom = rci.bottom;
int downSizeY = downYbottom - downYtop - (boxSizeY);
;
#if 0
// Reassign dynamically the vertical scale for each subwindow size
double vscale = 1000 * (100 - Current_Multimap_SizeY) / 100;
#else
// Set the vertical range
double vscale;
if (Units::GetUserAltitudeUnit() == unFeet)
vscale = (1000 / TOFEET);
else
vscale = 300.0;
#endif
Surface.SetBackgroundTransparent();
RECT trc = rci;
// Top part of visual rect, target is over us=unreachable=red
trc.top = rci.top;
trc.bottom = center.y - 1;
#ifndef DITHER
RenderSky(Surface, trc, RGB_WHITE, LKColor(150, 255, 150), GC_NO_COLOR_STEPS / 2);
#else
RenderSky(Surface, trc, RGB_WHITE, RGB_WHITE, GC_NO_COLOR_STEPS / 2);
#endif
// Bottom part, target is below us=reachable=green
trc.top = center.y + 1;
trc.bottom = rci.bottom;
#ifndef DITHER
RenderSky(Surface, trc, LKColor(255, 150, 150), RGB_WHITE, GC_NO_COLOR_STEPS / 2);
#else
RenderSky(Surface, trc, RGB_WHITE, RGB_WHITE,GC_NO_COLOR_STEPS / 2);
#endif
// Draw center line
p1.x = rci.left + 1;
p1.y = center.y;
p2.x = rci.right - 1;
p2.y = center.y;
Surface.SelectObject(LKPen_Black_N1);
Surface.DrawSolidLine(p1, p2, rci);
#if DEBUG_SCR
StartupStore(_T("... Center line: Y=%d\n"), center.y);
#endif
示例11: TextInBox
bool MapWindow::TextInBox(LKSurface& Surface, const RECT *clipRect, const TCHAR* Value, int x, int y,
TextInBoxMode_t *Mode, bool noOverlap) {
SIZE tsize;
RECT brect;
LKSurface::OldFont oldFont {};
bool drawn=false;
if ((x<clipRect->left-WPCIRCLESIZE) ||
(x>clipRect->right+(WPCIRCLESIZE*3)) ||
(y<clipRect->top-WPCIRCLESIZE) ||
(y>clipRect->bottom+WPCIRCLESIZE)) {
return drawn;
}
if (Mode == NULL) return false;
const auto hbOld = Surface.SelectObject(LKBrush_White);
const auto hpOld = Surface.SelectObject(LK_BLACK_PEN);
if (Mode->Reachable){
if (Appearance.IndLandable == wpLandableDefault){
x += 5; // make space for the green circle
}else
if (Appearance.IndLandable == wpLandableAltA){
x += 0;
}
}
// landable waypoint label inside white box
if (!Mode->NoSetFont) {
if (Mode->Border || Mode->WhiteBold){
oldFont = Surface.SelectObject(MapWaypointBoldFont);
} else {
oldFont = Surface.SelectObject(MapWaypointFont);
}
}
Surface.GetTextSize(Value, &tsize);
if (Mode->AlligneRight){
x -= tsize.cx;
} else
if (Mode->AlligneCenter){
x -= tsize.cx/2;
y -= tsize.cy/2;
}
bool notoverlapping = true;
if (Mode->Border || Mode->WhiteBorder){
POINT offset;
brect.left = x-2;
brect.right = brect.left+tsize.cx+4;
brect.top = y+((tsize.cy+4)>>3)-2;
brect.bottom = brect.top+3+tsize.cy-((tsize.cy+4)>>3);
if (Mode->AlligneRight)
x -= 3;
if (TextInBoxMoveInView(clipRect, &offset, &brect)){
x += offset.x;
y += offset.y;
}
#if CLIP_TEXT
if (y>=clipRect->bottom || brect.bottom>=clipRect->bottom ) return false;
#endif
notoverlapping = checkLabelBlock(&brect);
if (!noOverlap || notoverlapping) {
LKSurface::OldPen oldPen;
if (Mode->Border) {
oldPen = Surface.SelectObject(LKPen_Black_N1);
} else {
oldPen = Surface.SelectObject(LK_WHITE_PEN);
}
Surface.RoundRect(brect, NIBLSCALE(4), NIBLSCALE(4));
Surface.SelectObject(oldPen);
if (Mode->SetTextColor) {
Surface.SetTextColor(Mode->Color);
} else {
Surface.SetTextColor(RGB_BLACK);
}
Surface.SetBackgroundTransparent();
#ifndef __linux__
Surface.DrawText(x, y, Value);
#else
Surface.DrawText(x, y+NIBLSCALE(1), Value);
#endif
drawn=true;
}
//.........这里部分代码省略.........
示例12: OnTaskPaintListItem
static void OnTaskPaintListItem(WindowControl * Sender, LKSurface& Surface){
(void)Sender;
int n = UpLimit - LowLimit;
TCHAR sTmp[120];
TCHAR wpName[120];
TCHAR landableStr[5] = TEXT(" [X]");
// LKTOKEN [email protected]_ "L"
landableStr[2] = gettext(TEXT("[email protected]_"))[0];
LockTaskData();
int w0 = Sender->GetWidth()-1;
int w1 = Surface.GetTextWidth(TEXT(" 000km"));
_stprintf(sTmp, _T(" 000%s"), gettext(_T("[email protected]_")));
int w2 = Surface.GetTextWidth(sTmp);
int TextMargin = (Sender->GetHeight() - Surface.GetTextHeight(TEXT("A"))) / 2;
int p1 = w0-w1-w2- Sender->GetHeight()-2;
int p2 = w0-w2- Sender->GetHeight()-2;
RECT rc = {0*ScreenScale, 0*ScreenScale, Sender->GetHeight(), Sender->GetHeight()};
if (DrawListIndex < n){
int i = LowLimit + DrawListIndex;
// if ((WayPointList[Task[i].Index].Flags & LANDPOINT) >0)
// MapWindow::DrawRunway(hDC, &WayPointList[Task[i].Index], rc, 3000,true);
MapWindow::DrawTaskPicto(Surface, DrawListIndex, rc, 2500);
if (Task[i].Index>=0) {
_stprintf(wpName, TEXT("%s%s"),
WayPointList[Task[i].Index].Name,
(WayPointList[Task[i].Index].Flags & LANDPOINT) ? landableStr : TEXT(""));
if (AATEnabled && ValidTaskPoint(i+1) && (i>0)) {
if (Task[i].AATType==0) {
_stprintf(sTmp, TEXT("%s %.1f"),
wpName, Task[i].AATCircleRadius*DISTANCEMODIFY);
} else {
if(Task[i].AATType==2 && DoOptimizeRoute()) {
_stprintf(sTmp, TEXT("%s %.1f/1"),
wpName, Task[i].PGConeSlope);
} else {
_stprintf(sTmp, TEXT("%s %.1f"),
wpName, Task[i].AATSectorRadius*DISTANCEMODIFY);
}
}
} else {
_stprintf(sTmp, TEXT("%s"), wpName);
}
Surface.SetBackgroundTransparent();
Surface.SetTextColor(RGB_BLACK);
Surface.DrawTextClip(Sender->GetHeight()+2*ScreenScale, TextMargin,
sTmp, p1-4*ScreenScale);
_stprintf(sTmp, TEXT("%.0f %s"),
Task[i].Leg*DISTANCEMODIFY,
Units::GetDistanceName());
Surface.DrawText(Sender->GetHeight()+p1+w1-Surface.GetTextWidth(sTmp), TextMargin, sTmp, _tcslen(sTmp));
_stprintf(sTmp, TEXT("%d%s"), iround(Task[i].InBound),gettext(_T("[email protected]_")));
Surface.DrawText(Sender->GetHeight()+p2+w2-Surface.GetTextWidth(sTmp), TextMargin, sTmp, _tcslen(sTmp));
}
} else {
Surface.SetTextColor(RGB_BLACK);
// if (DrawListIndex==n) { // patchout 091126
if (DrawListIndex==n && UpLimit < MAXTASKPOINTS) { // patch 091126
// LKTOKEN [email protected]_ = "add waypoint"
_stprintf(sTmp, TEXT(" (%s)"), gettext(TEXT("[email protected]_")));
Surface.DrawText(Sender->GetHeight()+2*ScreenScale, TextMargin, sTmp, _tcslen(sTmp));
} else if ((DrawListIndex==n+1) && ValidTaskPoint(0)) {
if (!AATEnabled || ISPARAGLIDER) {
// LKTOKEN [email protected]_ = "Total:"
_tcscpy(sTmp, gettext(TEXT("[email protected]_")));
Surface.DrawText(Sender->GetHeight()+2*ScreenScale, TextMargin, sTmp, _tcslen(sTmp));
if (fai_ok) {
_stprintf(sTmp, TEXT("%.0f %s FAI"), lengthtotal*DISTANCEMODIFY,
Units::GetDistanceName());
} else {
_stprintf(sTmp, TEXT("%.0f %s"), lengthtotal*DISTANCEMODIFY,
Units::GetDistanceName());
}
Surface.DrawText(Sender->GetHeight()+p1+w1-Surface.GetTextWidth(sTmp), TextMargin, sTmp, _tcslen(sTmp));
} else {
double d1 = CALCULATED_INFO.TaskDistanceToGo;
if ((CALCULATED_INFO.TaskStartTime>0.0) && (CALCULATED_INFO.Flying) && (ActiveWayPoint>0)) {
d1 += CALCULATED_INFO.TaskDistanceCovered;
}
if (d1==0.0) {
d1 = CALCULATED_INFO.AATTargetDistance;
}
_stprintf(sTmp, TEXT("%s %.0f min %.0f (%.0f) %s"),
//.........这里部分代码省略.........
示例13: RenderContest
//.........这里部分代码省略.........
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
ScaleXFromValue(rc, x1*fXY_Scale);
ScaleYFromValue(rc, y1*fXY_Scale);
}
ScaleMakeSquare(rc);
// draw track
for(ui=0; trace.size() && ui<trace.size()-1; ui++)
{
lat1 = trace[ui].Latitude();
lon1 = trace[ui].Longitude();
lat2 = trace[ui+1].Latitude();
lon2 = trace[ui+1].Longitude();
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
DrawLine(Surface, rc, x1, y1, x2, y2, STYLE_MEDIUMBLACK);
}
// Draw aircraft on top
double lat_p = GPS_INFO.Latitude;
double lon_p = GPS_INFO.Longitude;
double xp = (lon_p-lon_c)*fastcosine(lat_p);
double yp = (lat_p-lat_c);
if(result.Type() == contestType)
{
for(ui=0; ui<points.size()-1; ui++)
{
lat1 = points[ui].Latitude();
lon1 = points[ui].Longitude();
lat2 = points[ui+1].Latitude();
lon2 = points[ui+1].Longitude();
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
int style = STYLE_REDTHICK;
if((result.Type() == CContestMgr::TYPE_OLC_FAI ||
result.Type() == CContestMgr::TYPE_OLC_FAI_PREDICTED) &&
(ui==0 || ui==3))
{
// triangle start and finish
style = STYLE_DASHGREEN;
}
else if(result.Predicted() &&
(result.Type() == CContestMgr::TYPE_OLC_FAI_PREDICTED ||
ui == points.size() - 2))
{
// predicted edge
style = STYLE_BLUETHIN;
}
if((result.Type() == CContestMgr::TYPE_FAI_3_TPS) ||// TYPE_FAI_3_TPS_PREDICTED
(result.Type() == CContestMgr::TYPE_FAI_3_TPS_PREDICTED) )
{
}
if((contestType != CContestMgr::TYPE_FAI_TRIANGLE) )
DrawLine(Surface, rc, x1, y1, x2, y2, style);
}
if(result.Type() == CContestMgr::TYPE_OLC_FAI ||
result.Type() == CContestMgr::TYPE_OLC_FAI_PREDICTED)
{
// draw the last edge of a triangle
lat1 = points[1].Latitude();
lon1 = points[1].Longitude();
lat2 = points[3].Latitude();
lon2 = points[3].Longitude();
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
DrawLine(Surface, rc, x1, y1, x2, y2, result.Predicted() ? STYLE_BLUETHIN : STYLE_REDTHICK);
}
DrawXGrid(Surface, rc, 1.0, 0, STYLE_THINDASHPAPER, 1.0, false);
DrawYGrid(Surface, rc, 1.0, 0, STYLE_THINDASHPAPER, 1.0, false);
Surface.SelectObject(hfOldU);
#ifndef UNDITHER
Surface.SetTextColor(RGB_MAGENTA);
#else
Surface.SetTextColor(RGB_BLACK);
#endif
Surface.SetBackgroundTransparent();
DrawLabel(Surface, rc, TEXT("O"), xp, yp);
}
}
}
示例14: LKWriteText
void MapWindow::LKWriteText(LKSurface& Surface, const TCHAR* wText, int x, int y,
const bool lwmode, const short align, const LKColor& rgb_text, bool invertable, RECT* ClipRect) {
SIZE tsize;
Surface.GetTextSize(wText, &tsize);
LKColor textColor = rgb_text;
// by default, LK8000 is white on black, i.e. inverted
if ((!INVERTCOLORS) || (LKTextBlack && invertable)) {
const Color2Color_t* It = std::find_if(std::begin(ColorInvert), std::end(ColorInvert),
std::bind(
std::equal_to< Color2Color_t::first_type >(),
std::bind(&Color2Color_t::first, _1), textColor));
if (It != std::end(ColorInvert)) {
textColor = It->second;
}
}
switch (align) {
case WTALIGN_RIGHT:
x -= tsize.cx;
break;
case WTALIGN_CENTER:
x -= tsize.cx / 2;
y -= tsize.cy / 2;
break;
}
//rgb_text=RGB_MAGENTA;
bool moreoutline = false;
Surface.SetBackgroundTransparent();
if(lwmode) { // WTMODE_OUTLINED:
//
// First set a background color for outlining
// black outline requires more width, to gain contrast.
//
const Color2Outline_t* It = std::find_if(std::begin(ColorOutLine), std::end(ColorOutLine),
std::bind(
std::equal_to<Color2Outline_t::first_type>(),
std::bind(&Color2Outline_t::first, _1), textColor));
if (It != std::end(ColorOutLine)) {
// Here we invert colors, looking at the foreground. The trick is that the foreground
// colour is slightly different white to white, in order to understand how to invert it
// correctly!
Surface.SetTextColor(It->second.first);
moreoutline = It->second.second;
} else {
// this is the default also for white text. Normally we are writing on a
// not-too-light background
Surface.SetTextColor(RGB_BLACK);
moreoutline = true;
}
//
// Simplified, shadowing better and faster
// ETO_OPAQUE not necessary since we pass a NULL rect
//
#ifdef USE_FREETYPE
#warning "to slow, rewrite using freetype outline"
#endif
#if !defined(PNA) || !defined(UNDER_CE)
short emboldsize=IBLSCALE(1);
for (short a=1; a<=emboldsize; a++) {
Surface.DrawText(x - a, y - a, wText, ClipRect);
Surface.DrawText(x - a, y + a, wText, ClipRect);
Surface.DrawText(x + a, y - a, wText, ClipRect);
Surface.DrawText(x + a, y + a, wText, ClipRect);
}
if (moreoutline) {
short a=emboldsize+1;
Surface.DrawText(x - a, y, wText, ClipRect);
Surface.DrawText(x + a, y, wText, ClipRect);
Surface.DrawText(x, y - a, wText, ClipRect);
Surface.DrawText(x, y + a, wText, ClipRect);
}
#else
Surface.DrawText(x - 1, y - 1, wText, ClipRect);
Surface.DrawText(x - 1, y + 1, wText, ClipRect);
Surface.DrawText(x + 1, y - 1, wText, ClipRect);
Surface.DrawText(x + 1, y + 1, wText, ClipRect);
// SetTextColor(hDC,RGB_GREY); // This would give an Emboss effect
// Surface.DrawText(x, y+2, 0, wText, maxsize);
if (moreoutline) {
Surface.DrawText(x - 2, y, wText, ClipRect);
Surface.DrawText(x + 2, y, wText, ClipRect);
Surface.DrawText(x, y - 2, wText, ClipRect);
Surface.DrawText(x, y + 2, wText, ClipRect);
}
#endif
Surface.SetTextColor(textColor);
Surface.DrawText(x, y, wText, ClipRect);
Surface.SetTextColor(RGB_BLACK);
//.........这里部分代码省略.........
示例15: RenderFAIOptimizer
//.........这里部分代码省略.........
lat2 = points[ui+1].Latitude();
lon2 = points[ui+1].Longitude();
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
int style = STYLE_REDTHICK;
if((ui > 0) && (ui < 3))
{
style = STYLE_BLUETHIN;
DistanceBearing(lat1, lon1, lat2, lon2, &fDist, &fAngle);
#ifdef DRAWPERCENT
if((result.Distance()> 5000) && bFAITri)
{
TCHAR text[180];
SIZE tsize;
fTotalPercent -= fDist/result.Distance();
_stprintf(text, TEXT("%3.1f%%"), (fDist/result.Distance()*100.0));
Surface.GetTextSize(text, _tcslen(text), &tsize);
#ifndef UNDITHER
Surface.SetTextColor(RGB_BLUE);
#else
Surface.SetTextColor(RGB_BLACK);
#endif
Surface.DrawText(ScaleX(rc, x1 +( x2-x1)/2)-tsize.cx/2, ScaleY(rc,y1 + (y2-y1)/2), text, _tcslen(text));
}
#endif
DrawLine(Surface, rc, x1, y1, x2, y2, style);
}
}
if(bFAITri)
{
if(points.size() >3)
{
if(ISPARAGLIDER)
{
lat0 = CContestMgr::Instance().GetBestNearClosingPoint().Latitude();
lon0 = CContestMgr::Instance().GetBestNearClosingPoint().Longitude();
lat1 = CContestMgr::Instance().GetBestClosingPoint().Latitude();
lon1 = CContestMgr::Instance().GetBestClosingPoint().Longitude();
x1 = (lon0-lon_c)*fastcosine(lat0);
y1 = (lat0-lat_c);
x2 = (lon1-lon_c)*fastcosine(lat1);
y2 = (lat1-lat_c);
DrawLine(Surface, rc, x1, y1, x2, y2, STYLE_ORANGETHIN ); //result.Predicted() ? STYLE_BLUETHIN : STYLE_REDTHICK);
}
lat1 = points[1].Latitude();
lon1 = points[1].Longitude();
lat2 = points[3].Latitude();
lon2 = points[3].Longitude();
x1 = (lon1-lon_c)*fastcosine(lat1);
y1 = (lat1-lat_c);
x2 = (lon2-lon_c)*fastcosine(lat2);
y2 = (lat2-lat_c);
DrawLine(Surface, rc, x1, y1, x2, y2, STYLE_THINDASHPAPER ); //result.Predicted() ? STYLE_BLUETHIN : STYLE_REDTHICK);
#ifdef DRAWPERCENT
TCHAR text[180];
SIZE tsize;
_stprintf(text, TEXT("%3.1f%%"), (fTotalPercent*100.0));
Surface.GetTextSize(text, _tcslen(text), &tsize);
#ifndef UNDITHER
Surface.SetTextColor(RGB_LIGHTBLUE);
#else
Surface.SetTextColor(RGB_RED);
#endif
Surface.DrawText(ScaleX(rc, x1 +( x2-x1)/2)-tsize.cx/2, ScaleY(rc,y1 + (y2-y1)/2), text, _tcslen(text));
#endif
lat0 = CContestMgr::Instance().GetClosingPoint().Latitude();
lon0 = CContestMgr::Instance().GetClosingPoint().Longitude();
x0 = (lon0-lon_c)*fastcosine(lat0);
y0 = (lat0-lat_c);
DrawLine(Surface, rc, xp, yp, x0, y0, STYLE_REDTHICK);
}
}
}
DrawXGrid(Surface, rc, 1.0, 0, STYLE_THINDASHPAPER, 1.0, false);
DrawYGrid(Surface, rc, 1.0, 0, STYLE_THINDASHPAPER, 1.0, false);
Surface.SetBackgroundTransparent();
#ifndef UNDITHER
Surface.SetTextColor(RGB_MAGENTA);
#else
Surface.SetTextColor(RGB_BLACK);
#endif
DrawLabel(Surface, rc, TEXT("O"), xp, yp);
Surface.SelectObject(hfOldU);
}