本文整理汇总了C++中Pen类的典型用法代码示例。如果您正苦于以下问题:C++ Pen类的具体用法?C++ Pen怎么用?C++ Pen使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pen类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteWithPen
void WriteWithPen(Pen &pen){
cout << pen.drawLine() << endl;
cout << pen.drawCircle() << endl;
}
示例2: Pen_setHsva
/** void Pen::setHsva(float h, float s=1.0, float v=1.0, float a=1.0)
* include/mimas/Pen.h:69
*/
static int Pen_setHsva(lua_State *L) {
try {
Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
int top__ = lua_gettop(L);
if (top__ >= 5) {
float h = dub_checknumber(L, 2);
float s = dub_checknumber(L, 3);
float v = dub_checknumber(L, 4);
float a = dub_checknumber(L, 5);
self->setHsva(h, s, v, a);
return 0;
} else if (top__ >= 4) {
float h = dub_checknumber(L, 2);
float s = dub_checknumber(L, 3);
float v = dub_checknumber(L, 4);
self->setHsva(h, s, v);
return 0;
} else if (top__ >= 3) {
float h = dub_checknumber(L, 2);
float s = dub_checknumber(L, 3);
self->setHsva(h, s);
return 0;
} else {
float h = dub_checknumber(L, 2);
self->setHsva(h);
return 0;
}
} catch (std::exception &e) {
lua_pushfstring(L, "setHsva: %s", e.what());
} catch (...) {
lua_pushfstring(L, "setHsva: Unknown exception");
}
return dub_error(L);
}
示例3: setDirty
CompiledTextStyle Text::textStyle()
{
if(isDirty()) {
setDirty(false);
{
QVariant v = basedOn();
if(v.isValid()) {
QObject *o = styleobjectFromVariant(v);
Text *based_on = qobject_cast<Text*>(o);
if(based_on) {
m_textStyle = based_on->textStyle();
}
}
}
{
Pen* p = pen();
if(p) {
m_textStyle.setPen(p->pen());
}
}
{
Font* p = font();
if(p) {
m_textStyle.setFont(p->font());
}
}
}
return m_textStyle;
}
示例4: RECT2Rect
VOID Button::draw(Graphics *pGraphics, Pen &rPen, SolidBrush &rBrush, CONST Font &/*rFont*/) const
{
rPen.SetColor(Color(5, 159, 225));
rPen.SetWidth(3);
rBrush.SetColor(Color(255, 125, 34));
pGraphics->DrawRectangle(&rPen, RECT2Rect());
//graphics->DrawString(text_.c_str(), text_.length(), &font, PointF(RECT2RectF().GetLeft(), RECT2RectF().GetTop()), &brush);
}
示例5: DrawPolyline
static void
DrawPolyline(Canvas &canvas, PixelOperations operations, const Pen &pen,
const BulkPixelPoint *lppt, unsigned n_points,
bool loop)
{
const unsigned thickness = pen.GetWidth();
const unsigned mask = pen.GetMask();
const auto color = canvas.Import(pen.GetColor());
canvas.DrawPolyline(lppt, n_points, loop, color, thickness, mask);
}
示例6: Point
VOID vec::draw(double x0, double y0, Graphics *graphics, Pen &rPen, CONST Color &rColor /* = Color::Yellow */) const
{
rPen.SetColor(rColor);
rPen.SetWidth(2);
graphics->DrawLine(&rPen, Point(static_cast<INT>(x0 ), static_cast<INT>( y0)), Point(static_cast<INT>(x0 + x_), static_cast<INT>(y_ + y0)));
graphics->DrawLine(&rPen, Point(static_cast<INT>(x0 + x_), static_cast<INT>(y_ + y0)), Point(static_cast<INT>(x0 + x_ - ((l_ < 0)? -1 : 1) * 5 * cos(k_ + M_PI_4)), static_cast<INT>(y_ + y0 - ((l_ < 0)? -1 : 1) * 5 * sin(k_ + M_PI_4))));
graphics->DrawLine(&rPen, Point(static_cast<INT>(x0 + x_), static_cast<INT>(y_ + y0)), Point(static_cast<INT>(x0 + x_ - ((l_ < 0)? -1 : 1) * 5 * cos(k_ - M_PI_4)), static_cast<INT>(y_ + y0 - ((l_ < 0)? -1 : 1) * 5 * sin(k_ - M_PI_4))));
l_ = sqrt(x_ * x_ + y_ * y_);
k_ = atan_(x_, y_);
}
示例7: Pen_setWidth
/** void Pen::setWidth(float w)
* include/mimas/Pen.h:57
*/
static int Pen_setWidth(lua_State *L) {
try {
Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
float w = dub_checknumber(L, 2);
self->setWidth(w);
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "setWidth: %s", e.what());
} catch (...) {
lua_pushfstring(L, "setWidth: Unknown exception");
}
return dub_error(L);
}
示例8: Pen_setColor
/** void Pen::setColor(const Color &color)
* include/mimas/Pen.h:65
*/
static int Pen_setColor(lua_State *L) {
try {
Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
Color *color = *((Color **)dub_checksdata(L, 2, "mimas.Color"));
self->setColor(*color);
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "setColor: %s", e.what());
} catch (...) {
lua_pushfstring(L, "setColor: Unknown exception");
}
return dub_error(L);
}
示例9: gdiplusCreatePen
static Pen * gdiplusCreatePen(UINT style, float width, COLORREF color)
{
// create GDI+ pen
Color gdipColor(0, 0, 0, 255);
gdipColor.SetFromCOLORREF(color);
Pen * pen = new Pen(gdipColor, width > 1 ? width : 1);
if (style <= PS_DASHDOTDOT)
// cast is save since GDI and GDI+ use same numbers
pen->SetDashStyle(static_cast<DashStyle>(style));
pen->SetLineCap(LineCapFlat, LineCapFlat, DashCapFlat);
return pen;
}
示例10: DrawPolyline
static void
DrawPolyline(Canvas &canvas, PixelOperations operations, const Pen &pen,
const RasterPoint *lppt, unsigned n_points,
bool loop)
{
const unsigned thickness = pen.GetWidth();
const unsigned mask = pen.GetMask();
const auto color = canvas.Import(pen.GetColor());
const SDLRasterCanvas::Point *points =
reinterpret_cast<const SDLRasterCanvas::Point *>(lppt);
canvas.DrawPolyline(points, n_points, loop, color, thickness, mask);
}
示例11: Pen_setJoinStyle
/** void Pen::setJoinStyle(int style)
* include/mimas/Pen.h:83
*/
static int Pen_setJoinStyle(lua_State *L) {
try {
Pen *self = *((Pen **)dub_checksdata(L, 1, "mimas.Pen"));
int style = dub_checkint(L, 2);
self->setJoinStyle(style);
return 0;
} catch (std::exception &e) {
lua_pushfstring(L, "setJoinStyle: %s", e.what());
} catch (...) {
lua_pushfstring(L, "setJoinStyle: Unknown exception");
}
return dub_error(L);
}
示例12: oglcontext
void Opengl2dPainter::renderBegin(Pen& pen, Matrix3& matrix)
{
OpenglContext oglcontext(_pPimpl->hdc, _pPimpl->hrc);
glClearColor(pen.color().r/ 255.0, pen.color().g/255.0, pen.color().b/255.0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
Matrix3 m;
m.Rotate( _pPimpl->angle);
_pPimpl->worldMatrix = matrix * m;
}
示例13: paintTile
bool Screen::paintTile(const Pen &pen, int x, int y, bool map)
{
if (!gps || !pen.valid()) return false;
doSetTile(pen, x, y, map);
return true;
}
示例14: draw
VOID Cue::draw(Graphics *pGraphics, Pen &rPen, Image &rCue) const
{
auxiliaryLine_.draw((ball_ - auxiliaryLine_).getX(), (ball_ - auxiliaryLine_).getY(), pGraphics, rPen, static_cast<ARGB>(Color::Gray));
rPen.SetColor(static_cast<ARGB>(Color::Gray));
rPen.SetWidth(3);
pGraphics->DrawEllipse(&rPen, static_cast<INT>(mouse_.getX() - RShari), static_cast<INT>(mouse_.getY() - RShari), RShari * 2, RShari * 2);
pGraphics->TranslateTransform(static_cast<REAL>(ball_.getX()), static_cast<REAL>(ball_.getY()));
pGraphics->RotateTransform(angle_);
ImageAttributes imAttr;
imAttr.SetColorKey(COLOR_KEY, COLOR_KEY);
pGraphics->DrawImage(&rCue, Rect(static_cast<INT>(-884 - force_ * 8), static_cast<INT>(-20 / 2), 884 * 2, 20), 0, 0, 884 * 2, 20, Unit::UnitPixel, &imAttr, 0);
pGraphics->ResetTransform();
}
示例15: DrawPolygon
void DrawPolygon(const Point* points, IN INT count, HDC hdcPaint, DashStyle dashStyle, Color clr, REAL width)
{
Pen* myPen;
Graphics* myGraphics;
myPen = new Pen(clr, width);
if(myPen)
{
myPen->SetDashStyle(dashStyle);
myGraphics = new Graphics(hdcPaint);
if(myGraphics)
{
myGraphics->DrawPolygon(myPen, points, count);
delete myGraphics;
}
delete myPen;
}
}