[Igarden-commit] CommonSource/YAAFExtensions RGGLSVGDraw.cpp, 1.26.2.5, 1.26.2.6 RGGLSVGDraw.h, 1.8
Status: Beta
Brought to you by:
jlbedell
|
From: Jeffrey B. <jlb...@us...> - 2006-11-15 12:18:11
|
Update of /cvsroot/igarden/CommonSource/YAAFExtensions In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv978 Modified Files: Tag: Release_branch_v1 RGGLSVGDraw.cpp RGGLSVGDraw.h Log Message: Create ability to have monochrome drawing styles Index: RGGLSVGDraw.cpp =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGGLSVGDraw.cpp,v retrieving revision 1.26.2.5 retrieving revision 1.26.2.6 diff -C2 -d -r1.26.2.5 -r1.26.2.6 *** RGGLSVGDraw.cpp 11 Nov 2006 15:05:14 -0000 1.26.2.5 --- RGGLSVGDraw.cpp 15 Nov 2006 12:18:09 -0000 1.26.2.6 *************** *** 75,78 **** --- 75,79 ---- void Init(XGFileSpecifier &spec, middleType_t defaultType); ErrorCode GetDisplayList(double xSize, double ySize, double rotate, bool forcePastBounds, long &result); + void EnableColor(bool useColor); XGFileSpecifier _spec; *************** *** 99,102 **** --- 100,104 ---- XGXMLObject *_parseTree; + bool _allowColor; bool _hasDisplayList; bool _hasSizesComputed; *************** *** 136,140 **** /// RGGLSVGDraw // ! RGGLSVGDraw::RGGLSVGDraw() { if(_cache == NULL) --- 138,142 ---- /// RGGLSVGDraw // ! RGGLSVGDraw::RGGLSVGDraw(allowColor_t color) { if(_cache == NULL) *************** *** 142,145 **** --- 144,148 ---- _cache = new SVGCacheEntry; } + _cache->EnableColor(color == kUseColor); } *************** *** 305,308 **** --- 308,312 ---- _bounds.bottom = 0.0; _hasSizesComputed = false; + _allowColor = false; ec = inFile.Open(&spec, false); *************** *** 324,327 **** --- 328,336 ---- } + void SVGCacheEntry::EnableColor(bool useColor) + { + _allowColor = useColor; + } + // --------------------------------------------------------------------------- /// ParseDrawingTags PRIVATE *************** *** 1039,1048 **** if(*val == 'C') { ! glPoint_t ctrlpoints[4]; ! int i; val++; - #if 1 - glPoint_t a, b, c; ctrlpoints[0].x = (xPos * scaleX) + xOffset; --- 1048,1056 ---- if(*val == 'C') { ! glPoint_t ctrlpoints[4]; ! int i; ! glPoint_t a, b, c; val++; ctrlpoints[0].x = (xPos * scaleX) + xOffset; *************** *** 1086,1136 **** glVertex3f(result.x, result.y, zOffset); // Z axis taken care of on glTranslate } - #else - ctrlpoints[0][0] = (xPos * scaleX) + xOffset; - ctrlpoints[0][1] = (yPos * scaleY) + yOffset; - ctrlpoints[0][2] = 0.0; - cp[0].x = ctrlpoints[0][0]; - cp[0].y = ctrlpoints[0][1]; - - val = ParseOnePoint(val, true, xSize, ySize, _bounds.top, _bounds.left, xPos, yPos); - ctrlpoints[1][0] = (xPos * scaleX) + xOffset; - ctrlpoints[1][1] = (yPos * scaleY) + yOffset; - ctrlpoints[1][2] = 0.0; - cp[1].x = ctrlpoints[1][0]; - cp[1].y = ctrlpoints[1][1]; - - val = ParseOnePoint(val, true, xSize, ySize, _bounds.top, _bounds.left, xPos, yPos); - ctrlpoints[2][0] = (xPos * scaleX) + xOffset; - ctrlpoints[2][1] = (yPos * scaleY) + yOffset; - ctrlpoints[2][2] = 0.0; - cp[2].x = ctrlpoints[2][0]; - cp[2].y = ctrlpoints[2][1]; - - val = ParseOnePoint(val, true, xSize, ySize, _bounds.top, _bounds.left, xPos, yPos); - ctrlpoints[3][0] = (xPos * scaleX) + xOffset; - ctrlpoints[3][1] = (yPos * scaleY) + yOffset; - ctrlpoints[3][2] = 0.0; - cp[3].x = ctrlpoints[3][0]; - cp[3].y = ctrlpoints[3][1]; - - if(points != NULL) - { - glPoint_t pt1, pt2; - - pt1.x = ctrlpoints[0][0]; - pt1.y = ctrlpoints[0][1]; - points->push_back(pt1); - pt2.x = ctrlpoints[3][0]; - pt2.y = ctrlpoints[3][1]; - points->push_back(pt2); - } - - glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, &ctrlpoints[0][0]); - - for(i= 0; i <= 30; i++) - { - glEvalCoord1f(((GLfloat)i)/30.0); - } - #endif } else if(*val == 'M') --- 1094,1097 ---- *************** *** 1189,1193 **** if(start.x != end.x || start.y != end.y) { ! delta = (3.0/360.0)*2*3.14; startA = atan2(start.y-center.y,start.x-center.x); //*(360/(2*3.14)); endA = atan2(end.y-center.y,end.x-center.x); //*(360/(2*3.14)); --- 1150,1154 ---- if(start.x != end.x || start.y != end.y) { ! delta = (3.0/360.0)*2*3.141592653; startA = atan2(start.y-center.y,start.x-center.x); //*(360/(2*3.14)); endA = atan2(end.y-center.y,end.x-center.x); //*(360/(2*3.14)); *************** *** 1195,1200 **** if(span < 0) span *= -1.0; ! if((span < 3.14) && large) ! span = (2*3.14) - span; count = span/delta; --- 1156,1161 ---- if(span < 0) span *= -1.0; ! if((span < 3.141592653) && large) ! span = (2*3.141592653) - span; count = span/delta; *************** *** 1336,1340 **** if(ry < 0) ry *= -1.0; ! rot *= (2*3.14/360); // To radians // Formula F.6.5.1 --- 1297,1301 ---- if(ry < 0) ry *= -1.0; ! rot *= (2*3.141592653/360); // To radians // Formula F.6.5.1 *************** *** 1913,1940 **** glLineWidth(1.5); ! fill = strstr(val, "stroke:"); ! if(fill != NULL) { ! fill += 7; ! if(strncmp(fill, "none", 4) != 0) { ! long color; ! double red, green, blue; ! ! if(CIstrncmp(fill, "black", 5) == 0) ! color = 0; ! else if(*fill == '#') { ! fill++; ! color = strtol(fill, &junk, 16); } - else - color = 0xffffff; - red = ((color >> 16L) & 0xFF)/255.0; - green = ((color >> 8L) & 0xFF)/255.0; - blue = (color & 0xFF)/255.0; - glColor4f (red, green, blue, 1.0); } } } --- 1874,1906 ---- glLineWidth(1.5); ! if(_allowColor) { ! fill = strstr(val, "stroke:"); ! if(fill != NULL) { ! fill += 7; ! if(strncmp(fill, "none", 4) != 0) { ! long color; ! double red, green, blue; ! ! if(CIstrncmp(fill, "black", 5) == 0) ! color = 0; ! else if(*fill == '#') ! { ! fill++; ! color = strtol(fill, &junk, 16); ! } ! else ! color = 0xffffff; ! red = ((color >> 16L) & 0xFF)/255.0; ! green = ((color >> 8L) & 0xFF)/255.0; ! blue = (color & 0xFF)/255.0; ! glColor4f (red, green, blue, 1.0); } } } + else + glColor4f (0.0, 0.0, 0.0, 1.0); } *************** *** 1943,1947 **** const char *val; val = data->GetArgValue("style"); ! if(CIstrstr(val, "fill:white") || CIstrstr(val, "fill:#FFFFFF") || CIstrstr(val, "fill:none") || CIstrstr(val, "fill-opacity:0")) return false; else --- 1909,1913 ---- const char *val; val = data->GetArgValue("style"); ! if(!_allowColor || CIstrstr(val, "fill:white") || CIstrstr(val, "fill:#FFFFFF") || CIstrstr(val, "fill:none") || CIstrstr(val, "fill-opacity:0")) return false; else Index: RGGLSVGDraw.h =================================================================== RCS file: /cvsroot/igarden/CommonSource/YAAFExtensions/RGGLSVGDraw.h,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** RGGLSVGDraw.h 3 Oct 2005 02:20:10 -0000 1.8 --- RGGLSVGDraw.h 15 Nov 2006 12:18:09 -0000 1.8.2.1 *************** *** 50,53 **** --- 50,59 ---- } middleType_t; + typedef enum + { + kUseMonochrome, + kUseColor + } allowColor_t; + class SVGCacheEntry; *************** *** 55,59 **** { public: ! RGGLSVGDraw(); ~RGGLSVGDraw(); ErrorCode Draw(XGFileSpecifier &spec, double xPos, double yPos, double zPos, double xSize, double ySize, double rotate, middleType_t defaultType, bool forcePastBounds); --- 61,65 ---- { public: ! RGGLSVGDraw(allowColor_t color); ~RGGLSVGDraw(); ErrorCode Draw(XGFileSpecifier &spec, double xPos, double yPos, double zPos, double xSize, double ySize, double rotate, middleType_t defaultType, bool forcePastBounds); *************** *** 61,64 **** --- 67,71 ---- void GetInitialSize(XGFileSpecifier &spec, middleType_t defaultType, double &width, double &length); void GetRepeatCounts(XGFileSpecifier &spec, middleType_t defaultType, double width, double length, long &widthCount, long &lengthCount); + void EnableColor(bool useColor); private: |