这篇教程C++ strokeColor函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中strokeColor函数的典型用法代码示例。如果您正苦于以下问题:C++ strokeColor函数的具体用法?C++ strokeColor怎么用?C++ strokeColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了strokeColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: platformContext// Draws a filled rectangle with a stroked border.void GraphicsContext::drawRect(const IntRect& rect){ if (paintingDisabled()) return; CGContextRef context = platformContext(); if (fillColor().alpha()) CGContextFillRect(context, rect); if (strokeStyle() != NoStroke && strokeColor().alpha()) { // We do a fill of four rects to simulate the stroke of a border. Color oldFillColor = fillColor(); if (oldFillColor != strokeColor()) setCGFillColor(context, strokeColor()); CGRect rects[4] = { FloatRect(rect.x(), rect.y(), rect.width(), 1), FloatRect(rect.x(), rect.bottom() - 1, rect.width(), 1), FloatRect(rect.x(), rect.y() + 1, 1, rect.height() - 2), FloatRect(rect.right() - 1, rect.y() + 1, 1, rect.height() - 2) }; CGContextFillRects(context, rects, 4); if (oldFillColor != strokeColor()) setCGFillColor(context, oldFillColor); }}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:27,
示例2: platformContext// Draws a filled rectangle with a stroked border.void GraphicsContext::drawRect(const IntRect& rect){ // FIXME: this function does not handle patterns and gradients // like drawPath does, it probably should. if (paintingDisabled()) return; CGContextRef context = platformContext(); CGContextFillRect(context, rect); if (strokeStyle() != NoStroke) { // We do a fill of four rects to simulate the stroke of a border. Color oldFillColor = fillColor(); if (oldFillColor != strokeColor()) setCGFillColor(context, strokeColor(), strokeColorSpace()); CGRect rects[4] = { FloatRect(rect.x(), rect.y(), rect.width(), 1), FloatRect(rect.x(), rect.bottom() - 1, rect.width(), 1), FloatRect(rect.x(), rect.y() + 1, 1, rect.height() - 2), FloatRect(rect.right() - 1, rect.y() + 1, 1, rect.height() - 2) }; CGContextFillRects(context, rects, 4); if (oldFillColor != strokeColor()) setCGFillColor(context, oldFillColor, fillColorSpace()); }}
开发者ID:dslab-epfl,项目名称:warr,代码行数:28,
示例3: maxvoid GraphicsContext::drawLineForText(const IntPoint& point, int width, bool printing){ if (paintingDisabled()) return; if (width <= 0) return; float x = point.x(); float y = point.y(); float lineLength = width; // Use a minimum thickness of 0.5 in user space. // See http://bugs.webkit.org/show_bug.cgi?id=4255 for details of why 0.5 is the right minimum thickness to use. float thickness = max(strokeThickness(), 0.5f); bool restoreAntialiasMode = false; if (!printing) { // On screen, use a minimum thickness of 1.0 in user space (later rounded to an integral number in device space). float adjustedThickness = max(thickness, 1.0f); // FIXME: This should be done a better way. // We try to round all parameters to integer boundaries in device space. If rounding pixels in device space // makes our thickness more than double, then there must be a shrinking-scale factor and rounding to pixels // in device space will make the underlines too thick. CGRect lineRect = roundToDevicePixels(FloatRect(x, y, lineLength, adjustedThickness)); if (lineRect.size.height < thickness * 2.0) { x = lineRect.origin.x; y = lineRect.origin.y; lineLength = lineRect.size.width; thickness = lineRect.size.height; if (shouldAntialias()) { CGContextSetShouldAntialias(platformContext(), false); restoreAntialiasMode = true; } } } if (fillColor() != strokeColor()) setCGFillColor(platformContext(), strokeColor(), strokeColorSpace()); CGContextFillRect(platformContext(), CGRectMake(x, y, lineLength, thickness)); if (fillColor() != strokeColor()) setCGFillColor(platformContext(), fillColor(), fillColorSpace()); if (restoreAntialiasMode) CGContextSetShouldAntialias(platformContext(), true);}
开发者ID:dslab-epfl,项目名称:warr,代码行数:48,
示例4: localStrokeColorvoid GraphicsContext::drawLinesForText(const FloatPoint& point, const DashArray& widths, bool printing, bool doubleUnderlines){ if (paintingDisabled()) return; if (widths.size() <= 0) return; Color localStrokeColor(strokeColor()); bool shouldAntialiasLine; FloatRect bounds = computeLineBoundsAndAntialiasingModeForText(point, widths.last(), printing, shouldAntialiasLine, localStrokeColor); Vector<FloatRect, 4> dashBounds; ASSERT(!(widths.size() % 2)); dashBounds.reserveInitialCapacity(dashBounds.size() / 2); for (size_t i = 0; i < widths.size(); i += 2) dashBounds.append(FloatRect(FloatPoint(bounds.x() + widths[i], bounds.y()), FloatSize(widths[i+1] - widths[i], bounds.height()))); if (doubleUnderlines) { // The space between double underlines is equal to the height of the underline for (size_t i = 0; i < widths.size(); i += 2) dashBounds.append(FloatRect(FloatPoint(bounds.x() + widths[i], bounds.y() + 2 * bounds.height()), FloatSize(widths[i+1] - widths[i], bounds.height()))); } cairo_t* cr = platformContext()->cr(); cairo_save(cr); for (auto& dash : dashBounds) fillRectWithColor(cr, dash, localStrokeColor); cairo_restore(cr);}
开发者ID:ddxxyy,项目名称:webkit,代码行数:33,
示例5: cairo_savevoid GraphicsContext::drawConvexPolygon(size_t npoints, const FloatPoint* points, bool shouldAntialias){ if (paintingDisabled()) return; if (npoints <= 1) return; cairo_t* cr = m_data->cr; cairo_save(cr); cairo_set_antialias(cr, shouldAntialias ? CAIRO_ANTIALIAS_DEFAULT : CAIRO_ANTIALIAS_NONE); cairo_move_to(cr, points[0].x(), points[0].y()); for (size_t i = 1; i < npoints; i++) cairo_line_to(cr, points[i].x(), points[i].y()); cairo_close_path(cr); if (fillColor().alpha()) { setColor(cr, fillColor()); cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD); cairo_fill_preserve(cr); } if (strokeStyle() != NoStroke) { setColor(cr, strokeColor()); cairo_set_line_width(cr, strokeThickness()); cairo_stroke(cr); } cairo_new_path(cr); cairo_restore(cr);}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:32,
示例6: switchvoid GraphicsContext::strokePath(){ if (paintingDisabled()) return; QPainter *p = m_data->p(); QPen pen = p->pen(); QPainterPath path = m_data->currentPath; switch (m_common->state.strokeColorSpace) { case SolidColorSpace: if (strokeColor().alpha()) p->strokePath(path, pen); break; case PatternColorSpace: { TransformationMatrix affine; pen.setBrush(QBrush(m_common->state.strokePattern->createPlatformPattern(affine))); p->setPen(pen); p->strokePath(path, pen); break; } case GradientColorSpace: { QGradient* gradient = m_common->state.strokeGradient->platformGradient(); *gradient = applySpreadMethod(*gradient, spreadMethod()); pen.setBrush(QBrush(*gradient)); p->setPen(pen); p->strokePath(path, pen); break; } } m_data->currentPath = QPainterPath();}
开发者ID:Katarzynasrom,项目名称:patch-hosting-for-android-x86-support,代码行数:32,
示例7: platformContext// This method is only used to draw the little circles used in lists.void GraphicsContext::drawEllipse(const IntRect& rect){ if (paintingDisabled()) return; cairo_t* cr = platformContext()->cr(); cairo_save(cr); float yRadius = .5 * rect.height(); float xRadius = .5 * rect.width(); cairo_translate(cr, rect.x() + xRadius, rect.y() + yRadius); cairo_scale(cr, xRadius, yRadius); cairo_arc(cr, 0., 0., 1., 0., 2 * piFloat); cairo_restore(cr); if (fillColor().alpha()) { setSourceRGBAFromColor(cr, fillColor()); cairo_fill_preserve(cr); } if (strokeStyle() != NoStroke) { setSourceRGBAFromColor(cr, strokeColor()); cairo_set_line_width(cr, strokeThickness()); cairo_stroke(cr); } else cairo_new_path(cr);}
开发者ID:ZeusbaseWeb,项目名称:webkit,代码行数:27,
示例8: strokeWidthvoid ScreenPainter::setupState(bool rect){ if (selected() && rect) { // we are drawing a selection rect QColor color = qApp->palette().color(QPalette::Active, QPalette::Highlight); m_painter->setBrush(color); m_painter->setPen(color, strokeWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); } else if (selected()) { // we are drawing selected text QColor color = qApp->palette().color(QPalette::Active, QPalette::HighlightedText); m_painter->setBrush(color); m_painter->setPen(color, strokeWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); } else { QColor tmp; if (m_fillColor != fillColor()) { m_item->SetQColor(&tmp, fillColor().color, fillColor().shade); m_fillQColor = tmp; m_fillColor = fillColor(); } if (m_strokeColor != strokeColor()) { m_item->SetQColor(&tmp, strokeColor().color, strokeColor().shade); m_fillStrokeQColor = tmp; m_strokeColor = strokeColor(); } m_painter->setBrush(m_fillQColor); m_painter->setPen(m_fillStrokeQColor, strokeWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); } m_painter->translate(x(), y()); if (scaleH() != 1.0 || scaleV() != 1.0) m_painter->scale(scaleH(), scaleV()); if (matrix() != QTransform()) { m_painter->setWorldMatrix(matrix() * m_painter->worldMatrix()); }}
开发者ID:alanz,项目名称:scribus,代码行数:44,
示例9: cairo_savevoid GraphicsContext::strokePath(){ if (paintingDisabled()) return; cairo_t* cr = m_data->cr; cairo_save(cr); switch (m_common->state.strokeColorSpace) { case SolidColorSpace: if (strokeColor().alpha()) { setColor(cr, strokeColor()); if (m_common->state.globalAlpha < 1.0f) { cairo_push_group(cr); cairo_paint_with_alpha(cr, m_common->state.globalAlpha); cairo_pop_group_to_source(cr); } cairo_stroke(cr); } break; case PatternColorSpace: { AffineTransform affine; cairo_set_source(cr, m_common->state.strokePattern->createPlatformPattern(affine)); if (m_common->state.globalAlpha < 1.0f) { cairo_push_group(cr); cairo_paint_with_alpha(cr, m_common->state.globalAlpha); cairo_pop_group_to_source(cr); } cairo_stroke(cr); break; } case GradientColorSpace: cairo_pattern_t* pattern = m_common->state.strokeGradient->platformGradient(); pattern = applySpreadMethod(pattern, spreadMethod()); cairo_set_source(cr, pattern); if (m_common->state.globalAlpha < 1.0f) { cairo_push_group(cr); cairo_paint_with_alpha(cr, m_common->state.globalAlpha); cairo_pop_group_to_source(cr); } cairo_stroke(cr); break; } cairo_restore(cr);}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:44,
示例10: platformContextvoid GraphicsContext::strokeArc(const IntRect& rect, int startAngle, int angleSpan){ if (paintingDisabled() || strokeStyle() == NoStroke) return; int x = rect.x(); int y = rect.y(); float w = rect.width(); float h = rect.height(); float scaleFactor = h / w; float reverseScaleFactor = w / h; float hRadius = w / 2; float vRadius = h / 2; float fa = startAngle; float falen = fa + angleSpan; cairo_t* cr = platformContext()->cr(); cairo_save(cr); if (w != h) cairo_scale(cr, 1., scaleFactor); cairo_arc_negative(cr, x + hRadius, (y + vRadius) * reverseScaleFactor, hRadius, -fa * M_PI/180, -falen * M_PI/180); if (w != h) cairo_scale(cr, 1., reverseScaleFactor); int patternWidth = 0; switch (strokeStyle()) { case DottedStroke: patternWidth = floorf(strokeThickness() / 2.f); break; case DashedStroke: patternWidth = 3 * floorf(strokeThickness() / 2.f); break; default: break; } setSourceRGBAFromColor(cr, strokeColor()); if (patternWidth) { float distance = 0; if (hRadius == vRadius) distance = (piFloat * hRadius) / 2.f; else // We are elliptical and will have to estimate the distance distance = (piFloat * sqrtf((hRadius * hRadius + vRadius * vRadius) / 2.f)) / 2.f; double patternOffset = calculateStrokePatternOffset(floorf(distance), patternWidth); double patternWidthAsDouble = patternWidth; cairo_set_dash(cr, &patternWidthAsDouble, 1, patternOffset); } cairo_stroke(cr); cairo_restore(cr);}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:56,
示例11: GraphicsContextPlatformPrivatevoid GraphicsContext::platformInit(CGContextRef cgContext){ m_data = new GraphicsContextPlatformPrivate(cgContext); setPaintingDisabled(!cgContext); if (cgContext) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor(), fillColorSpace()); setPlatformStrokeColor(strokeColor(), strokeColorSpace()); }}
开发者ID:dslab-epfl,项目名称:warr,代码行数:10,
示例12: m_commonGraphicsContext::GraphicsContext(CGContextRef cgContext) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate(cgContext)){ setPaintingDisabled(!cgContext); if (cgContext) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor()); setPlatformStrokeColor(strokeColor()); }}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:11,
示例13: ASSERT// Draws a filled rectangle with a stroked border.void GraphicsContext::drawRect(const IntRect& rect){ if (paintingDisabled()) return; ASSERT(!rect.isEmpty()); save(); m_data->context->SetPen(wxPen(strokeColor(), strokeThickness(), strokeStyleToWxPenStyle(strokeStyle()))); m_data->context->DrawRectangle(rect.x(), rect.y(), rect.width(), rect.height()); restore();}
开发者ID:dog-god,项目名称:iptv,代码行数:13,
示例14: GraphicsContextPlatformPrivatevoid GraphicsContext::platformInit(HDC hdc, bool hasAlpha){ m_data = new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha)); CGContextRelease(m_data->m_cgContext.get()); m_data->m_hdc = hdc; setPaintingDisabled(!m_data->m_cgContext); if (m_data->m_cgContext) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor(), ColorSpaceDeviceRGB); setPlatformStrokeColor(strokeColor(), ColorSpaceDeviceRGB); }}
开发者ID:3163504123,项目名称:phantomjs,代码行数:12,
示例15: cairo_savevoid GraphicsContext::strokeRect(const FloatRect& rect, float width){ if (paintingDisabled()) return; cairo_t* cr = m_data->cr; cairo_save(cr); cairo_rectangle(cr, rect.x(), rect.y(), rect.width(), rect.height()); setColor(cr, strokeColor()); cairo_set_line_width(cr, width); cairo_stroke(cr); cairo_restore(cr);}
开发者ID:acss,项目名称:owb-mirror,代码行数:13,
示例16: m_commonGraphicsContext::GraphicsContext(HDC hdc, bool hasAlpha) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha))){ CGContextRelease(m_data->m_cgContext); m_data->m_hdc = hdc; setPaintingDisabled(!m_data->m_cgContext); if (m_data->m_cgContext) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor()); setPlatformStrokeColor(strokeColor()); }}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:13,
示例17: GraphicsContextPlatformPrivatevoid GraphicsContext::platformInit(HDC hdc, bool hasAlpha){ if (!hdc) return; m_data = new GraphicsContextPlatformPrivate(CGContextWithHDC(hdc, hasAlpha)); CGContextRelease(m_data->m_cgContext.get()); m_data->m_hdc = hdc; if (m_data->m_cgContext) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor()); setPlatformStrokeColor(strokeColor()); }}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:14,
示例18: m_commonGraphicsContext::GraphicsContext(PlatformGraphicsContext* context) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate){ setPaintingDisabled(!context); if (context) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor(), DeviceColorSpace); setPlatformStrokeColor(strokeColor(), DeviceColorSpace); }#if USE(WXGC) m_data->context = (wxGCDC*)context;#else m_data->context = (wxWindowDC*)context;#endif}
开发者ID:flying-dutchmen,项目名称:3DS_w3Browser,代码行数:16,
示例19: createCairoContextWithHDCvoid GraphicsContext::platformInit(HDC dc, bool hasAlpha){ cairo_t* cr = 0; if (dc) cr = createCairoContextWithHDC(dc, hasAlpha); else setPaintingDisabled(true); m_data = new GraphicsContextPlatformPrivateToplevel(new PlatformContextCairo(cr)); m_data->m_hdc = dc; if (platformContext()->cr()) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor(), fillColorSpace()); setPlatformStrokeColor(strokeColor(), strokeColorSpace()); }}
开发者ID:Xertz,项目名称:EAWebKit,代码行数:16,
示例20: m_commonGraphicsContext::GraphicsContext(HDC dc, bool hasAlpha) : m_common(createGraphicsContextPrivate()) , m_data(new GraphicsContextPlatformPrivate){ if (dc) { cairo_surface_t* surface = cairo_win32_surface_create(dc); m_data->cr = cairo_create(surface); m_data->m_hdc = dc; } else { setPaintingDisabled(true); m_data->cr = 0; m_data->m_hdc = 0; } if (m_data->cr) { // Make sure the context starts in sync with our state. setPlatformFillColor(fillColor()); setPlatformStrokeColor(strokeColor()); }}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:20,
注:本文中的strokeColor函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ strokeStyle函数代码示例 C++ stroke函数代码示例 |