本文整理汇总了C++中DrawArrow函数的典型用法代码示例。如果您正苦于以下问题:C++ DrawArrow函数的具体用法?C++ DrawArrow怎么用?C++ DrawArrow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DrawArrow函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitDrawing
/*----------------------------------------------------------------------
DrawSkewingArrows
Draw/Clear the four arrows arround the objet that indicate the skewing
direction.
*----------------------------------------------------------------------*/
void AmayaTransformEvtHandler::DrawSkewingArrows()
{
InitDrawing (5, 1, 0);
glEnable(GL_COLOR_LOGIC_OP);
#ifdef _WINDOWS
glLogicOp(GL_COPY_INVERTED);
#else /* _WINDOWS */
glLogicOp(GL_XOR);
#endif /* _WINDOWS */
glColor4ub (127, 127, 127, 0);
/*
----3-----
| |
1 2
| |
----4-----
*/
/* 1 */
DrawArrow (FrameId, 1, 5,
left2 - CURSOR_SIZE/2,
(top2+bottom2)/2 - CURSOR_SIZE,
CURSOR_SIZE,
2*CURSOR_SIZE,
90, 3, 0);
/* 2 */
DrawArrow (FrameId, 1, 5,
right2 - CURSOR_SIZE/2,
(top2+bottom2)/2 - CURSOR_SIZE,
CURSOR_SIZE,
2*CURSOR_SIZE,
90, 3, 0);
/* 3 */
DrawArrow (FrameId, 1, 5,
(left2+right2)/2 - CURSOR_SIZE,
top2 - CURSOR_SIZE/2,
2*CURSOR_SIZE,
CURSOR_SIZE,
0, 3, 0);
/* 4 */
DrawArrow (FrameId, 1, 5,
(left2+right2)/2 - CURSOR_SIZE,
bottom2 - CURSOR_SIZE/2,
2*CURSOR_SIZE,
CURSOR_SIZE,
0, 3, 0);
glDisable(GL_COLOR_LOGIC_OP);
#ifdef _WINDOWS
GL_Swap (FrameId);
#endif /* WINDOWS */
}
示例2: glColor3f
void Graphics::render(AIController *aiController)
{
if (!initialized) {
error->log(GRAPHICS, IMPORTANT, "Render function called without graphics initialization\n");
return;
}
glColor3f(0,1,0);
// Uncomment to render AI debug info
Kinematic k = aiController->agent->getKinematic();
render(aiController->path.knots);
Vec3f closest = aiController->path.closestPoint(aiController->target);
glColor3f(0,1,0);
DrawArrow(k.pos, aiController->target - k.pos);
DrawArrow(aiController->target, closest - aiController->target);
if (aiController->seeObstacle)
{
glColor3f(1,0,0);
DrawArrow(k.pos, aiController->antiTarget - k.pos);
}
}
示例3: CJK_D
void CCJKShapeLine::DrawArrow(QPainter *painter, const QLineF &line)
{
CJK_D(CCJKShapeLine);
double angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
angle = (CJKPi * 2) - angle;
if (d->arrowBeginType != ArrowNone)
{
qreal arrowSize = d->pen.width() + d->arrowBeginSize;
QPointF arrowP1;
QPointF arrowP2;
arrowP1 = line.p1() + QPointF(sin(angle + CJKPi / 3) * arrowSize,
cos(angle + CJKPi / 3) * arrowSize);
arrowP2 = line.p1() + QPointF(sin(angle + CJKPi - CJKPi / 3) * arrowSize,
cos(angle + CJKPi - CJKPi / 3) * arrowSize);
DrawArrow(painter, d->arrowBeginType, line.p1(), arrowP1, arrowP2, arrowSize);
}
if (d->arrowEndType != ArrowNone)
{
qreal arrowSize = d->pen.width() + d->arrowEndSize;
QPointF arrowP1;
QPointF arrowP2;
arrowP1 = line.p2() - QPointF(sin(angle + CJKPi / 3) * arrowSize,
cos(angle + CJKPi / 3) * arrowSize);
arrowP2 = line.p2() - QPointF(sin(angle + CJKPi - CJKPi / 3) * arrowSize,
cos(angle + CJKPi - CJKPi / 3) * arrowSize);
DrawArrow(painter, d->arrowEndType, line.p2(), arrowP1, arrowP2, arrowSize);
}
}
示例4: Render
virtual void Render() {
// Draw the axes outside th3e client area
GG::Pt begin(ClientUpperLeft().x - AXIS_WIDTH/2, ClientLowerRight().y + AXIS_HEIGHT/2);
GG::Pt x_end(ClientLowerRight().x, begin.y);
GG::Pt y_end(begin.x, ClientUpperLeft().y);
DrawArrow(begin, x_end);
DrawArrow(begin, y_end);
}
示例5: DrawArrow
//+++-S-cf-------------------------------------------------------------------
// NAME: DrawArrow()
// DESC: Draw arrow
// PARAMETERS: CHART_HPAINT hp,
// int pos,
// bool over
// RETURN: None
//----------------------------------------------------------------------E-+++
void wxLegend::DrawArrow(
CHART_HPAINT hp,
int pos,
bool over
)
{
//-----------------------------------------------------------------------
// Get actual configuration
//-----------------------------------------------------------------------
wxBrush oldBrush = hp->GetBrush();
wxPen oldPen = hp->GetPen();
//-----------------------------------------------------------------------
// if mouse over use different colours
//-----------------------------------------------------------------------
if (over)
{
hp->SetBrush( *wxBLACK_BRUSH );
hp->SetPen( *wxBLACK_PEN );
}
else
{
hp->SetBrush( *wxGREY_BRUSH );
hp->SetPen( *wxBLACK_PEN );
}
if ( pos == ARROW_DOWN )
{
//-------------------------------------------------------------------
// If mouse position has change than redraw arrow
//-------------------------------------------------------------------
if (m_ArrowDown.m_sel != over)
{
DrawArrow(hp, m_ArrowDown.m_x, m_ArrowDown.m_y, 8, pos, over);
}
}
if ( pos == ARROW_UP )
{
//-------------------------------------------------------------------
// If mouse position has change than redraw arrow
//-------------------------------------------------------------------
if (m_ArrowUp.m_sel != over)
{
DrawArrow(hp, m_ArrowUp.m_x, m_ArrowUp.m_y, 8, pos, over);
}
}
//-----------------------------------------------------------------------
// Set old colours
//-----------------------------------------------------------------------
hp->SetBrush( oldBrush );
hp->SetPen( oldPen );
}
示例6: buffer
void Clock::Draw(BView *view, int32)
{
BScreen screen;
BBitmap buffer(view->Bounds(), screen.ColorSpace(), true);
BView offscreen(view->Bounds(), NULL, 0, 0);
buffer.AddChild(&offscreen);
buffer.Lock();
int n;
float a,R;
float width = view->Bounds().Width();
float height = view->Bounds().Height();
float zoom = (height/1024) * 0.85;
time(&tmptodaytime);
TodayTime = localtime(&tmptodaytime);
todaysecond = TodayTime->tm_sec;
todayminute = TodayTime->tm_min + (todaysecond/60.0);
todayhour = TodayTime->tm_hour + (todayminute/60.0);
rgb_color bg_color = {0,0,0};
offscreen.SetHighColor(bg_color);
offscreen.SetLowColor(bg_color);
offscreen.FillRect(offscreen.Bounds());
offscreen.SetHighColor(200,200,200);
for(n=0,a=0,R=510*zoom;n<60;n++,a+=(2*M_PI)/60) {
float x = width/2 + R * cos(a);
float y = height/2 + R * sin(a);
DrawBlock(&offscreen,x,y,a,14*zoom);
}
offscreen.SetHighColor(255,255,255);
for(n=0,a=0,R=500*zoom;n<12;n++,a+=(2*M_PI)/12) {
float x = width/2 + R * cos(a);
float y = height/2 + R * sin(a);
DrawBlock(&offscreen,x,y,a,32*zoom);
}
offscreen.SetHighColor(255,255,255);
DrawArrow(&offscreen, width/2,height/2, ( ((2*M_PI)/60) * todayminute) - (M_PI/2), 220*zoom, 1, 8*zoom);
DrawArrow(&offscreen, width/2,height/2, ( ((2*M_PI)/12) * todayhour) - (M_PI/2), 140*zoom, 1, 14*zoom);
offscreen.FillEllipse(BPoint(width/2,height/2),24*zoom,24*zoom);
offscreen.SetHighColor(250,20,20);
DrawArrow(&offscreen, width/2,height/2, ( ((2*M_PI)/60) * todaysecond) - (M_PI/2), 240*zoom, 1, 4*zoom);
offscreen.FillEllipse(BPoint(width/2,height/2),20*zoom,20*zoom);
offscreen.Sync();
buffer.Unlock();
view->DrawBitmap(&buffer);
buffer.RemoveChild(&offscreen);
}
示例7: DrawDebugArrow
void DrawDebugArrow(const Vector3Df& from, const Vector3Df& to)
{
float currentAlpha = g_CurrentColor.a;
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
g_CurrentColor.a = 0.5f;
DrawArrow(from, to);
glEnable(GL_DEPTH_TEST);
g_CurrentColor.a = currentAlpha;
DrawArrow(from, to);
}
示例8: centerAxleLoadPrepare
void centerAxleLoadPrepare(void)
{
const uint16_t WHEEL_RADIUS = 25;
const uint16_t WHEEL_HEIGHT = 30;
const uint16_t POS_X1 = 245;
const uint16_t POS_Y1_2 = 165;
const uint16_t POS_X2 = 555;
const uint16_t POS_X3 = POS_X1;
const uint16_t POS_X6 = POS_X2;
const uint16_t POS_X4 = POS_X3 + (WHEEL_RADIUS*2);
const uint16_t POS_X5 = POS_X6 - (WHEEL_RADIUS*2);
const uint16_t POS_Y3 = 280;
// ___ ___
// | | | |
// | 1 |-----------------| 2 |
// |___| |___|
//
// ___ ___ ___ ___
// | | | | | |
// | 3 | 4 |---------| 5 | 6 |
// |___|___| |___|___|
ClearCenterLayers();
XGdcDrawDimension(&g_stcMyGDC_DrvCTX, GDC_16BPP_FORMAT, L2ADR0, WIN_WIDTH, WIN_HEIGHT);
XGdcSetAttrLine(&g_stcMyGDC_DrvCTX, GDC_LINE_WIDTH, 3);
XGdcColor(&g_stcMyGDC_DrvCTX, GDC_YELLOW16);
// DrawLine(POS_X1+WHEEL_RADIUS, POS_Y1_2+(WHEEL_HEIGHT/2), POS_X2-WHEEL_RADIUS, POS_Y1_2+(WHEEL_HEIGHT/2));
DrawLine(POS_X4+WHEEL_RADIUS, POS_Y3+(WHEEL_HEIGHT/2), POS_X5-WHEEL_RADIUS, POS_Y3+(WHEEL_HEIGHT/2));
// MyGDC_DrawBitmap16(L2ADR0, POS_X1 - (WHEEL_BITMAP_WIDTH/2), POS_Y1_2+(WHEEL_HEIGHT/2) - (WHEEL_BITMAP_HEIGHT / 2), WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
// MyGDC_DrawBitmap16(L2ADR0, POS_X2 - (WHEEL_BITMAP_WIDTH/2), POS_Y1_2+(WHEEL_HEIGHT/2) - (WHEEL_BITMAP_HEIGHT / 2), WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
// XGdcSetAlpha(&g_stcMyGDC_DrvCTX, 10);
MyGDC_DrawBitmap16(L2ADR0, POS_X3 - (WHEEL_BITMAP_WIDTH/2), POS_Y3+(WHEEL_HEIGHT/2) - (WHEEL_BITMAP_HEIGHT / 2), WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
MyGDC_DrawBitmap16(L2ADR0, POS_X4 - (WHEEL_BITMAP_WIDTH/2), POS_Y3+(WHEEL_HEIGHT/2) - (WHEEL_BITMAP_HEIGHT / 2), WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
MyGDC_DrawBitmap16(L2ADR0, POS_X5 - (WHEEL_BITMAP_WIDTH/2), POS_Y3+(WHEEL_HEIGHT/2) - (WHEEL_BITMAP_HEIGHT / 2), WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
MyGDC_DrawBitmap16(L2ADR0, POS_X6 - (WHEEL_BITMAP_WIDTH/2), POS_Y3+(WHEEL_HEIGHT/2) - (WHEEL_BITMAP_HEIGHT / 2), WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
XGdcColor(&g_stcMyGDC_DrvCTX, GDC_WHITE16);
DrawArrow(WIN_WIDTH / 2, POS_Y1_2+(WHEEL_HEIGHT/2), 0);
DrawArrow(WIN_WIDTH / 2, POS_Y3+(WHEEL_HEIGHT/2), 0);
Text_DrawText("12.3", FALSE, WIN_WIDTH / 2, 107, FONT_ALIGN_CENTER, FONT_ARIAL36, L2ADR0, MYGDC_COL555(28,28,28));
Text_DrawText("25.9", FALSE, WIN_WIDTH / 2, 219, FONT_ALIGN_CENTER, FONT_ARIAL36, L2ADR0, MYGDC_COL555(28,28,28));
TransferDisplayList(&g_stcMyGDC_DrvCTX);
XGdcCancelDisplayList(&g_stcMyGDC_DrvCTX);
XGdcDrawDimension(&g_stcMyGDC_DrvCTX, GDC_16BPP_FORMAT, TEX_1_ADR, 128, 128);
XGdcBltDraw16(&g_stcMyGDC_DrvCTX, 0, 0, WHEEL_BITMAP_WIDTH, WHEEL_BITMAP_HEIGHT, Bitmap_au16Wheel);
}
示例9: NumPages
//+++-S-cf-------------------------------------------------------------------
// NAME: Draw()
// DESC: Draw legend
// PARAMETERS: CHART_HPAINT hp,
// CHART_HRECT hr
// RETURN: None
//----------------------------------------------------------------------E-+++
void wxLegend::Draw(
CHART_HPAINT hp,
CHART_HRECT hr
)
{
int iPages = NumPages();
int iLines = iPages > 0 ? ROWS_PAGE : GetCount();
wxCoord h;
//h = (ROWS_PAGE * ROW_SIZE < hr->h) ? ROWS_PAGE * ROW_SIZE : hr->h;
h = (iLines * ROW_SIZE < hr->h) ? iLines * ROW_SIZE : hr->h;
wxCoord x, y;
x = (wxCoord)( 5 + hr->x );
y = (wxCoord)( 5 + hr->y );
//-----------------------------------------------------------------------
// draw arrows
//-----------------------------------------------------------------------
if ( iPages > 0 )
{
hp->SetBrush( *wxGREY_BRUSH );
hp->SetPen( *wxBLACK_PEN );
DrawArrow( hp, x+hr->w/2, y, 8, ARROW_UP, false );
hp->DrawLine( x+15, y+10, x+hr->w-15, y+10);
DrawArrow( hp, x+hr->w/2, y + 20, 8, ARROW_DOWN, false );
}
//-----------------------------------------------------------------------
// draw shadow
//-----------------------------------------------------------------------
y += 30;
hp->SetBrush( *wxGREY_BRUSH );
hp->SetPen( *wxTRANSPARENT_PEN );
hp->DrawRectangle( x +5, y +5, hr->w - 10, h );
//-----------------------------------------------------------------------
// draw legend window
//-----------------------------------------------------------------------
hp->SetBrush( *wxWHITE_BRUSH );
hp->SetPen( *wxBLACK_PEN );
hp->DrawRectangle( x, y, hr->w - 10, h );
//-----------------------------------------------------------------------
// write labels
//-----------------------------------------------------------------------
WriteLabel( hp, x+3, y+3, m_Page );
}
示例10: DrawArrow
void wxStdRenderer::DrawScrollbarArrow(wxDC& dc,
wxDirection dir,
const wxRect& rect,
int flags)
{
DrawArrow(dc, dir, rect, flags);
}
示例11: uround
void
WindArrowRenderer::Draw(Canvas &canvas, const Angle screen_angle,
const SpeedVector wind, const PixelPoint pos,
const PixelRect rc, WindArrowStyle arrow_style)
{
// Draw arrow (and tail)
const unsigned length = uround(Quadruple(wind.norm));
DrawArrow(canvas, pos, wind.bearing - screen_angle, length, arrow_style);
// Draw wind speed label
StaticString<12> buffer;
buffer.Format(_T("%i"), iround(Units::ToUserWindSpeed(wind.norm)));
canvas.SetTextColor(COLOR_BLACK);
canvas.Select(*look.font);
const unsigned offset = uround(M_SQRT2 * wind.norm);
BulkPixelPoint label[] = {
{ 18, -26 - int(offset) },
};
PolygonRotateShift(label, ARRAY_SIZE(label),
pos, wind.bearing - screen_angle);
TextInBoxMode style;
style.align = TextInBoxMode::Alignment::CENTER;
style.vertical_position = TextInBoxMode::VerticalPosition::CENTERED;
style.shape = LabelShape::OUTLINED;
TextInBox(canvas, buffer, label[0].x, label[0].y, style, rc);
}
示例12: Q_UNUSED
void ScreenshotEditWidget::paintEvent(QPaintEvent* event)
{
Q_UNUSED(event);
QPainter painter(this);
painter.drawPixmap(ui->screenshotDisplayWidget->x(), ui->screenshotDisplayWidget->y(),
_source->width(), _source->height(), _newPixmap);
painter.fillRect(ui->colorDisplayWidget->x(), ui->colorDisplayWidget->y(),
ui->colorDisplayWidget->width(), ui->colorDisplayWidget->height(), _color);
painter.drawRect(ui->screenshotDisplayWidget->x(), ui->screenshotDisplayWidget->y(),
ui->screenshotDisplayWidget->width(), ui->screenshotDisplayWidget->height());
if (_toolActive) {
QPen pen;
pen.setColor(_color);
pen.setWidth(3);
painter.setPen(pen);
if (_selectedTool == ST_Rectangle) {
painter.drawRect(ui->screenshotDisplayWidget->x() + _startToolPosition.x(),
ui->screenshotDisplayWidget->y() + _startToolPosition.y(),
_lastToolPosition.x() - _startToolPosition.x(),
_lastToolPosition.y() - _startToolPosition.y());
} else if (_selectedTool == ST_Arrow) {
DrawArrow(painter,
ui->screenshotDisplayWidget->x() + _startToolPosition.x(),
ui->screenshotDisplayWidget->y() + _startToolPosition.y(),
ui->screenshotDisplayWidget->x() + _lastToolPosition.x(),
ui->screenshotDisplayWidget->y() + _lastToolPosition.y());
}
}
}
示例13: painter
void ScreenshotEditWidget::mouseReleaseEvent(QMouseEvent* event) {
if (event->button() != Qt::RightButton &&
event->button() != Qt::MidButton &&
_toolActive == true)
{
QPainter painter(&_newPixmap);
QPen pen;
pen.setColor(_color);
pen.setWidth(3);
painter.setPen(pen);
if (_selectedTool == ST_Rectangle) {
painter.drawRect(_startToolPosition.x(),
_startToolPosition.y(),
_lastToolPosition.x() - _startToolPosition.x(),
_lastToolPosition.y() - _startToolPosition.y());
} else if (_selectedTool == ST_Arrow) {
DrawArrow(painter,
_startToolPosition.x(),
_startToolPosition.y(),
_lastToolPosition.x(),
_lastToolPosition.y());
}
}
_toolActive = false;
update();
}
示例14: LoseLife
void LoseLife(char *reason) {
//Draw cracked screen - but draw all the rest of the world & hud first
CloseGraphics();
OpenGraphics();
DrawWorld(&world, cameraPos, cameraAngle);
DrawHUD();
DrawArrow(cameraAngle.y);
DrawRadarDots(true);
DrawRadarArm(sweepAngle * sweepStepCount++);
DrawRadarDots(false);
//finally!
DrawCrackedScreen();
SetTextColor(RED);
DrawText(25,40,reason);
if (--lives<=0) {
SetTextColor(GREEN);
DrawText(30,55,"GAME OVER!");
}
Show();
PlaySound(SOUND_EXPLOSION);
//dead?
if (lives<=0) {
Sleep(2000);
//Reset back to splash screen
ResetTimer();
mode=0;
Splash();
} else {
// Hit but still going
InitialiseWorld();
}
}
示例15: DrawXlibMenu
//根据Menu内容来绘制菜单内容
void DrawXlibMenu(XlibMenu * menu)
{
FcitxSkin *sc = &menu->owner->skin;
FcitxClassicUI *classicui = menu->owner;
Display* dpy = classicui->dpy;
GC gc = XCreateGC(dpy, menu->menuWindow, 0, NULL);
int i = 0;
int fontheight;
int iPosY = 0;
int dpi = sc->skinFont.respectDPI? menu->owner->dpi: 0;
FCITX_UNUSED(dpi);
fontheight = FontHeight(menu->owner->menuFont, sc->skinFont.menuFontSize, dpi);
SkinImage *background = LoadImage(sc, sc->skinMenu.backImg, false);
GetMenuSize(menu);
EnlargeCairoSurface(&menu->menu_cs, menu->width, menu->height);
if (background) {
cairo_t* cr = cairo_create(menu->menu_cs);
DrawResizableBackground(cr, background->image, menu->height, menu->width,
sc->skinMenu.marginLeft,
sc->skinMenu.marginTop,
sc->skinMenu.marginRight,
sc->skinMenu.marginBottom,
sc->skinMenu.fillV,
sc->skinMenu.fillH
);
cairo_destroy(cr);
}
iPosY = sc->skinMenu.marginTop;
for (i = 0; i < utarray_len(&menu->menushell->shell); i++) {
if (GetMenuItem(menu->menushell, i)->type == MENUTYPE_SIMPLE || GetMenuItem(menu->menushell, i)->type == MENUTYPE_SUBMENU) {
DisplayText(menu, i, iPosY, fontheight);
if (menu->menushell->mark == i)
MenuMark(menu, iPosY, i);
if (GetMenuItem(menu->menushell, i)->type == MENUTYPE_SUBMENU)
DrawArrow(menu, iPosY);
iPosY = iPosY + 6 + fontheight;
} else if (GetMenuItem(menu->menushell, i)->type == MENUTYPE_DIVLINE) {
DrawDivLine(menu, iPosY);
iPosY += 5;
}
}
XResizeWindow(dpy, menu->menuWindow, menu->width, menu->height);
_CAIRO_SETSIZE(menu->menu_x_cs, menu->width, menu->height);
cairo_t* c = cairo_create(menu->menu_x_cs);
cairo_set_operator(c, CAIRO_OPERATOR_SOURCE);
cairo_set_source_surface(c, menu->menu_cs, 0, 0);
cairo_rectangle(c, 0, 0, menu->width, menu->height);
cairo_clip(c);
cairo_paint(c);
cairo_destroy(c);
cairo_surface_flush(menu->menu_x_cs);
XFreeGC(dpy, gc);
}