private byte[][] Build_message(int[] fullImg)
 {
     // just simple check if the total data length = filpdot dots length
     if (fullImg.Length != dotsInFlipdot)
     {
         return(new byte[0][]); // prevent null handling outside
     }
     // initialize the message array
     byte[][] msg = new byte[settings.panels.Length][];
     for (int i = 0; i < settings.panels.Length; i++)
     {
         msg[i] = new byte[settings.panels[i].width];
         PanelDimension panel = settings.panels[i];
         int            xs    = panel.startX;
         int            ys    = panel.startY;
         int            w     = panel.width;
         int            h     = panel.height;
         for (int x = xs; x < xs + w; x++)
         {
             byte cell = 0;
             for (int y = h - 1; y > -1; y--)
             {
                 byte pixel = (fullImg[x + (ys + y) * settings.lineStride] == (int)0 ? (byte)0x00 : (byte)0x01);
                 cell = (byte)(cell << 1);
                 cell = (byte)(cell | pixel);
             }
             msg[i][x - xs] = cell;
         }
     }
     return(msg);
 }
 private void Build_message(int[] fullImg)
 {
     // just simple check if the total data length = filpdot dots length
     // 56 x 28 = 1568
     // need to change later when flipdot hardware change
     if (fullImg.Length != dotsPerFlipdot)
     {
         return;
     }
     for (int i = 0; i < settings.panels.Length; i++)
     {
         PanelDimension panel = settings.panels[i];
         int            xs    = panel.startX; // panels[i][0];
         int            ys    = panel.startY; // panels[i][1];
         int            w     = panel.width;  // panels[i][2];
         int            h     = panel.height; // panels[i][3];
         for (int x = xs; x < xs + w; x++)
         {
             byte cell = 0;
             for (int y = h - 1; y > -1; y--)
             {
                 byte pixel = (fullImg[x + (ys + y) * 56] == (int)0 ? (byte)0x00 : (byte)0x01);
                 cell = (byte)(cell << 1);
                 cell = (byte)(cell | pixel);
             }
             msg[i][x - xs] = cell;
         }
     }
 }
Esempio n. 3
0
    public void DimensionChanged(PanelDimension dimension, string dimensionName)
    {
        if (IsOriginalOwner())
        {
            ResetChartOwnership();

            switch (dimension)
            {
            case PanelDimension.X:
                standardChart.XDimension = dimensionName;
                break;

            case PanelDimension.Y:
                standardChart.YDimension = dimensionName;
                break;

            case PanelDimension.Z:
                standardChart.ZDimension = dimensionName;
                break;

            case PanelDimension.FACETBY:
                if (dimensionName == "Undefined")
                {
                    standardChart.FacetSize      = 1;
                    standardChart.FacetDimension = dimensionName;
                }
                else
                {
                    standardChart.FacetDimension = dimensionName;
                }
                break;

            case PanelDimension.COLORBY:
                standardChart.ColorDimension = dimensionName;
                //splomChart.ColorDimension = dimensionName;
                break;

            case PanelDimension.SIZEBY:
                standardChart.SizeDimension = dimensionName;
                //splomChart.SizeDimension = dimensionName;
                break;

            case PanelDimension.COLORPALETTE:
                standardChart.ColorPaletteDimension = dimensionName;
                //splomChart.ColorPaletteDimension = dimensionName;
                break;

            case PanelDimension.LINKING:
                standardChart.LinkingDimension = dimensionName;
                break;
            }
        }
        else
        {
            photonView.RPC("DimensionChanged", OriginalOwner, dimension, dimensionName);
        }
    }
 public void CreateColorButtons(PanelDimension dimension, string dimensionName)
 {
     if (dimension == PanelDimension.COLORPALETTE)
     {
         if (dimensionName != "Undefined")
         {
             photonView.RPC("CreateColorButtons", RpcTarget.All, dimensionName);
         }
         else
         {
             photonView.RPC("DestroyColorButtons", RpcTarget.All);
         }
     }
 }