Changeset 789
- Timestamp:
- 05/29/18 15:40:49 (7 years ago)
- Location:
- cpp/frams/canvas
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/canvas/canvasutil.cpp
r286 r789 5 5 #include "canvasutil.h" 6 6 7 static int std_unknown_symbol[] ={12, 1,4, 25,25, 75,25, 75,75, 25,75, 25,25};8 static int std_neuron_symbol[] ={12, 1,4, 75,50, 25,0, 25,99, 75,50, 100,50};9 static int std_inputonly_symbol[] ={14, 1,5, 25,40, 35,40, 45,50, 35,60, 25,60, 25,40};10 static int std_outputonly_symbol[] ={18, 1,7, 75,50, 75,60, 55,60, 65,50, 55,40, 75,40, 75,50, 100,50};7 static int std_unknown_symbol[] = { 12, 1, 4, 25, 25, 75, 25, 75, 75, 25, 75, 25, 25 }; 8 static int std_neuron_symbol[] = { 12, 1, 4, 75, 50, 25, 0, 25, 99, 75, 50, 100, 50 }; 9 static int std_inputonly_symbol[] = { 14, 1, 5, 25, 40, 35, 40, 45, 50, 35, 60, 25, 60, 25, 40 }; 10 static int std_outputonly_symbol[] = { 18, 1, 7, 75, 50, 75, 60, 55, 60, 65, 50, 55, 40, 75, 40, 75, 50, 100, 50 }; 11 11 12 int* drawNeuroSymbol(CanvasDrawing* c, NeuroClass* cl,int x,int y,int w,int h)12 int* drawNeuroSymbol(CanvasDrawing* c, NeuroClass* cl, int x, int y, int w, int h) 13 13 { 14 int *data=std_unknown_symbol;15 if (cl)14 int *data = std_unknown_symbol; 15 if (cl) 16 16 { 17 data=cl->getSymbolGlyph();18 if (!data)17 data = cl->getSymbolGlyph(); 18 if (!data) 19 19 { 20 if (cl->getPreferredInputs()==0)21 data=std_outputonly_symbol;22 else if (cl->getPreferredOutput()==0)23 data=std_inputonly_symbol;24 else data=std_neuron_symbol;20 if (cl->getPreferredInputs() == 0) 21 data = std_outputonly_symbol; 22 else if (cl->getPreferredOutput() == 0) 23 data = std_inputonly_symbol; 24 else data = std_neuron_symbol; 25 25 } 26 26 } 27 drawVector(c,data,x,y,w,h);28 return data;27 drawVector(c, data, x, y, w, h); 28 return data; 29 29 } 30 30 31 void drawVector(CanvasDrawing* c, int data[],int x,int y,int w,int h)31 void drawVector(CanvasDrawing* c, int data[], int x, int y, int w, int h) 32 32 { 33 if (!data) return;34 Pixel p;35 data++;36 for (int NL=*(data++);NL>0;NL--)33 if (!data) return; 34 Pixel p; 35 data++; 36 for (int NL = *(data++); NL > 0; NL--) 37 37 { 38 int NS=*(data++);39 p.x=x+(*(data++)*w)/100;40 p.y=y+(*(data++)*h)/100;41 c->moveTo(p);42 for (;NS>0;NS--)38 int NS = *(data++); 39 p.x = x + (*(data++)*w) / 100; 40 p.y = y + (*(data++)*h) / 100; 41 c->moveTo(p); 42 for (; NS > 0; NS--) 43 43 { 44 p.x=x+(*(data++)*w)/100;45 p.y=y+(*(data++)*h)/100;46 c->lineTo(p);44 p.x = x + (*(data++)*w) / 100; 45 p.y = y + (*(data++)*h) / 100; 46 c->lineTo(p); 47 47 } 48 48 } -
cpp/frams/canvas/nn_simple_layout.cpp
r286 r789 38 38 for (i = 0; i < a; i++) 39 39 { 40 41 42 40 if (e >= N) return; 41 nn->SetXYWH(e, 70 * i + ((i + j) & 3) * 4, 70 * j + ((2 + i + j) & 3) * 4, 50, 50); 42 e++; 43 43 } 44 44 }
Note: See TracChangeset
for help on using the changeset viewer.