Exemple #1
0
 //make images and save paths here for it
 public GifFrame(int dur, Image image, string name, string newPath, int frame)
 {
     this.FDuration  = dur;
     this.FImage     = image;
     this.Frame      = frame;
     this.FImagePath = newPath + name + "_" + frame + ".png";
     FImage.Save(FImagePath, ImageFormat.Png);
     ;
 }
Exemple #2
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);
        }