bool render(const Tile& tile,const std::vector<RoadSegment>& segments,agg::rendering_buffer& rbuf) { typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base; typedef agg::renderer_outline_aa<ren_base> renderer_oaa; typedef agg::rasterizer_outline_aa<renderer_oaa> rasterizer_outline_aa; typedef agg::renderer_scanline_aa_solid<ren_base> renderer; agg::pixfmt_rgba32 pixf(rbuf); ren_base renb(pixf); renderer ren(renb); agg::rasterizer_scanline_aa<> ras; agg::scanline_p8 sl; unsigned i = 0; for (i=0; i < segments.size(); i++) { RoadSegment rseg = segments[i]; Segment seg = rseg.convertToSegment(tile); ren.color(seg.getColor()); agg::path_storage path; path.move_to(seg.getFromPoint().getX(), seg.getFromPoint().getY()); path.line_to(seg.getToPoint().getX(), seg.getToPoint().getY()); agg::conv_stroke<agg::path_storage> stroke(path); stroke.width(seg.getStrokeWidth()); agg::line_cap_e cap = agg::round_cap; agg::line_join_e join = agg::round_join; stroke.line_join(join); stroke.line_cap(cap); ras.reset(); ras.add_path(stroke); agg::render_scanlines(ras,sl,ren); } return true; }
int main() { const char *filename = "1.jpg"; IplImage *pStroke = getStroke(filename); IplImage *pTone = getTone(filename); Image stroke(pStroke); Image tone(pTone); cvShowImage("stroke", pStroke); cvShowImage("tone", pTone); //合并stroke与tone两张图 for (int i = 0; i < stroke.getH(); i++) for (int j = 0; j < stroke.getW(); j++) stroke[i][j] = (uchar) sqrt(stroke[i][j] * tone[i][j]); cvShowImage("result", pStroke); cvWaitKey(); cvDestroyAllWindows(); cvReleaseImage(&pStroke); cvReleaseImage(&pTone); }
void KisStrokeTest::testCancelStrokeCase1() { KisStroke stroke(new KisTestingStrokeStrategy()); QQueue<KisStrokeJob*> &queue = stroke.testingGetQueue(); stroke.addJob(0); // "not initialized, has jobs" QCOMPARE(queue.size(), 2); SCOMPARE(getJobName(queue[0]), "init"); SCOMPARE(getJobName(queue[1]), "dab"); QCOMPARE(stroke.isEnded(), false); stroke.cancelStroke(); QCOMPARE(queue.size(), 0); QCOMPARE(stroke.isEnded(), true); stroke.clearQueue(); }
NAMESPACE_UPP //typedef agg::renderer_base<pixfmt> renderer_base; //typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid; void AggDrawer::DrawLine(int x1, int y1, int x2, int y2, int width) { // m_renb.clip_box( m_clipboxdev.x, m_clipboxdev.y, m_clipboxdev.x + m_clipboxdev.width, m_clipboxdev.y + m_clipboxdev.height); agg::path_storage path; path.move_to(x1, y1); path.line_to(x2, y2); agg::conv_stroke<agg::path_storage> stroke(path); // stroke.line_join(); // stroke.line_cap(); stroke.line_cap(agg::round_cap); //stroke.miter_limit(); stroke.width(width); m_ras.add_path(stroke); // RenderScanlines(); // at the end or after all same color? }
void drawYearLabels() { char yearstr[10]; setFont(gse7x11); stroke(224, 224, 224, 255); strokeWeight(1); fill(pBlack); //textSize(10); textAlign(TX_CENTER, TX_TOP); for (int row = 0; row < rowCount; row++) { if (data[row].year % yearInterval == 0) { float x = MAP(data[row].year, yearMin, yearMax, plotX1, plotX2); sprintf_s(yearstr, "%4d", data[row].year); text(yearstr, x, plotY2 + 10); line(x, plotY1, x, plotY2); } } }
void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) { int count = pointCount<<1; QVarLengthArray<qreal> pts(count); #ifdef Q_WS_MAC for (int i=0; i<count; i+=2) { pts[i] = ((int *) points)[i+1]; pts[i+1] = ((int *) points)[i]; } #else for (int i=0; i<count; ++i) pts[i] = ((int *) points)[i]; #endif QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode)); if (mode == PolylineMode) stroke(path, state()->pen); else draw(path); }
void draw() { background(224,224,224,255); //background(pLightGray); //background(aliceblue); // plot area as white box fill(255); rectMode(CORNERS); noStroke(); rect(plotX1, plotY1, plotX2, plotY2); drawTitle(); // plot the actual columnar data stroke(0x56, 0x79, 0xc1, 255); strokeWeight(5); drawDataPoints(currentColumn); drawYearLabels(); drawVolumeLabels(); drawAxisLabels(); }
const GrStencilAndCoverTextContext::TextBlob& GrStencilAndCoverTextContext::findOrCreateTextBlob(const SkTextBlob* skBlob, const SkPaint& skPaint) { // The font-related parameters are baked into the text blob and will override this skPaint, so // the only remaining properties that can affect a TextBlob are the ones related to stroke. if (SkPaint::kFill_Style == skPaint.getStyle()) { // Fast path. if (TextBlob** found = fBlobIdCache.find(skBlob->uniqueID())) { fLRUList.remove(*found); fLRUList.addToTail(*found); return **found; } TextBlob* blob = new TextBlob(skBlob->uniqueID(), skBlob, skPaint, fContext, &fSurfaceProps); this->purgeToFit(*blob); fBlobIdCache.set(skBlob->uniqueID(), blob); fLRUList.addToTail(blob); fCacheSize += blob->cpuMemorySize(); return *blob; } else { GrStrokeInfo stroke(skPaint); SkSTArray<4, uint32_t, true> key; key.reset(1 + stroke.computeUniqueKeyFragmentData32Cnt()); key[0] = skBlob->uniqueID(); stroke.asUniqueKeyFragment(&key[1]); if (TextBlob** found = fBlobKeyCache.find(key)) { fLRUList.remove(*found); fLRUList.addToTail(*found); return **found; } TextBlob* blob = new TextBlob(key, skBlob, skPaint, fContext, &fSurfaceProps); this->purgeToFit(*blob); fBlobKeyCache.set(blob); fLRUList.addToTail(blob); fCacheSize += blob->cpuMemorySize(); return *blob; } }
/** * Paint the BarGraph */ void BarGraph::paint(void) { char outStr[25]; char outValueStr[6]; //draw bargraph Background and outine stroke(fgColorR, fgColorG, fgColorB); fill(bgColorR, bgColorG, bgColorB); rect(xLocation, yLocation, graphWidth, graphHeight); //draw the bargraph label and value dtostrf(currValue, 5, 1, outValueStr); sprintf(outStr,"%s %s", graphLabel, outValueStr); text(outStr, xLocation, yLocation-10); //draw the bar noStroke(); fill(fgColorR, fgColorG, fgColorB); rect(xLocation, yLocation, valueClamped * ((float)graphWidth / (maxValue - minValue)), graphHeight); }
//------------------------------------------------------------------------ void generate_pattern() { unsigned size = unsigned(m_pattern_size.value()); create_star(m_pattern_size.value() / 2.0, m_pattern_size.value() / 2.0, m_pattern_size.value() / 2.5, m_pattern_size.value() / 6.0, 6, m_pattern_angle.value()); agg::conv_smooth_poly1_curve<agg::path_storage> smooth(m_ps); agg::conv_stroke<agg::conv_smooth_poly1_curve<agg::path_storage> > stroke(smooth); smooth.smooth_value(1.0); smooth.approximation_scale(4.0); stroke.width(m_pattern_size.value() / 15.0); delete [] m_pattern; m_pattern = new agg::int8u[size * size * pixfmt::pix_width]; m_pattern_rbuf.attach(m_pattern, size, size, size * pixfmt::pix_width); pixfmt pixf(m_pattern_rbuf); agg::renderer_base<pixfmt> rb(pixf); agg::renderer_scanline_aa_solid<agg::renderer_base<pixfmt> > rs(rb); rb.clear(agg::rgba_pre(0.4, 0.0, 0.1, m_pattern_alpha.value())); // Pattern background color m_ras.add_path(smooth); rs.color(agg::srgba8(110,130,50)); agg::render_scanlines(m_ras, m_sl, rs); m_ras.add_path(stroke); rs.color(agg::srgba8(0,50,80)); agg::render_scanlines(m_ras, m_sl, rs); }
void Compat::RotoLayerSerialization::convertRotoLayerSerialization(SERIALIZATION_NAMESPACE::KnobTableItemSerialization* outSerialization) { Compat::RotoItemSerialization::convertRotoItemSerialization(outSerialization); outSerialization->verbatimTag = kSerializationRotoGroupTag; for (std::list <boost::shared_ptr<Compat::RotoItemSerialization> >::const_iterator it = children.begin(); it != children.end(); ++it) { Compat::BezierSerialization* isBezier = dynamic_cast<Compat::BezierSerialization*>(it->get()); Compat::RotoLayerSerialization* isLayer = dynamic_cast<Compat::RotoLayerSerialization*>(it->get()); Compat::RotoStrokeItemSerialization* isStroke = dynamic_cast<Compat::RotoStrokeItemSerialization*>(it->get()); if (isBezier) { SERIALIZATION_NAMESPACE::BezierSerializationPtr bezier(new SERIALIZATION_NAMESPACE::BezierSerialization(isBezier->_isOpenBezier)); isBezier->convertBezierSerialization(bezier.get()); outSerialization->children.push_back(bezier); } else if (isLayer) { SERIALIZATION_NAMESPACE::KnobTableItemSerializationPtr layer(new SERIALIZATION_NAMESPACE::KnobTableItemSerialization); isLayer->convertRotoItemSerialization(layer.get()); outSerialization->children.push_back(layer); } else if (isStroke) { SERIALIZATION_NAMESPACE::RotoStrokeItemSerializationPtr stroke(new SERIALIZATION_NAMESPACE::RotoStrokeItemSerialization); isStroke->convertStrokeSerialization(stroke.get()); outSerialization->children.push_back(stroke); } } } // convertRotoLayerSerialization
Status GraphicsPath::AddCurve( const PointF* points, INT count ) { if ( !points || count <= 0 ) return SetStatus( InvalidParameter ); // Add the first point: agg::path_storage poly; poly.move_to( points[ 0 ].X, points[ 0 ].Y ); // Loop over the points, adding them to the path storage: for ( int i = 1; i < count; i++ ) poly.line_to( points[ i ].X, points[ i ].Y ); typedef agg::conv_bspline< agg::path_storage > conv_bspline_type; conv_bspline_type bspline( poly ); bspline.interpolation_step( 1.0 / (double)( 20.0 ) ); typedef agg::conv_stroke< conv_bspline_type > conv_stroke_type; conv_stroke_type stroke( bspline ); // Add the spline to the path: mPathStorage.concat_path( stroke, 0 ); return SetStatus( Ok ); }
// Create a list of example strokes. The path of each one consists as a single arc; // each arc corresponds to an arc in the stroke-path from example1(). vector<shared_ptr<Stroke>> Stroke::example2(const shared_ptr<StrokeShader>& shader) { float start_angle = M_PI*7/6; Sketchy::Geom::Point2d start_pos(-110.0f, -110.0); std::vector<float> radii{150.0, 90.0, 30.0, 45.0, 120.0}; std::vector<float> end_angles{M_PI/2, M_PI/-2, M_PI*5/-4, M_PI*-1, 3.}; auto path = Sketchy::Geom::Arc::piecewisePath(start_angle, start_pos, radii, end_angles); // Use distinct colors for each stroke. vector<GLfloat> rgbs { 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat color[4]; color[3] = 1.0f; std::vector<shared_ptr<Stroke>> results; for (auto& arc : path) { std::vector<Sketchy::Geom::Arc> oneArcPath; oneArcPath.push_back(arc); auto rawStroke = new Stroke(oneArcPath, shader); shared_ptr<Stroke> stroke(rawStroke); color[0] = rgbs.back(); rgbs.pop_back(); color[1] = rgbs.back(); rgbs.pop_back(); color[2] = rgbs.back(); rgbs.pop_back(); stroke->setColor(color); stroke->setWidth(5.f); results.push_back(stroke); } return results; }
void accelDisplay(float x) { //scale x position of -1.5 to 1.5 G's to 300 pixels /*stroke(0,255,255); fill(0,255,255); char thechar[7]; fmtDouble(x, 2, thechar, 7); text(thechar, 155, 210, 12);*/ int xplot=x*10*160/15; stroke(0,0,0); fill(0,0,0); ellipse(160 + o_x, 230, 6, 6); //erase old stroke(0,255,255); fill(0,255,255); ellipse((160 + xplot), 230, 6, 6); //draw new o_x = xplot; //set old position if (o_x > x_peak_pos) { stroke(0,0,0); fill(0,0,0); rect(160 + x_peak_pos - 35, 193, 45, 11); //erase old text ellipse(160 + x_peak_pos, 210, 2, 5); //erase old stroke(255,255,0); fill(255,255,0); x_peak_pos=o_x; ellipse(160 + x_peak_pos, 210, 2, 5); //draw new char thechar[7]; fmtDouble(x, 2, thechar, 7); text(thechar, 160 + x_peak_pos - 30, 200, 10); //draw new text } if (o_x < x_peak_neg) { stroke(0,0,0); fill(0,0,0); rect(160 + x_peak_neg - 5, 193, 45, 11); //erase old tex ellipse(160 + x_peak_neg, 210, 2, 5); //erase old stroke(255,255,0); fill(255,255,0); x_peak_neg=o_x; ellipse(160 + x_peak_neg, 210, 2, 5); //draw new char thechar[7]; fmtDouble(x, 2, thechar, 7); text(thechar, 160 + x_peak_neg, 200, 10); //draw new text } return; }
// used to draw 3d inset round rects void graphics_api::draw3dCircleHelper(MWCOORD x0, MWCOORD y0, MWCOORD r, int cornername, MWCOLORVAL crTop, MWCOLORVAL crBottom) { MWCOORD f = 1 - r; MWCOORD ddF_x = 1; MWCOORD ddF_y = -2 * r; MWCOORD x = 0; MWCOORD y = r; while (x<y) { if (f >= 0) { y--; ddF_y += 2; f += ddF_y; } x++; ddF_x += 2; f += ddF_x; if (cornername & 0x4) { // bottom right corner stroke(crTop); drawPoint(x0 + x, y0 + y); // right center bottom drawPoint(x0 + y, y0 + x); // bottom right center } if (cornername & 0x2) { // top right corner stroke((x >= y)? crBottom: crTop); drawPoint(x0 + x, y0 - y); // right center top stroke((x >= y)? crTop: crBottom); drawPoint(x0 + y, y0 - x); // top right center } if (cornername & 0x8) { // bottom left corner stroke((x >= y)? crBottom: crTop); drawPoint(x0 - y, y0 + x); // bottom left center stroke((x >= y)? crTop: crBottom); drawPoint(x0 - x, y0 + y); // left center bottom } if (cornername & 0x1) { // top left corner stroke(crTop); drawPoint(x0 - y, y0 - x); // top left center drawPoint(x0 - x, y0 - y); // left center top } } }
int Context2D::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: changed((*reinterpret_cast< const QImage(*)>(_a[1]))); break; case 1: save(); break; case 2: restore(); break; case 3: scale((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); break; case 4: rotate((*reinterpret_cast< qreal(*)>(_a[1]))); break; case 5: translate((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); break; case 6: transform((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])),(*reinterpret_cast< qreal(*)>(_a[6]))); break; case 7: setTransform((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])),(*reinterpret_cast< qreal(*)>(_a[6]))); break; case 8: { CanvasGradient _r = createLinearGradient((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); if (_a[0]) *reinterpret_cast< CanvasGradient*>(_a[0]) = _r; } break; case 9: { CanvasGradient _r = createRadialGradient((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])),(*reinterpret_cast< qreal(*)>(_a[6]))); if (_a[0]) *reinterpret_cast< CanvasGradient*>(_a[0]) = _r; } break; case 10: clearRect((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); break; case 11: fillRect((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); break; case 12: strokeRect((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); break; case 13: beginPath(); break; case 14: closePath(); break; case 15: moveTo((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); break; case 16: lineTo((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); break; case 17: quadraticCurveTo((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); break; case 18: bezierCurveTo((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])),(*reinterpret_cast< qreal(*)>(_a[6]))); break; case 19: arcTo((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5]))); break; case 20: rect((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); break; case 21: arc((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])),(*reinterpret_cast< bool(*)>(_a[6]))); break; case 22: fill(); break; case 23: stroke(); break; case 24: clip(); break; case 25: { bool _r = isPointInPath((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2]))); if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; case 26: drawImage((*reinterpret_cast< DomImage*(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3]))); break; case 27: drawImage((*reinterpret_cast< DomImage*(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5]))); break; case 28: drawImage((*reinterpret_cast< DomImage*(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4])),(*reinterpret_cast< qreal(*)>(_a[5])),(*reinterpret_cast< qreal(*)>(_a[6])),(*reinterpret_cast< qreal(*)>(_a[7])),(*reinterpret_cast< qreal(*)>(_a[8])),(*reinterpret_cast< qreal(*)>(_a[9]))); break; case 29: { ImageData _r = getImageData((*reinterpret_cast< qreal(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3])),(*reinterpret_cast< qreal(*)>(_a[4]))); if (_a[0]) *reinterpret_cast< ImageData*>(_a[0]) = _r; } break; case 30: putImageData((*reinterpret_cast< ImageData(*)>(_a[1])),(*reinterpret_cast< qreal(*)>(_a[2])),(*reinterpret_cast< qreal(*)>(_a[3]))); break; default: ; } _id -= 31; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< qreal*>(_v) = globalAlpha(); break; case 1: *reinterpret_cast< QString*>(_v) = globalCompositeOperation(); break; case 2: *reinterpret_cast< QVariant*>(_v) = strokeStyle(); break; case 3: *reinterpret_cast< QVariant*>(_v) = fillStyle(); break; case 4: *reinterpret_cast< qreal*>(_v) = lineWidth(); break; case 5: *reinterpret_cast< QString*>(_v) = lineCap(); break; case 6: *reinterpret_cast< QString*>(_v) = lineJoin(); break; case 7: *reinterpret_cast< qreal*>(_v) = miterLimit(); break; case 8: *reinterpret_cast< qreal*>(_v) = shadowOffsetX(); break; case 9: *reinterpret_cast< qreal*>(_v) = shadowOffsetY(); break; case 10: *reinterpret_cast< qreal*>(_v) = shadowBlur(); break; case 11: *reinterpret_cast< QString*>(_v) = shadowColor(); break; } _id -= 12; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setGlobalAlpha(*reinterpret_cast< qreal*>(_v)); break; case 1: setGlobalCompositeOperation(*reinterpret_cast< QString*>(_v)); break; case 2: setStrokeStyle(*reinterpret_cast< QVariant*>(_v)); break; case 3: setFillStyle(*reinterpret_cast< QVariant*>(_v)); break; case 4: setLineWidth(*reinterpret_cast< qreal*>(_v)); break; case 5: setLineCap(*reinterpret_cast< QString*>(_v)); break; case 6: setLineJoin(*reinterpret_cast< QString*>(_v)); break; case 7: setMiterLimit(*reinterpret_cast< qreal*>(_v)); break; case 8: setShadowOffsetX(*reinterpret_cast< qreal*>(_v)); break; case 9: setShadowOffsetY(*reinterpret_cast< qreal*>(_v)); break; case 10: setShadowBlur(*reinterpret_cast< qreal*>(_v)); break; case 11: setShadowColor(*reinterpret_cast< QString*>(_v)); break; } _id -= 12; } else if (_c == QMetaObject::ResetProperty) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 12; } #endif // QT_NO_PROPERTIES return _id; }
void grid_renderer<T>::process(line_symbolizer const& sym, Feature const& feature, proj_transform const& prj_trans) { typedef coord_transform2<CoordTransform,geometry_type> path_type; typedef agg::renderer_base<mapnik::pixfmt_gray16> ren_base; typedef agg::renderer_scanline_bin_solid<ren_base> renderer; agg::scanline_bin sl; grid_rendering_buffer buf(pixmap_.raw_data(), width_, height_, width_); mapnik::pixfmt_gray16 pixf(buf); ren_base renb(pixf); renderer ren(renb); ras_ptr->reset(); stroke const& stroke_ = sym.get_stroke(); for (unsigned i=0;i<feature.num_geometries();++i) { geometry_type const& geom = feature.get_geometry(i); if (geom.num_points() > 1) { path_type path(t_,geom,prj_trans); if (stroke_.has_dash()) { agg::conv_dash<path_type> dash(path); dash_array const& d = stroke_.get_dash_array(); dash_array::const_iterator itr = d.begin(); dash_array::const_iterator end = d.end(); for (;itr != end;++itr) { dash.add_dash(itr->first * scale_factor_, itr->second * scale_factor_); } agg::conv_stroke<agg::conv_dash<path_type > > stroke(dash); line_join_e join=stroke_.get_line_join(); if ( join == MITER_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == MITER_REVERT_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == ROUND_JOIN) stroke.generator().line_join(agg::round_join); else stroke.generator().line_join(agg::bevel_join); line_cap_e cap=stroke_.get_line_cap(); if (cap == BUTT_CAP) stroke.generator().line_cap(agg::butt_cap); else if (cap == SQUARE_CAP) stroke.generator().line_cap(agg::square_cap); else stroke.generator().line_cap(agg::round_cap); stroke.generator().miter_limit(4.0); stroke.generator().width(stroke_.get_width() * scale_factor_); ras_ptr->add_path(stroke); } else { agg::conv_stroke<path_type> stroke(path); line_join_e join=stroke_.get_line_join(); if ( join == MITER_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == MITER_REVERT_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == ROUND_JOIN) stroke.generator().line_join(agg::round_join); else stroke.generator().line_join(agg::bevel_join); line_cap_e cap=stroke_.get_line_cap(); if (cap == BUTT_CAP) stroke.generator().line_cap(agg::butt_cap); else if (cap == SQUARE_CAP) stroke.generator().line_cap(agg::square_cap); else stroke.generator().line_cap(agg::round_cap); stroke.generator().miter_limit(4.0); stroke.generator().width(stroke_.get_width() * scale_factor_); ras_ptr->add_path(stroke); } } } // render id ren.color(mapnik::gray16(feature.id())); agg::render_scanlines(*ras_ptr, sl, ren); // add feature properties to grid cache pixmap_.add_feature(feature); }
void MapPainterAgg::DrawPath(const Projection& projection, const MapParameter& parameter, const Color& color, double width, const std::vector<double>& dash, LineStyle::CapStyle startCap, LineStyle::CapStyle endCap, size_t transStart, size_t transEnd) { agg::path_storage p; for (size_t i=transStart; i<=transEnd; i++) { if (i==transStart) { p.move_to(coordBuffer->buffer[i].GetX(), coordBuffer->buffer[i].GetY()); } else { p.line_to(coordBuffer->buffer[i].GetX(), coordBuffer->buffer[i].GetY()); } } renderer_aa->color(agg::rgba(color.GetR(), color.GetG(), color.GetB(), color.GetA())); if (dash.empty()) { agg::conv_stroke<agg::path_storage> stroke(p); stroke.width(width); if (startCap==LineStyle::capButt || endCap==LineStyle::capButt) { stroke.line_cap(agg::butt_cap); } else if (startCap==LineStyle::capSquare || endCap==LineStyle::capSquare) { stroke.line_cap(agg::square_cap); } else { stroke.line_cap(agg::round_cap); } rasterizer->add_path(stroke); agg::render_scanlines(*rasterizer,*scanlineP8,*renderer_aa); } else { agg::conv_dash<agg::path_storage> dasher(p); agg::conv_stroke<agg::conv_dash<agg::path_storage> > stroke(dasher); stroke.width(width); if (startCap==LineStyle::capButt || endCap==LineStyle::capButt) { stroke.line_cap(agg::butt_cap); } else if (startCap==LineStyle::capSquare || endCap==LineStyle::capSquare) { stroke.line_cap(agg::square_cap); } else { stroke.line_cap(agg::round_cap); } for (size_t i=0; i<dash.size(); i+=2) { dasher.add_dash(dash[i]*width,dash[i+1]*width); } rasterizer->add_path(stroke); agg::render_scanlines(*rasterizer,*scanlineP8,*renderer_aa); } // TODO: End point caps "dots" }
int DisplayTree::RenderShape( const Shape& shape, const Matrix& transform, const ColorMatrix* color_matrix, int clip_width, int clip_height, renderer_base& ren_base, renderer_scanline& ren) { agg::compound_shape m_shape; m_shape.set_shape(&shape); m_shape.m_affine = transform; m_shape.m_color_matrix = color_matrix; while (m_shape.read_next()) { // m_shape.scale(clip_width, height); agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> ras; agg::rasterizer_compound_aa<agg::rasterizer_sl_clip_dbl> rasc; agg::scanline_u8 sl; agg::scanline_bin sl_bin; Matrix m_scale; agg::conv_transform<agg::compound_shape> shape(m_shape, m_scale); agg::conv_stroke<agg::conv_transform<agg::compound_shape> > stroke(shape); agg::span_allocator<Color> alloc; // m_shape.approximation_scale(m_scale.scale()); // printf("Filling shapes.\n"); // Fill shape //---------------------- rasc.clip_box(0, 0, clip_width, clip_height); rasc.reset(); rasc.layer_order(agg::layer_direct); for(int i = 0; i < m_shape.paths(); i++) { rasc.styles(m_shape.style(i).left_fill, m_shape.style(i).right_fill); rasc.add_path(shape, m_shape.style(i).path_id); } agg::render_scanlines_compound(rasc, sl, sl_bin, ren_base, alloc, m_shape); ras.clip_box(0, 0, clip_width, clip_height); for(int i = 0; i < m_shape.paths(); i++) { ras.reset(); if(m_shape.style(i).line >= 0) { const LineStyle& style = m_shape.line_style(m_shape.style(i).line); if (style.width == 0) continue; // Special handling for 'hairline' strokes that should be scale invariant. const double width = style.width == 1 ? 1.0 : (double)style.width * m_shape.m_affine.scale(); stroke.width(width); switch (style.join_style) { case LineStyle::kJoinBevel: stroke.line_join(agg::bevel_join); break; case LineStyle::kJoinMiter: stroke.line_join(agg::miter_join); if (style.miter_limit_factor > 0) { stroke.miter_limit(style.miter_limit_factor); } break; case LineStyle::kJoinRound: // Fall through default: stroke.line_join(agg::round_join); break; } switch (style.start_cap_style) { case LineStyle::kCapRound: stroke.line_cap(agg::round_cap); break; case LineStyle::kCapSquare: stroke.line_cap(agg::square_cap); break; case LineStyle::kCapNone: // Fall through default: stroke.line_cap(agg::butt_cap); break; } Color c = make_rgba(style.rgba); if (color_matrix) { color_matrix->transform(&c); } ren.color(c); ras.add_path(stroke, m_shape.style(i).path_id); agg::render_scanlines(ras, sl, ren); } } } return 0; }
static void condone (void) { stroke(); grestore(); pathcount = 0; }
void Plottable::doPlot(GraphicsData& gd, const Data& d){ if(!d.hasData()) return; draw::color(color()); draw::stroke(stroke()); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // glHint(GL_LINE_SMOOTH_HINT, GL_FASTEST); draw::enable(draw::PointSmooth); draw::enable(draw::LineSmooth); bool doLineStipple = (-1 != mLineStipple); if(doLineStipple){ draw::lineStipple(1, mLineStipple); draw::lineStippling(true); } Indexer ind(d.shape()+1); // dimension 0 is non-spatial //onMap(gd, d, ind); { GraphicsMaps::iterator it = mGraphicsMaps.begin(); while(it != mGraphicsMaps.end()){ ind.reset(); (*it)->onMap(gd, d, ind); ++it; } } switch(mBlendMode){ case TRANSLUCENT: break; case ADDITIVE: glBlendEquation(GL_FUNC_ADD); glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR); break; case SUBTRACTIVE: glBlendEquation(GL_FUNC_REVERSE_SUBTRACT); glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR); break; default:; } // glBlendFuncSeparate(GL_SRC_COLOR, GL_DST_COLOR, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) // glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) // glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_DST_ALPHA); // glBlendFunc(GL_SRC_ALPHA, GL_DST_ALPHA) //glEnable(GL_ALPHA_TEST); //glAlphaFunc(GL_GREATER, 0.99); onDraw(gd, d); // glDisable(GL_ALPHA_TEST); // glBlendEquation(GL_MAX); // glBlendFunc(GL_SRC_COLOR, GL_DST_COLOR); // // draw::color(0,0,0,1); // draw::rectangle(-1,-1,1,1); // // draw::blendTrans(); switch(mBlendMode){ case TRANSLUCENT: break; case ADDITIVE: case SUBTRACTIVE: draw::blendTrans(); break; default:; } // glEnable(GL_ALPHA_TEST); // glAlphaFunc(GL_GREATER, 0.9); // draw::color(0,0,0,0.91); // draw::rectangle(-1,-1,1,1); // glDisable(GL_ALPHA_TEST); if(doLineStipple) draw::lineStippling(false); }
void cairo_context::add_text(glyph_positions const& pos, cairo_face_manager & manager, composite_mode_e comp_op, composite_mode_e halo_comp_op, double scale_factor) { pixel_position const& base_point = pos.get_base_point(); const double sx = base_point.x; const double sy = base_point.y; for (auto const& glyph_pos : pos) { glyph_info const& glyph = glyph_pos.glyph; glyph.face->set_character_sizes(glyph.format->text_size * scale_factor); } //render halo double halo_radius = 0; set_operator(halo_comp_op); for (auto const& glyph_pos : pos) { glyph_info const& glyph = glyph_pos.glyph; halo_radius = glyph.format->halo_radius * scale_factor; // make sure we've got reasonable values. if (halo_radius <= 0.0 || halo_radius > 1024.0) continue; double text_size = glyph.format->text_size * scale_factor; cairo_matrix_t matrix; matrix.xx = text_size * glyph_pos.rot.cos; matrix.xy = text_size * glyph_pos.rot.sin; matrix.yx = text_size * -glyph_pos.rot.sin; matrix.yy = text_size * glyph_pos.rot.cos; matrix.x0 = 0; matrix.y0 = 0; set_font_matrix(matrix); set_font_face(manager, glyph.face); pixel_position new_pos = glyph_pos.pos + glyph.offset.rotate(glyph_pos.rot); glyph_path(glyph.glyph_index, pixel_position(sx + new_pos.x, sy - new_pos.y)); set_line_width(2.0 * halo_radius); set_line_join(ROUND_JOIN); set_color(glyph.format->halo_fill, glyph.format->halo_opacity); stroke(); } set_operator(comp_op); for (auto const& glyph_pos : pos) { glyph_info const& glyph = glyph_pos.glyph; double text_size = glyph.format->text_size * scale_factor; cairo_matrix_t matrix; matrix.xx = text_size * glyph_pos.rot.cos; matrix.xy = text_size * glyph_pos.rot.sin; matrix.yx = text_size * -glyph_pos.rot.sin; matrix.yy = text_size * glyph_pos.rot.cos; matrix.x0 = 0; matrix.y0 = 0; set_font_matrix(matrix); set_font_face(manager, glyph.face); pixel_position new_pos = glyph_pos.pos + glyph.offset.rotate(glyph_pos.rot); set_color(glyph.format->fill, glyph.format->text_opacity); show_glyph(glyph.glyph_index, pixel_position(sx + new_pos.x, sy - new_pos.y)); } }
void drawCurve(unsigned char* _data, int _width, int _height, LinkInfo& _info) { //============================================================ // AGG agg::rendering_buffer rbuf; rbuf.attach(_data, _width, _height, _width*4); // Pixel format and basic primitives renderer agg::pixfmt_bgra32 pixf(rbuf); agg::renderer_base<agg::pixfmt_bgra32> renb(pixf); //renb.clear(agg::rgba8(152, 185, 254, 0)); // Scanline renderer for solid filling. agg::renderer_scanline_aa_solid<agg::renderer_base<agg::pixfmt_bgra32> > ren(renb); // Rasterizer & scanline agg::rasterizer_scanline_aa<> ras; agg::scanline_p8 sl; // хранилище всех путей agg::path_storage path; // кривая безье которая строится по 4 точкам agg::curve4 curve; curve.approximation_method(agg::curve_approximation_method_e(agg::curve_inc)); // метод апроксимации, curve_inc - быстрый но много точек curve.approximation_scale(0.7); //масштаб апроксимации curve.angle_tolerance(agg::deg2rad(0)); curve.cusp_limit(agg::deg2rad(0)); const int offset = 3; curve.init( _info.point_start.left, _info.point_start.top, _info.point_start.left, _info.point_start.top, _info.point_end.left, _info.point_end.top, _info.point_end.left, _info.point_end.top); // добавляем путь безье path.concat_path(curve); // сам путь который рисуется, растерезатор agg::conv_stroke<agg::path_storage> stroke(path); stroke.width(2); // ширина линии stroke.line_join(agg::line_join_e(agg::bevel_join)); // хз че такое stroke.line_cap(agg::line_cap_e(agg::round_cap)); //обрезка концов stroke.inner_join(agg::inner_join_e(agg::inner_miter)); // соединения внутри линии точек stroke.inner_miter_limit(0); ras.add_path(stroke); // Setting the attrribute (color) & Rendering ren.color(agg::rgba8(_info.colour.red * 255, _info.colour.green * 255, _info.colour.blue * 255, 255)); agg::render_scanlines(ras, sl, ren); //============================================================ // хранилище всех путей /*agg::path_storage path2; // кривая безье которая строится по 4 точкам agg::curve4 curve2; curve2.approximation_method(agg::curve_approximation_method_e(agg::curve_inc)); // метод апроксимации, curve_inc - быстрый но много точек curve2.approximation_scale(0.7); //масштаб апроксимации curve2.angle_tolerance(agg::deg2rad(0)); curve2.cusp_limit(agg::deg2rad(0)); curve2.init( _info.point_start.left, _info.point_start.top, _info.point_start.left + _info.start_offset, _info.point_start.top, _info.point_end.left + _info.end_offset, _info.point_end.top, _info.point_end.left, _info.point_end.top); // добавляем путь безье path2.concat_path(curve2); // сам путь который рисуется, растерезатор agg::conv_stroke<agg::path_storage> stroke2(path2); stroke2.width(2); // ширина линии stroke2.line_join(agg::line_join_e(agg::bevel_join)); // хз че такое stroke2.line_cap(agg::line_cap_e(agg::butt_cap)); //обрезка концов stroke2.inner_join(agg::inner_join_e(agg::inner_miter)); // соединения внутри линии точек stroke2.inner_miter_limit(1.01); ras.add_path(stroke2); // Setting the attrribute (color) & Rendering ren.color(agg::rgba8(_info.colour.red * 255, _info.colour.green * 255, _info.colour.blue * 255, 255)); agg::render_scanlines(ras, sl, ren);*/ //============================================================ }
virtual void on_draw() { pixfmt pixf(rbuf_window()); renderer_base rb(pixf); rb.clear(agg::rgba(1.0, 1.0, 1.0)); rb.copy_from(rbuf_img(0), 0, 110, 35); agg::rasterizer_scanline_aa<> ras; agg::scanline_u8 sl; agg::rendering_buffer img_rbuf(g_image, 4, 4, 4*4); double para[] = { 200, 40, 200+300, 40, 200+300, 40+300, 200, 40+300 }; agg::trans_affine img_mtx(para, 0,0,4,4); typedef agg::span_interpolator_linear<> interpolator_type; interpolator_type interpolator(img_mtx); agg::span_allocator<agg::rgba8> sa; pixfmt img_pixf(img_rbuf); typedef agg::image_accessor_clone<pixfmt> img_source_type; img_source_type source(img_pixf); ras.reset(); ras.move_to_d(para[0], para[1]); ras.line_to_d(para[2], para[3]); ras.line_to_d(para[4], para[5]); ras.line_to_d(para[6], para[7]); switch(m_filters.cur_item()) { case 0: { typedef agg::span_image_filter_rgba_nn<img_source_type, interpolator_type> span_gen_type; span_gen_type sg(source, interpolator); agg::render_scanlines_aa(ras, sl, rb, sa, sg); } break; case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: { agg::image_filter_lut filter; bool norm = m_normalize.status(); switch(m_filters.cur_item()) { case 1: filter.calculate(agg::image_filter_bilinear(), norm); break; case 2: filter.calculate(agg::image_filter_bicubic(), norm); break; case 3: filter.calculate(agg::image_filter_spline16(), norm); break; case 4: filter.calculate(agg::image_filter_spline36(), norm); break; case 5: filter.calculate(agg::image_filter_hanning(), norm); break; case 6: filter.calculate(agg::image_filter_hamming(), norm); break; case 7: filter.calculate(agg::image_filter_hermite(), norm); break; case 8: filter.calculate(agg::image_filter_kaiser(), norm); break; case 9: filter.calculate(agg::image_filter_quadric(), norm); break; case 10: filter.calculate(agg::image_filter_catrom(), norm); break; case 11: filter.calculate(agg::image_filter_gaussian(), norm); break; case 12: filter.calculate(agg::image_filter_bessel(), norm); break; case 13: filter.calculate(agg::image_filter_mitchell(), norm); break; case 14: filter.calculate(agg::image_filter_sinc(m_radius.value()), norm); break; case 15: filter.calculate(agg::image_filter_lanczos(m_radius.value()), norm); break; case 16: filter.calculate(agg::image_filter_blackman(m_radius.value()), norm); break; } typedef agg::span_image_filter_rgba<img_source_type, interpolator_type> span_gen_type; span_gen_type sg(source, interpolator, filter); agg::render_scanlines_aa(ras, sl, rb, sa, sg); agg::gamma_lut<agg::int8u, agg::int8u, 8, 8> gamma(m_gamma.value()); pixf.apply_gamma_inv(gamma); double x_start = 5.0; double x_end = 195.0; double y_start = 235.0; double y_end = initial_height() - 5.0; double x_center = (x_start + x_end) / 2; agg::path_storage p; agg::conv_stroke<agg::path_storage> stroke(p); stroke.width(0.8); unsigned i; for(i = 0; i <= 16; i++) { double x = x_start + (x_end - x_start) * i / 16.0; p.remove_all(); p.move_to(x+0.5, y_start); p.line_to(x+0.5, y_end); ras.add_path(stroke); agg::render_scanlines_aa_solid(ras, sl, rb, agg::rgba8(0, 0, 0, i == 8 ? 255 : 100)); } double ys = y_start + (y_end - y_start) / 6.0; p.remove_all(); p.move_to(x_start, ys); p.line_to(x_end, ys); ras.add_path(stroke); agg::render_scanlines_aa_solid(ras, sl, rb, agg::rgba8(0, 0, 0)); double radius = filter.radius(); unsigned n = unsigned(radius * 256 * 2); double dx = (x_end - x_start) * radius / 8.0; double dy = y_end - ys; const agg::int16* weights = filter.weight_array(); double xs = (x_end + x_start)/2.0 - (filter.diameter() * (x_end - x_start) / 32.0); unsigned nn = filter.diameter() * 256; p.remove_all(); p.move_to(xs+0.5, ys + dy * weights[0] / agg::image_filter_scale); for(i = 1; i < nn; i++) { p.line_to(xs + dx * i / n + 0.5, ys + dy * weights[i] / agg::image_filter_scale); } ras.add_path(stroke); agg::render_scanlines_aa_solid(ras, sl, rb, agg::rgba8(100, 0, 0)); } break; } agg::render_ctrl(ras, sl, rb, m_gamma); if(m_filters.cur_item() >= 14) { agg::render_ctrl(ras, sl, rb, m_radius); } agg::render_ctrl(ras, sl, rb, m_filters); agg::render_ctrl(ras, sl, rb, m_normalize); }
void agg_renderer<T>::process(building_symbolizer const& sym, mapnik::feature_impl & feature, proj_transform const& prj_trans) { typedef coord_transform<CoordTransform,geometry_type> path_type; typedef agg::renderer_base<agg::pixfmt_rgba32> ren_base; typedef agg::renderer_scanline_aa_solid<ren_base> renderer; agg::rendering_buffer buf(current_buffer_->raw_data(),width_,height_, width_ * 4); agg::pixfmt_rgba32 pixf(buf); ren_base renb(pixf); color const& fill_ = sym.get_fill(); unsigned r=fill_.red(); unsigned g=fill_.green(); unsigned b=fill_.blue(); unsigned a=fill_.alpha(); renderer ren(renb); agg::scanline_u8 sl; ras_ptr->reset(); ras_ptr->gamma(agg::gamma_power()); double height = 0.0; expression_ptr height_expr = sym.height(); if (height_expr) { value_type result = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr); height = result.to_double() * scale_factor_; } for (unsigned i=0;i<feature.num_geometries();++i) { geometry_type const& geom = feature.get_geometry(i); if (geom.size() > 2) { boost::scoped_ptr<geometry_type> frame(new geometry_type(LineString)); boost::scoped_ptr<geometry_type> roof(new geometry_type(Polygon)); std::deque<segment_t> face_segments; double x0 = 0; double y0 = 0; double x,y; geom.rewind(0); for (unsigned cm = geom.vertex(&x, &y); cm != SEG_END; cm = geom.vertex(&x, &y)) { if (cm == SEG_MOVETO) { frame->move_to(x,y); } else if (cm == SEG_LINETO || cm == SEG_CLOSE) { frame->line_to(x,y); face_segments.push_back(segment_t(x0,y0,x,y)); } x0 = x; y0 = y; } std::sort(face_segments.begin(),face_segments.end(), y_order); std::deque<segment_t>::const_iterator itr=face_segments.begin(); std::deque<segment_t>::const_iterator end=face_segments.end(); for (; itr!=end; ++itr) { boost::scoped_ptr<geometry_type> faces(new geometry_type(Polygon)); faces->move_to(itr->get<0>(),itr->get<1>()); faces->line_to(itr->get<2>(),itr->get<3>()); faces->line_to(itr->get<2>(),itr->get<3>() + height); faces->line_to(itr->get<0>(),itr->get<1>() + height); path_type faces_path (t_,*faces,prj_trans); ras_ptr->add_path(faces_path); ren.color(agg::rgba8(int(r*0.8), int(g*0.8), int(b*0.8), int(a * sym.get_opacity()))); agg::render_scanlines(*ras_ptr, sl, ren); ras_ptr->reset(); // frame->move_to(itr->get<0>(),itr->get<1>()); frame->line_to(itr->get<0>(),itr->get<1>()+height); } geom.rewind(0); for (unsigned cm = geom.vertex(&x, &y); cm != SEG_END; cm = geom.vertex(&x, &y)) { if (cm == SEG_MOVETO) { frame->move_to(x,y+height); roof->move_to(x,y+height); } else if (cm == SEG_LINETO || cm == SEG_CLOSE) { frame->line_to(x,y+height); roof->line_to(x,y+height); } } path_type path(t_,*frame,prj_trans); agg::conv_stroke<path_type> stroke(path); stroke.width(scale_factor_); ras_ptr->add_path(stroke); ren.color(agg::rgba8(int(r*0.8), int(g*0.8), int(b*0.8), int(a * sym.get_opacity()))); agg::render_scanlines(*ras_ptr, sl, ren); ras_ptr->reset(); path_type roof_path (t_,*roof,prj_trans); ras_ptr->add_path(roof_path); ren.color(agg::rgba8(r, g, b, int(a * sym.get_opacity()))); agg::render_scanlines(*ras_ptr, sl, ren); } } }
void agg_renderer<T>::process(line_symbolizer const& sym, Feature const& feature, proj_transform const& prj_trans) { typedef agg::renderer_base<agg::pixfmt_rgba32_plain> ren_base; typedef coord_transform2<CoordTransform,geometry_type> path_type; stroke const& stroke_ = sym.get_stroke(); color const& col = stroke_.get_color(); unsigned r=col.red(); unsigned g=col.green(); unsigned b=col.blue(); unsigned a=col.alpha(); agg::rendering_buffer buf(pixmap_.raw_data(),width_,height_, width_ * 4); agg::pixfmt_rgba32_plain pixf(buf); if (sym.get_rasterizer() == RASTERIZER_FAST) { typedef agg::renderer_outline_aa<ren_base> renderer_type; typedef agg::rasterizer_outline_aa<renderer_type> rasterizer_type; agg::line_profile_aa profile; //agg::line_profile_aa profile(stroke_.get_width() * scale_factor_, agg::gamma_none()); profile.width(stroke_.get_width() * scale_factor_); ren_base base_ren(pixf); renderer_type ren(base_ren, profile); ren.color(agg::rgba8(r, g, b, int(a*stroke_.get_opacity()))); //ren.clip_box(0,0,width_,height_); rasterizer_type ras(ren); ras.line_join(agg::outline_miter_accurate_join); ras.round_cap(true); for (unsigned i=0;i<feature.num_geometries();++i) { geometry_type const& geom = feature.get_geometry(i); if (geom.num_points() > 1) { path_type path(t_,geom,prj_trans); ras.add_path(path); } } } else { typedef agg::renderer_scanline_aa_solid<ren_base> renderer; agg::scanline_p8 sl; ren_base renb(pixf); renderer ren(renb); ras_ptr->reset(); switch (stroke_.get_gamma_method()) { case GAMMA_POWER: ras_ptr->gamma(agg::gamma_power(stroke_.get_gamma())); break; case GAMMA_LINEAR: ras_ptr->gamma(agg::gamma_linear(0.0, stroke_.get_gamma())); break; case GAMMA_NONE: ras_ptr->gamma(agg::gamma_none()); break; case GAMMA_THRESHOLD: ras_ptr->gamma(agg::gamma_threshold(stroke_.get_gamma())); break; case GAMMA_MULTIPLY: ras_ptr->gamma(agg::gamma_multiply(stroke_.get_gamma())); break; default: ras_ptr->gamma(agg::gamma_power(stroke_.get_gamma())); } metawriter_with_properties writer = sym.get_metawriter(); for (unsigned i=0;i<feature.num_geometries();++i) { geometry_type const& geom = feature.get_geometry(i); if (geom.num_points() > 1) { path_type path(t_,geom,prj_trans); if (stroke_.has_dash()) { agg::conv_dash<path_type> dash(path); dash_array const& d = stroke_.get_dash_array(); dash_array::const_iterator itr = d.begin(); dash_array::const_iterator end = d.end(); for (;itr != end;++itr) { dash.add_dash(itr->first * scale_factor_, itr->second * scale_factor_); } agg::conv_stroke<agg::conv_dash<path_type > > stroke(dash); line_join_e join=stroke_.get_line_join(); if ( join == MITER_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == MITER_REVERT_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == ROUND_JOIN) stroke.generator().line_join(agg::round_join); else stroke.generator().line_join(agg::bevel_join); line_cap_e cap=stroke_.get_line_cap(); if (cap == BUTT_CAP) stroke.generator().line_cap(agg::butt_cap); else if (cap == SQUARE_CAP) stroke.generator().line_cap(agg::square_cap); else stroke.generator().line_cap(agg::round_cap); stroke.generator().miter_limit(4.0); stroke.generator().width(stroke_.get_width() * scale_factor_); ras_ptr->add_path(stroke); } else { agg::conv_stroke<path_type> stroke(path); line_join_e join=stroke_.get_line_join(); if ( join == MITER_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == MITER_REVERT_JOIN) stroke.generator().line_join(agg::miter_join); else if( join == ROUND_JOIN) stroke.generator().line_join(agg::round_join); else stroke.generator().line_join(agg::bevel_join); line_cap_e cap=stroke_.get_line_cap(); if (cap == BUTT_CAP) stroke.generator().line_cap(agg::butt_cap); else if (cap == SQUARE_CAP) stroke.generator().line_cap(agg::square_cap); else stroke.generator().line_cap(agg::round_cap); stroke.generator().miter_limit(4.0); stroke.generator().width(stroke_.get_width() * scale_factor_); ras_ptr->add_path(stroke); if (writer.first) writer.first->add_line(path, feature, t_, writer.second); } } } ren.color(agg::rgba8(r, g, b, int(a*stroke_.get_opacity()))); agg::render_scanlines(*ras_ptr, sl, ren); } }
virtual void on_draw() { typedef agg::renderer_base<pixfmt> ren_base; pixfmt pixf(rbuf_window()); ren_base renb(pixf); renb.clear(agg::rgba(1, 1, 1)); agg::rasterizer_scanline_aa<> ras; agg::scanline_u8 sl; agg::line_cap_e cap = agg::butt_cap; if(m_cap.cur_item() == 1) cap = agg::square_cap; if(m_cap.cur_item() == 2) cap = agg::round_cap; // Here we declare a very cheap-in-use path storage. // It allocates space for at most 20 vertices in stack and // never allocates memory. But be aware that adding more than // 20 vertices is fatal! //------------------------ typedef agg::path_base< agg::vertex_stl_storage< agg::pod_auto_vector< agg::vertex_d, 20> > > path_storage_type; path_storage_type path; path.move_to(m_x[0], m_y[0]); path.line_to(m_x[1], m_y[1]); path.line_to((m_x[0]+m_x[1]+m_x[2]) / 3.0, (m_y[0]+m_y[1]+m_y[2]) / 3.0); path.line_to(m_x[2], m_y[2]); if(m_close.status()) path.close_polygon(); path.move_to((m_x[0] + m_x[1]) / 2, (m_y[0] + m_y[1]) / 2); path.line_to((m_x[1] + m_x[2]) / 2, (m_y[1] + m_y[2]) / 2); path.line_to((m_x[2] + m_x[0]) / 2, (m_y[2] + m_y[0]) / 2); if(m_close.status()) path.close_polygon(); if(m_even_odd.status()) ras.filling_rule(agg::fill_even_odd); // (1) ras.add_path(path); agg::render_scanlines_aa_solid(ras, sl, renb, agg::rgba(0.7, 0.5, 0.1, 0.5)); // (1) // Start of (2, 3, 4) agg::conv_smooth_poly1<path_storage_type> smooth(path); smooth.smooth_value(m_smooth.value()); // (2) ras.add_path(smooth); agg::render_scanlines_aa_solid(ras, sl, renb, agg::rgba(0.1, 0.5, 0.7, 0.1)); // (2) // (3) agg::conv_stroke<agg::conv_smooth_poly1<path_storage_type> > smooth_outline(smooth); ras.add_path(smooth_outline); agg::render_scanlines_aa_solid(ras, sl, renb, agg::rgba(0.0, 0.6, 0.0, 0.8)); // (3) // (4) agg::conv_curve<agg::conv_smooth_poly1<path_storage_type> > curve(smooth); agg::conv_dash<agg::conv_curve<agg::conv_smooth_poly1<path_storage_type> >, agg::vcgen_markers_term> dash(curve); agg::conv_stroke<agg::conv_dash<agg::conv_curve<agg::conv_smooth_poly1<path_storage_type> >, agg::vcgen_markers_term> > stroke(dash); stroke.line_cap(cap); stroke.width(m_width.value()); double k = ::pow(m_width.value(), 0.7); agg::arrowhead ah; ah.head(4 * k, 4 * k, 3 * k, 2 * k); if(!m_close.status()) ah.tail(1 * k, 1.5 * k, 3 * k, 5 * k); agg::conv_marker<agg::vcgen_markers_term, agg::arrowhead> arrow(dash.markers(), ah); dash.add_dash(20.0, 5.0); dash.add_dash(5.0, 5.0); dash.add_dash(5.0, 5.0); dash.dash_start(10); ras.add_path(stroke); ras.add_path(arrow); agg::render_scanlines_aa_solid(ras, sl, renb, agg::rgba(0.0, 0.0, 0.0)); // (4) ras.filling_rule(agg::fill_non_zero); agg::render_ctrl(ras, sl, renb, m_cap); agg::render_ctrl(ras, sl, renb, m_width); agg::render_ctrl(ras, sl, renb, m_smooth); agg::render_ctrl(ras, sl, renb, m_close); agg::render_ctrl(ras, sl, renb, m_even_odd); }
virtual void on_draw() { typedef agg::renderer_base<pixfmt_pre> renderer_base; typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_scanline; typedef agg::scanline_u8 scanline; pixfmt_pre pixf(rbuf_window()); renderer_base ren_base(pixf); ren_base.clear(agg::rgba(1.0, 1.0, 0.95)); renderer_scanline ren(ren_base); agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> ras; agg::scanline_u8 sl; agg::conv_transform<agg::compound_shape> shape(m_shape, m_scale); agg::conv_stroke<agg::conv_transform<agg::compound_shape> > stroke(shape); m_shape.approximation_scale(m_scale.scale()); unsigned i; agg::path_storage tmp_path; ras.clip_box(0, 0, width(), height()); // This is an alternative method of Flash rasterization. // We decompose the compound shape into separate paths // and select the ones that fit the given style (left or right). // So that, we form a sub-shape and draw it as a whole. // // Here the regular scanline rasterizer is used, but it doesn't // automatically close the polygons. So that, the rasterizer // actually works with a set of polylines instead of polygons. // Of course, the data integrity must be preserved, that is, // the polylines must eventually form a closed contour // (or a set of closed contours). So that, first we set // auto_close(false); // // The second important thing is that one path can be rasterized // twice, if it has both, left and right fill. Sometimes the // path has equal left and right fill, so that, the same path // will be added twice even for a single sub-shape. If the // rasterizer can tolerate these degenerates you can add them, // but it's also fine just to omit them. // // The third thing is that for one side (left or right) // you should invert the direction of the paths. // // The main disadvantage of this method is imperfect stitching // of the adjacent polygons. The problem can be solved if we use // compositing operation "plus" instead of alpha-blend. But // in this case we are forced to use an RGBA buffer, clean it with // zero, rasterize using "plus" operation, and then alpha-blend // the result over the final scene. It can be too expensive. //------------------------------------------------------------ ras.auto_close(false); //ras.filling_rule(agg::fill_even_odd); start_timer(); for(int s = m_shape.min_style(); s <= m_shape.max_style(); s++) { ras.reset(); for(i = 0; i < m_shape.paths(); i++) { const agg::path_style& style = m_shape.style(i); if(style.left_fill != style.right_fill) { if(style.left_fill == s) { ras.add_path(shape, style.path_id); } if(style.right_fill == s) { tmp_path.remove_all(); tmp_path.concat_path(shape, style.path_id); tmp_path.invert_polygon(0); ras.add_path(tmp_path); } } } agg::render_scanlines_aa_solid(ras, sl, ren_base, m_colors[s]); } double tfill = elapsed_time(); ras.auto_close(true); // Draw strokes //---------------------- start_timer(); stroke.width(sqrt(m_scale.scale())); stroke.line_join(agg::round_join); stroke.line_cap(agg::round_cap); for(i = 0; i < m_shape.paths(); i++) { ras.reset(); if(m_shape.style(i).line >= 0) { ras.add_path(stroke, m_shape.style(i).path_id); ren.color(agg::srgba8(0,0,0, 128)); agg::render_scanlines(ras, sl, ren); } } double tstroke = elapsed_time(); char buf[256]; agg::gsv_text t; t.size(8.0); t.flip(true); agg::conv_stroke<agg::gsv_text> ts(t); ts.width(1.6); ts.line_cap(agg::round_cap); sprintf(buf, "Fill=%.2fms (%dFPS) Stroke=%.2fms (%dFPS) Total=%.2fms (%dFPS)\n\n" "Space: Next Shape\n\n" "+/- : ZoomIn/ZoomOut (with respect to the mouse pointer)", tfill, int(1000.0 / tfill), tstroke, int(1000.0 / tstroke), tfill+tstroke, int(1000.0 / (tfill+tstroke))); t.start_point(10.0, 20.0); t.text(buf); ras.add_path(ts); ren.color(agg::rgba(0,0,0)); agg::render_scanlines(ras, sl, ren); }
unsigned render_sbool(Rasterizer& ras1, Rasterizer& ras2) { pixfmt pf(rbuf_window()); agg::renderer_base<pixfmt> rb(pf); agg::renderer_scanline_aa_solid<agg::renderer_base<pixfmt> > ren(rb); agg::scanline_p8 sl; ras1.filling_rule(m_fill_rule.cur_item() ? agg::fill_non_zero : agg::fill_even_odd); ras2.filling_rule(m_fill_rule.cur_item() ? agg::fill_non_zero : agg::fill_even_odd); switch(m_polygons.cur_item()) { case 0: { //------------------------------------ // Two simple paths // agg::path_storage ps1; agg::path_storage ps2; double x = m_x - initial_width()/2 + 100; double y = m_y - initial_height()/2 + 100; ps1.move_to(x+140, y+145); ps1.line_to(x+225, y+44); ps1.line_to(x+296, y+219); ps1.close_polygon(); ps1.line_to(x+226, y+289); ps1.line_to(x+82, y+292); ps1.move_to(x+220, y+222); ps1.line_to(x+363, y+249); ps1.line_to(x+265, y+331); ps1.move_to(x+242, y+243); ps1.line_to(x+325, y+261); ps1.line_to(x+268, y+309); ps1.move_to(x+259, y+259); ps1.line_to(x+273, y+288); ps1.line_to(x+298, y+266); ps2.move_to(100+32, 100+77); ps2.line_to(100+473, 100+263); ps2.line_to(100+351, 100+290); ps2.line_to(100+354, 100+374); ras1.reset(); ras1.add_path(ps1); ren.color(agg::rgba(0, 0, 0, 0.1)); agg::render_scanlines(ras1, sl, ren); ras2.reset(); ras2.add_path(ps2); ren.color(agg::rgba(0, 0.6, 0, 0.1)); agg::render_scanlines(ras2, sl, ren); render_scanline_boolean(ras1, ras2); } break; case 1: { //------------------------------------ // Closed stroke // agg::path_storage ps1; agg::path_storage ps2; agg::conv_stroke<agg::path_storage> stroke(ps2); stroke.width(15.0); double x = m_x - initial_width()/2 + 100; double y = m_y - initial_height()/2 + 100; ps1.move_to(x+140, y+145); ps1.line_to(x+225, y+44); ps1.line_to(x+296, y+219); ps1.close_polygon(); ps1.line_to(x+226, y+289); ps1.line_to(x+82, y+292); ps1.move_to(x+220-50, y+222); ps1.line_to(x+363-50, y+249); ps1.line_to(x+265-50, y+331); ps1.close_polygon(); ps2.move_to(100+32, 100+77); ps2.line_to(100+473, 100+263); ps2.line_to(100+351, 100+290); ps2.line_to(100+354, 100+374); ps2.close_polygon(); ras1.reset(); ras1.add_path(ps1); ren.color(agg::rgba(0, 0, 0, 0.1)); agg::render_scanlines(ras1, sl, ren); ras2.reset(); ras2.add_path(stroke); ren.color(agg::rgba(0, 0.6, 0, 0.1)); agg::render_scanlines(ras2, sl, ren); render_scanline_boolean(ras1, ras2); } break; case 2: { //------------------------------------ // Great Britain and Arrows // agg::path_storage gb_poly; agg::path_storage arrows; make_gb_poly(gb_poly); make_arrows(arrows); agg::trans_affine mtx1; agg::trans_affine mtx2; mtx1 *= agg::trans_affine_translation(-1150, -1150); mtx1 *= agg::trans_affine_scaling(2.0); mtx2 = mtx1; mtx2 *= agg::trans_affine_translation(m_x - initial_width()/2, m_y - initial_height()/2); agg::conv_transform<agg::path_storage> trans_gb_poly(gb_poly, mtx1); agg::conv_transform<agg::path_storage> trans_arrows(arrows, mtx2); ras2.add_path(trans_gb_poly); ren.color(agg::rgba(0.5, 0.5, 0, 0.1)); agg::render_scanlines(ras2, sl, ren); agg::conv_stroke<agg::conv_transform<agg::path_storage> > stroke_gb_poly(trans_gb_poly); stroke_gb_poly.width(0.1); ras1.add_path(stroke_gb_poly); ren.color(agg::rgba(0, 0, 0)); agg::render_scanlines(ras1, sl, ren); ras2.add_path(trans_arrows); ren.color(agg::rgba(0.0, 0.5, 0.5, 0.1)); agg::render_scanlines(ras2, sl, ren); ras1.reset(); ras1.add_path(trans_gb_poly); render_scanline_boolean(ras1, ras2); } break; case 3: { //------------------------------------ // Great Britain and a Spiral // spiral sp(m_x, m_y, 10, 150, 30, 0.0); agg::conv_stroke<spiral> stroke(sp); stroke.width(15.0); agg::path_storage gb_poly; make_gb_poly(gb_poly); agg::trans_affine mtx; mtx *= agg::trans_affine_translation(-1150, -1150); mtx *= agg::trans_affine_scaling(2.0); mtx *= trans_affine_resizing(); agg::conv_transform<agg::path_storage> trans_gb_poly(gb_poly, mtx); ras1.add_path(trans_gb_poly); ren.color(agg::rgba(0.5, 0.5, 0, 0.1)); agg::render_scanlines(ras1, sl, ren); agg::conv_stroke<agg::conv_transform<agg::path_storage> > stroke_gb_poly(trans_gb_poly); stroke_gb_poly.width(0.1); ras1.reset(); ras1.add_path(stroke_gb_poly); ren.color(agg::rgba(0, 0, 0)); agg::render_scanlines(ras1, sl, ren); ras2.reset(); ras2.add_path(stroke); ren.color(agg::rgba(0.0, 0.5, 0.5, 0.1)); agg::render_scanlines(ras2, sl, ren); ras1.reset(); ras1.add_path(trans_gb_poly); render_scanline_boolean(ras1, ras2); } break; case 4: { //------------------------------------ // Spiral and glyph // spiral sp(m_x, m_y, 10, 150, 30, 0.0); agg::conv_stroke<spiral> stroke(sp); stroke.width(15.0); agg::path_storage glyph; glyph.move_to(28.47, 6.45); glyph.curve3(21.58, 1.12, 19.82, 0.29); glyph.curve3(17.19, -0.93, 14.21, -0.93); glyph.curve3(9.57, -0.93, 6.57, 2.25); glyph.curve3(3.56, 5.42, 3.56, 10.60); glyph.curve3(3.56, 13.87, 5.03, 16.26); glyph.curve3(7.03, 19.58, 11.99, 22.51); glyph.curve3(16.94, 25.44, 28.47, 29.64); glyph.line_to(28.47, 31.40); glyph.curve3(28.47, 38.09, 26.34, 40.58); glyph.curve3(24.22, 43.07, 20.17, 43.07); glyph.curve3(17.09, 43.07, 15.28, 41.41); glyph.curve3(13.43, 39.75, 13.43, 37.60); glyph.line_to(13.53, 34.77); glyph.curve3(13.53, 32.52, 12.38, 31.30); glyph.curve3(11.23, 30.08, 9.38, 30.08); glyph.curve3(7.57, 30.08, 6.42, 31.35); glyph.curve3(5.27, 32.62, 5.27, 34.81); glyph.curve3(5.27, 39.01, 9.57, 42.53); glyph.curve3(13.87, 46.04, 21.63, 46.04); glyph.curve3(27.59, 46.04, 31.40, 44.04); glyph.curve3(34.28, 42.53, 35.64, 39.31); glyph.curve3(36.52, 37.21, 36.52, 30.71); glyph.line_to(36.52, 15.53); glyph.curve3(36.52, 9.13, 36.77, 7.69); glyph.curve3(37.01, 6.25, 37.57, 5.76); glyph.curve3(38.13, 5.27, 38.87, 5.27); glyph.curve3(39.65, 5.27, 40.23, 5.62); glyph.curve3(41.26, 6.25, 44.19, 9.18); glyph.line_to(44.19, 6.45); glyph.curve3(38.72, -0.88, 33.74, -0.88); glyph.curve3(31.35, -0.88, 29.93, 0.78); glyph.curve3(28.52, 2.44, 28.47, 6.45); glyph.close_polygon(); glyph.move_to(28.47, 9.62); glyph.line_to(28.47, 26.66); glyph.curve3(21.09, 23.73, 18.95, 22.51); glyph.curve3(15.09, 20.36, 13.43, 18.02); glyph.curve3(11.77, 15.67, 11.77, 12.89); glyph.curve3(11.77, 9.38, 13.87, 7.06); glyph.curve3(15.97, 4.74, 18.70, 4.74); glyph.curve3(22.41, 4.74, 28.47, 9.62); glyph.close_polygon(); agg::trans_affine mtx; mtx *= agg::trans_affine_scaling(4.0); mtx *= agg::trans_affine_translation(220, 200); agg::conv_transform<agg::path_storage> trans(glyph, mtx); agg::conv_curve<agg::conv_transform<agg::path_storage> > curve(trans); ras1.reset(); ras1.add_path(stroke); ren.color(agg::rgba(0, 0, 0, 0.1)); agg::render_scanlines(ras1, sl, ren); ras2.reset(); ras2.add_path(curve); ren.color(agg::rgba(0, 0.6, 0, 0.1)); agg::render_scanlines(ras2, sl, ren); render_scanline_boolean(ras1, ras2); } break; } return 0; }
//******************************************************************************* void DisplaySplashScreen(void) { COLOR bgColor; COLOR fontColor; int ii; int yTextLoc; #ifdef _STARTUPSCREEN_VERSION_ char startupMsg[128]; #endif #ifdef _STARTUPSCREEN_VERSION_ bgColor.red = 0; bgColor.green = 0; bgColor.blue = 0; fontColor.red = 0; fontColor.green = 255; fontColor.blue = 0; //* display the overall library version yTextLoc = 10; strcpy(startupMsg, kDisplayHardwareString); strcat(startupMsg, " "); strcat(startupMsg, kDisplayHardwareVersion); dispPutS(startupMsg, 5, yTextLoc, fontColor, bgColor); yTextLoc += kLinrSpacing; //* display the SubProcessing library version strcpy(startupMsg, "Arduino Procssing Library "); strcat(startupMsg, kSubP_VersionString); strcat(startupMsg, " "); #ifdef _SUBP_OPTION_GAMES_ strcat(startupMsg, "+G"); #endif #ifdef _SUBP_OPTION_KEYBOARD_ strcat(startupMsg, "+K"); #endif dispPutS(startupMsg, 5, yTextLoc, fontColor, bgColor); yTextLoc += kLinrSpacing; #endif #ifdef _DEBUG_RECTS_ dispColor(bgColor); ii = kSCREEN_Y_size / 2; ii -= 25; ii = kSCREEN_Y_size / 3; while (ii > 30) { fill(random(255), random(255), random(255)); stroke(random(255), random(255), random(255)); drawrect((kSCREEN_X_size / 2) - ii, (kSCREEN_Y_size / 2) - ii, (ii * 2), (ii * 2)); ii -= 10; } fill(0); stroke(255); #endif #ifdef _STARTUPSCREEN_LIQUIDWARE_ for (ii=0; ii<190; ii+=10) { //* this is the FADE color, how much to subtract from the actual colors //* 0 means none. bgColor.red = ii; bgColor.green = ii; bgColor.blue = ii; DisplayRLE_RGB(gLiquidWareLogo, &bgColor, false, kMatixTopOffset); #ifdef _STARTUPSCREEN_MATRIX_ if (ii > 100) { MatrixDisplay(kMatixTopOffset, 3); } #endif } #endif #ifdef _STARTUPSCREEN_MATRIX_ ii = 0; while(!serialAvailable() && (ii < 2000)) { MatrixDisplay(kMatixTopOffset, 2); ii++; gettouch(); if ((mouseX > 200) && (mouseY < 100)) { break; } } #endif #ifdef _SUBP_OPTION_7_SEGMENT_dontDisplay int xx, yy; // dispClearScreen(); xx = 10; yy = 50; for (ii=5; ii<30; ii += 4) { Display7SegmentString(xx, yy, "0123456789ABCDEF", ii); yy += (ii * 2); yy += 8; if (ii > 230) { break; } } while (true) { //* do nothing } #endif bgColor.red = 0; bgColor.green = 0; bgColor.blue = 0; dispColor(bgColor); // drawrect(0, yTextLoc, 320, 240); }