changed this somehow

Fork of NeoStrip by Allen Wild

Revision:
1:cf7e969704ec
diff -r 9f237b11f0a8 -r cf7e969704ec TextMask.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextMask.cpp	Fri Apr 25 14:39:19 2014 +0000
@@ -0,0 +1,266 @@
+#include "TextMask.h"
+
+
+int maskA[20] = { 0, 1, 0, 0, 
+                  1, 0, 1, 0, 
+                  1, 0, 1, 0, 
+                  1, 1, 1, 0, 
+                  1, 0, 1, 0};
+
+int maskB[20] = { 0, 1, 0, 0,
+                  1, 0, 1, 0, 
+                  1, 1, 0, 0,
+                  1, 0, 1, 0,
+                  1, 1, 0, 0};
+
+int maskC[20] = { 0, 1, 1, 0, 
+                  1, 0, 0, 0, 
+                  1, 0, 0, 0, 
+                  1, 0, 0, 0, 
+                  0, 1, 1, 0};
+                  
+int maskD[20] = { 1, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 1, 0, 0};
+                
+int  maskE[20] = { 1, 1, 1, 0, 
+                1, 0, 0, 0, 
+                1, 1, 1, 0, 
+                1, 0, 0, 0, 
+                1, 1, 1, 0};
+    
+int maskF[20] = { 1, 1, 1, 0, 
+                1, 0, 0, 0, 
+                1, 1, 1, 0, 
+                1, 0, 0, 0, 
+                1, 0, 0, 0};
+    
+int maskG[20] = { 0, 1, 1, 0, 
+                1, 0, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                0, 1, 1, 0};
+                
+int maskH[20] = { 1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 1, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0};
+                
+int maskI[20] = { 1, 1, 1, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0, 
+                1, 1, 1, 0};
+      
+int maskJ[20] = { 1, 1, 1, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0, 
+                1, 1, 0, 0};
+      
+int maskK[20] = { 1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0};
+      
+int maskL[20] = { 1, 0, 0, 0, 
+                1, 0, 0, 0, 
+                1, 0, 0, 0, 
+                1, 0, 0, 0, 
+                1, 1, 1, 0};
+      
+int maskM[20] = { 1, 0, 0, 1, 
+                1, 1, 1, 1, 
+                1, 1, 1, 1, 
+                1, 0, 0, 1, 
+                1, 0, 0, 1};
+                
+int maskN[20] = { 1, 0, 0, 1, 
+                1, 1, 0, 1, 
+                1, 1, 1, 1, 
+                1, 0, 1, 1, 
+                1, 0, 0, 1};
+                
+int maskO[20] = { 0, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                0, 1, 0, 0};
+                
+int maskP[20] = { 1, 1, 1, 0, 
+                1, 0, 1, 0, 
+                1, 1, 1, 0, 
+                1, 0, 0, 0, 
+                1, 0, 0, 0};
+                
+int maskQ[20] = { 0, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                0, 1, 0, 1};
+                
+int maskR[20] = { 1, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0};
+                
+int maskS[20] = { 0, 1, 1, 0, 
+                1, 0, 0, 0, 
+                0, 1, 0, 0, 
+                0, 0, 1, 0, 
+                1, 1, 0, 0};
+                
+int maskT[20] = { 1, 1, 1, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0};
+                
+int maskU[20] = { 1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                0, 1, 1, 0};
+                
+int maskV[20] = { 1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 1, 1, 0, 
+                0, 1, 0, 0};
+                
+int maskW[20] = { 1, 0, 0, 1, 
+                1, 0, 0, 1, 
+                1, 0, 0, 1, 
+                1, 1, 1, 1, 
+                1, 0, 0, 1};
+                
+int maskX[20] = { 1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                0, 1, 0, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0};
+                
+int maskY[20] = { 1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                1, 0, 1, 0, 
+                0, 1, 0, 0, 
+                0, 1, 0, 0};
+                
+int maskZ[20] = { 1, 1, 1, 0, 
+                0, 0, 1, 0, 
+                0, 1, 0, 0, 
+                1, 0, 0, 0, 
+                1, 1, 1, 0};
+                 
+int * getCharMask(char inChar)
+{
+            
+    switch(inChar)
+    {
+        case 'A':
+            return maskA;
+            break;
+        case 'B':
+            return maskB;
+            break;
+        case 'C':
+            return maskC;
+            break;
+        case 'D':
+            return maskD;
+            break;
+        case 'E':
+            return maskE;
+            break;
+        case 'F':
+            return maskF;
+            break;
+        case 'G':
+            return maskG;
+            break;
+        case 'H':
+            return maskH;
+            break;
+        case 'I':
+            return maskI;
+            break;
+        case 'J':
+            return maskJ;
+            break;
+        case 'K':
+            return maskK;
+            break;
+        case 'L':
+            return maskL;
+            break;
+        case 'M':
+            return maskM;
+            break;
+        case 'N':
+            return maskN;
+            break;
+        case 'O':
+            return maskO;
+            break;
+        case 'P':
+            return maskP;
+            break;
+        case 'Q':
+            return maskQ;
+            break;
+        case 'R':
+            return maskR;
+            break;
+        case 'S':
+            return maskS;
+            break;
+        case 'T':
+            return maskT;
+            break;
+        case 'U':
+            return maskU;
+            break;
+        case 'V':
+            return maskV;
+            break;
+        case 'W':
+            return maskW;
+            break;
+        case 'X':
+            return maskX;
+            break;
+        case 'Y':
+            return maskY;
+            break;
+        case 'Z':
+            return maskZ;
+            break;
+    }
+}
+
+void maskChar(NeoStrip strip, int xPos, int yPos, int xDim, int yDim, char inChar)
+{
+    if (inChar > 90 || inChar < 65)
+        return;
+        
+    int * mask = getCharMask(inChar);
+    
+    for (int i = 0; i < 5; i++)
+    {
+        for (int j = 0; j < 4; j++)
+        {
+            int pos = (i+yPos)*xDim + xPos + j;
+            if (!mask[i*4+j])
+                strip.setPixel(pos, 0, 0, 0);
+            //strip.maskPixel(pos, mask[i*4+j];   
+        }        
+    }
+    
+       
+}
+