//CONSTRUCTORS Record::Record(int ev, int di, std::string ti, std::string da) { //set members that need no additional computing e = ev; d = di; time = ti; date = da; mins = 0; secs = 0; milis = 0; setStroke(e); setDistance (d); convertStringtoInts(ti); //set the time string from the converted integer values. time = ""; time = mins; time += ":"; time += secs; time += "."; time += milis; }
void StrokeDocker::selectionChanged() { KoCanvasController* canvasController = KoToolManager::instance()->activeCanvasController(); KoSelection *selection = canvasController->canvas()->shapeManager()->selection(); KoShape * shape = selection->firstSelectedShape(); if( shape ) setStroke( shape->border() ); }
KarbonCalligraphicShape::KarbonCalligraphicShape(qreal caps) : m_lastWasFlip(false), m_caps(caps) { setShapeId(KoPathShapeId); setFillRule(Qt::WindingFill); setBackground(QSharedPointer<KoShapeBackground>(new KoColorBackground(QColor(Qt::black)))); setStroke(0); }
void paint() { int width = getWindowWidth(); int height = getWindowHeight(); int radius = min(width, height) / 2; setFill(colorYellow); fillCircle(width / 2, height / 2, radius); setStroke(colorGreen, 10); drawCircle(width / 2, height / 2, radius); setFill(colorYellow); fillEllipse(200, 200, 350, 250); setStroke(colorGreen, 10); drawEllipse(200, 200, 350, 250); setStroke(colorBlue, 2); drawLine(10, 10, _mouseX, _mouseY); if(_pressedChar != 0) { char str[2] = {0}; str[0] = _pressedChar; drawText(100, 100, str, 10, colorWhite, colorBlue); } char str[256] = {0}; sprintf(str, "%d - HELLO COMPUTER", _secondElapsed); drawText(100, 200, str, 70, colorYellow, colorBlue); setFill((_secondElapsed % 2) == 0 ? colorBlue : colorRed); fillRectangle(200, 200, 100, 100); setStroke(colorGreen, 2); drawRectangle(200, 200, 100, 100); }
CCBlade::CCBlade(const char *filePath, float stroke, int pointLimit) : _texture(NULL) { setColor(ccWHITE); setOpacity(255); setTexture(CCTextureCache::sharedTextureCache()->addImage(filePath)); setStroke(stroke); CCAssert(pointLimit >= POINT_LIMIT_MIN, "point limit should be >= POINT_LIMIT_MIN"); _pointLimit = pointLimit; // head point => 1 vertex, body point => 2 vertices, tail point => 1 vertex int vertexCount = 2*pointLimit-2; _vertices = (CGPoint *)calloc(vertexCount, sizeof(CGPoint)); _texCoords = (CGPoint *)calloc(vertexCount, sizeof(CGPoint)); _autoCleanup = false; // shader stuff setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTexture_uColor)); _uniformColor = glGetUniformLocation(getShaderProgram()->getProgram(), "u_color"); }
bool SVGResources::buildCachedResources(const RenderElement& renderer, const RenderStyle& style) { ASSERT(renderer.element()); ASSERT_WITH_SECURITY_IMPLICATION(renderer.element()->isSVGElement()); if (!renderer.element()) return false; auto& element = downcast<SVGElement>(*renderer.element()); Document& document = element.document(); SVGDocumentExtensions& extensions = document.accessSVGExtensions(); const AtomicString& tagName = element.localName(); if (tagName.isNull()) return false; const SVGRenderStyle& svgStyle = style.svgStyle(); bool foundResources = false; if (clipperFilterMaskerTags().contains(tagName)) { if (svgStyle.hasClipper()) { AtomicString id(svgStyle.clipperResource()); if (setClipper(getRenderSVGResourceById<RenderSVGResourceClipper>(document, id))) foundResources = true; else registerPendingResource(extensions, id, element); } if (style.hasFilter()) { const FilterOperations& filterOperations = style.filter(); if (filterOperations.size() == 1) { const FilterOperation& filterOperation = *filterOperations.at(0); if (filterOperation.type() == FilterOperation::REFERENCE) { const auto& referenceFilterOperation = downcast<ReferenceFilterOperation>(filterOperation); AtomicString id = SVGURIReference::fragmentIdentifierFromIRIString(referenceFilterOperation.url(), element.document()); if (setFilter(getRenderSVGResourceById<RenderSVGResourceFilter>(document, id))) foundResources = true; else registerPendingResource(extensions, id, element); } } } if (svgStyle.hasMasker()) { AtomicString id(svgStyle.maskerResource()); if (setMasker(getRenderSVGResourceById<RenderSVGResourceMasker>(document, id))) foundResources = true; else registerPendingResource(extensions, id, element); } } if (markerTags().contains(tagName) && svgStyle.hasMarkers()) { AtomicString markerStartId(svgStyle.markerStartResource()); if (setMarkerStart(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerStartId))) foundResources = true; else registerPendingResource(extensions, markerStartId, element); AtomicString markerMidId(svgStyle.markerMidResource()); if (setMarkerMid(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerMidId))) foundResources = true; else registerPendingResource(extensions, markerMidId, element); AtomicString markerEndId(svgStyle.markerEndResource()); if (setMarkerEnd(getRenderSVGResourceById<RenderSVGResourceMarker>(document, markerEndId))) foundResources = true; else registerPendingResource(extensions, markerEndId, element); } if (fillAndStrokeTags().contains(tagName)) { if (svgStyle.hasFill()) { bool hasPendingResource = false; AtomicString id; if (setFill(paintingResourceFromSVGPaint(document, svgStyle.fillPaintType(), svgStyle.fillPaintUri(), id, hasPendingResource))) foundResources = true; else if (hasPendingResource) registerPendingResource(extensions, id, element); } if (svgStyle.hasStroke()) { bool hasPendingResource = false; AtomicString id; if (setStroke(paintingResourceFromSVGPaint(document, svgStyle.strokePaintType(), svgStyle.strokePaintUri(), id, hasPendingResource))) foundResources = true; else if (hasPendingResource) registerPendingResource(extensions, id, element); } } if (chainableResourceTags().contains(tagName)) { AtomicString id(targetReferenceFromResource(element)); if (setLinkedResource(getRenderSVGResourceContainerById(document, id))) foundResources = true; else registerPendingResource(extensions, id, element); } return foundResources; }
void CGnuPlotStyleRadar:: draw2D(CGnuPlotPlot *plot, CGnuPlotRenderer *renderer) { CGnuPlotRadarStyleValue *value = CGnuPlotStyleValueMgrInst->getValue<CGnuPlotRadarStyleValue>(plot); if (! value) { value = plot->app()->device()->createRadarStyleValue(plot); CGnuPlotStyleValueMgrInst->setValue<CGnuPlotRadarStyleValue>(plot, value); } //--- const CBBox2D &bbox = plot->bbox2D(); CPoint2D pc = bbox.getCenter(); double r = bbox.getWidth()/2; int np = -1; for (const auto &point : plot->getPoints2D()) { np = std::min(np < 0 ? INT_MAX : np, point.getNumValues()); } if (np < 3) return; //double pw = renderer->pixelWidthToWindowWidth (1); //double ph = renderer->pixelHeightToWindowHeight(1); CGnuPlotGroup *group = plot->group(); const CGnuPlotKeyData &keyData = plot->keyData(); const CGnuPlotAxisData &xaxis = group->xaxis(1); const CGnuPlotKey::Columns &columns = keyData.columns(); double da = 360/np; std::vector<CPoint2D> points = radarPoints(value->angleStart(), pc, r, np); double v = getRange(plot); //--- // draw border renderer->drawPolygon(points, value->borderColor(), value->borderWidth(), value->borderDash()); //--- // draw column labels (how determine indices) { double a = value->angleStart(); for (int i = 1; i <= np && i < int(columns.size()); ++i) { CPoint2D p = radarPoint(pc, r, a); CHAlignType halign = CHALIGN_TYPE_CENTER; CVAlignType valign = CVALIGN_TYPE_CENTER; double dx = 0; double dy = 0; if (p.x < pc.x - v/2) { halign = CHALIGN_TYPE_RIGHT; dx = -8; } else if (p.x > pc.x + v/2) { halign = CHALIGN_TYPE_LEFT; dx = 8; } if (p.y < pc.y - v/2) { valign = CVALIGN_TYPE_TOP; dy = 8; } else if (p.y > pc.y + v/2) { valign = CVALIGN_TYPE_BOTTOM; dy = -8; } CRGBA tc = CRGBA(0,0,0); renderer->drawHAlignedText(p, HAlignPos(halign, dx), VAlignPos(valign, dy), columns[i], tc), a -= da; } } //--- // draw axis if needed if (xaxis.isDisplayed()) { CRGBA ac = value->axisColor(); ac.setAlpha(value->axisAlpha()); double dr = 0.1; double ra = 0.1; while (ra < v) { std::vector<CPoint2D> points1 = radarPoints(value->angleStart(), pc, ra, np); renderer->drawPolygon(points1, ac, value->axisWidth(), value->axisDash()); ra += dr; } for (const auto &p : points) renderer->drawLine(p, pc, ac, value->axisWidth(), value->axisDash()); } //--- bool cache = false; if (! renderer->isPseudo() && plot->isCacheActive()) { plot->updatePolygonCacheSize(plot->numPoints2D()); cache = true; } int pi = 0; for (const auto &point : plot->getPoints2D()) { std::vector<CPoint2D> points1; double a = value->angleStart(); for (int i = 0; i < np; ++i) { double v1; if (! point.getValue(i + 1, v1)) continue; CPoint2D p = radarPoint(pc, v1, a); points1.push_back(p); a -= da; } CRGBA lc, fc; getPointsColor(value, pi + 1, lc, fc); if (cache) { //std::string label = (pi < int(columns.size()) ? columns[pi] : ""); std::string label = xaxis.iticLabel(pi); auto polygon = plot->polygonObjects()[pi]; polygon->setPoints(points1); polygon->setTipText(label); if (! polygon->testAndSetUsed()) { CGnuPlotFillP fill (polygon->fill ()->dup()); CGnuPlotStrokeP stroke(polygon->stroke()->dup()); fill->setColor(fc); fill->setType (CGnuPlotTypes::FillType::SOLID); stroke->setColor (lc); stroke->setWidth (value->strokeWidth()); stroke->setLineDash(value->strokeDash()); polygon->setFill (fill ); polygon->setStroke(stroke); } } else { renderer->fillPolygon(points1, fc); renderer->drawPolygon(points1, lc, value->strokeWidth(), value->strokeDash()); } ++pi; } if (cache) { for (const auto &polygon : plot->polygonObjects()) polygon->draw(renderer); } }