예제 #1
0
        public string GetTextOLD()
        {
            // Set up return
            string LReturn = "";

            // initialize Image
            int[,] LDelta = MagicImage.GetSlopes(FImage.GetImage());

            // initialize locals
            Stack LStack = new Stack();

/*
 *                      LStack.Push('M');
 *                      LStack.Push('C');
 *                      LStack.Push('K');
 *                      LStack.Push('A');
 *                      LStack.Push('Y');
 */
            int LHeight = FImage.ImageHeight;
            int LWidth  = (int)LDelta.GetLongLength(1);

            // Hack for % not working on negative numbers. But we don't go below 0 anyway?
            //			int LFix = (int)AStuff[0].Length * 10;
            //			LFix = 0;// should still work right?
            // Do I even use this anymore?

            for (int i = 0; i < LHeight; i++)
            {
                object[] LCurrentBackgroundRow = FBackground[i];

/*
 #if (UGLYHACK || true)
 *                              object[] LClone = FBackground[i];
 #endif
 */
                // Print out k bars of left border
                for (int k = 0; k < 1; k++)
                {
                    for (int j = 0; j < LCurrentBackgroundRow.Length; j++)
                    {
                        LReturn += (LCurrentBackgroundRow[j]);
                    }
                }

                for (int LCount = 0, j = 0; LCount < LWidth; LCount++, j++)
                {
                    // j is position in inner array
                    j %= LCurrentBackgroundRow.Length;
                    // LCount is positon across screen.

                    int LDeltaTemp;
                    // LDeltaTemp is the current slope from ADelta, or 0 if ADelta is invalid

                    LDeltaTemp = LDelta[i, LCount];
                    // old checking code. Now is done automatically.
                    //					if (i >= LDelta.GetLongLength(0) || LCount >= ADelta.GetLongLength(1))
                    //						LDeltaTemp = 0;
                    //					else
                    //						LDeltaTemp = LDelta[i, LCount];

                    // if slope is positive
                    if (LDeltaTemp > 0)
                    {
                        for (int k = 0; k < LDeltaTemp; k++)                         // for each value of slope
                        {
                            LStack.Push(LCurrentBackgroundRow[j]);                   // save the current value for later

                            // and remove it from the current row
                            object[] LTemp = new object[LCurrentBackgroundRow.Length - 1];
                            for (int l = 0; l < LTemp.Length; l++)
                            {
                                LTemp[l] = LCurrentBackgroundRow[l + (l >= j ? 1 : 0)];
                            }
                            LCurrentBackgroundRow = LTemp;

                            // update j as necessary
                            j %= LCurrentBackgroundRow.Length;
                        }
                    }

                    // if slope is positive
                    if (LDeltaTemp < 0)
                    {
                        for (int k = 0; k > LDeltaTemp; k--)                         // for each value of the slope
                        {
                            Object LChixel = LStack.Pop();                           // grab the value on the stack

                            // put it back in the current row at the current position
                            object[] LTemp = new object[LCurrentBackgroundRow.Length + 1];
                            for (int l = 0; l < LTemp.Length; l++)
                            {
                                LTemp[l] = (l == j ? LChixel : LCurrentBackgroundRow[(l > j ? l - 1 : l)]);
                            }
                            LCurrentBackgroundRow = LTemp;

                            // update j as necessary.
                            j %= LCurrentBackgroundRow.Length;
                        }
                    }

                    LReturn += (LCurrentBackgroundRow[j]);
                }


                // Print out k bars of Right border
                for (int k = 0; k < 1; k++)
                {
                    for (int j = 0; j < LCurrentBackgroundRow.Length; j++)
                    {
                        LReturn += (LCurrentBackgroundRow[j]);
                    }
                }

                LReturn += "\r\n";

/*
 #if (!UGLYHACK)
 *                              while (LStack.Count > 0)
 *                              {
 *                                      Character LChar = (Character)LStack.Pop();
 *                                      Character[] LTemp = new Character[FBackground[i].Length + 1];
 *                                      for (int l = 0; l < FBackground[i].Length; l++)
 *                                      {
 *                                              LTemp[l] = (Character)FBackground[i][l];
 *                                      }
 *                                      LTemp[LTemp.Length - 1] = LChar;
 *                                      FBackground[i] = LTemp;
 *                              }
 *
 *                              LStack.Clear();
 #else
 *                              FBackground[i] = LClone;
 #endif
 */
            }
            return(LReturn);
        }
예제 #2
0
        }                                                                                      // minus one for the deltas

        protected object[,] GetStereogram()
        {
            // initialize Image
            int[,] LDelta = MagicImage.GetSlopes(FImage.GetImage());

            // initialize locals
            Stack LStack = new Stack();

            // (Add objects to the stack?)
//			int LHeight = FImage.ImageHeight;
//			int LWidth = (int)LDelta.GetLongLength(1);

            // Set up return
            object[,] LReturn = new object[Height, Width];

            for (int i = 0; i < Height; i++)
            {
                object[] LCurrentBackgroundRow = FBackground[i];

                // The position in the image
                int x = 0;

                // Print out k bars of left border

                for (int k = 0; k < 1; k++)
                {
                    for (int j = 0; j < LCurrentBackgroundRow.Length; j++)
                    {
                        LReturn[i, x++] = (LCurrentBackgroundRow[j]);
                    }
                }
                int LOffset = x;

                for (int j = 0; x < Width; x++, j++)
                {
                    // j is position in background row
                    j %= LCurrentBackgroundRow.Length;

                    // LDeltaTemp is the current slope from ADelta, or 0 if ADelta is invalid
                    int LDeltaTemp = LDelta[i, x - LOffset];

                    // if slope is positive
                    if (LDeltaTemp > 0)
                    {
                        for (int k = 0; k < LDeltaTemp; k++)                         // for each value of slope
                        {
                            LStack.Push(LCurrentBackgroundRow[j]);                   // save the current value for later

                            // and remove it from the current row
                            object[] LTemp = new object[LCurrentBackgroundRow.Length - 1];
                            for (int l = 0; l < LTemp.Length; l++)
                            {
                                LTemp[l] = LCurrentBackgroundRow[l + (l >= j ? 1 : 0)];
                            }
                            LCurrentBackgroundRow = LTemp;

                            // update j as necessary
                            j %= LCurrentBackgroundRow.Length;
                        }
                    }

                    // if slope is positive
                    if (LDeltaTemp < 0)
                    {
                        for (int k = 0; k > LDeltaTemp; k--)                         // for each value of the slope
                        {
                            Object LChixel = LStack.Pop();                           // grab the value on the stack

                            // put it back in the current row at the current position
                            object[] LTemp = new object[LCurrentBackgroundRow.Length + 1];
                            for (int l = 0; l < LTemp.Length; l++)
                            {
                                LTemp[l] = (l == j ? LChixel : LCurrentBackgroundRow[(l > j ? l - 1 : l)]);
                            }
                            LCurrentBackgroundRow = LTemp;

                            // update j as necessary.
                            j %= LCurrentBackgroundRow.Length;
                        }
                    }



                    LReturn[i, x] = (LCurrentBackgroundRow[j]);
                }

                /*
                 *
                 * // K more sets
                 * for (int k = 0; k < 1; k++)
                 *      for(int j = 0; j < LCurrentBackgroundRow.Length; j++)
                 *              LReturn[i,x++] = (LCurrentBackgroundRow[j]);
                 */
            }
            return(LReturn);
        }
예제 #3
0
 // Constructor
 public TextGenerator(MagicImage AImage, MagicBackground ABackground) : base(AImage, ABackground)
 {
 }
예제 #4
0
 public Generator(MagicImage AImage, MagicBackground ABackground)
 {
     FImage      = AImage;
     FBackground = ABackground;
 }