Exemplo n.º 1
0
        private void updateParameters()
        {
            //Console.Write("update param");
            GifImage selectedComponent = componentsTree.GetSelected();

            if (selectedComponent != null)
            {
                int[] tempValues = selectedComponent.GetProperties();

                unbindAnimControlChangeValueEvents();

                numericUpDownX.Value       = tempValues[0];
                numericUpDownY.Value       = tempValues[1];
                numericUpDownCycles.Value  = tempValues[2];
                numericUpDownSpeed.Value   = tempValues[3];
                comboBoxType.SelectedIndex = tempValues[4];

                bindAnimControlChangeValueEvents();

                unbindTextControlChangeValueEvents();

                FontTextBox.Text             = selectedComponent.GetFont().Name;
                TextEnterBox.Text            = selectedComponent.GetText();
                numericUpDownFontSize.Value  = (decimal)selectedComponent.GetFontSize();
                antialiasingCheckBox.Checked = selectedComponent.GetAntialiasing();

                bindTextControlChangeValueEvents();
            }
            else
            {
                setAllAnimParameters(false);
                setAllTextParameters(false);
                //comboBoxType.Text = "Fixe";
            }

            //numericUpDownX
        }
Exemplo n.º 2
0
        private void updateScreen(PictureBox screen)
        {
            byte[,] screenImgBytes = new byte[640, 160];

            for (int imgCount = 0; imgCount < componentsTree.getSize(); imgCount++)
            {
                GifImage imgRef = componentsTree.GetImg(imgCount);
                byte[,] baseImg = imgRef.GetByteArray();

                int ScreenXoffset = 0;
                int ScreenYoffset = 0;
                int ImgXoffset    = 0;
                int ImgYoffset    = 0;
                int Xcount        = 0;
                int Ycount        = 0;
                int imgRefHeight  = imgRef.GetImgHeight();
                int imgRefWidth   = imgRef.GetImgWidth();

                if (imgRef.GetXoffset() >= 0)
                {
                    ScreenXoffset = imgRef.GetXoffset() * 10;
                }
                else
                {
                    ImgXoffset = imgRef.GetXoffset() * -10;
                }

                if (imgRef.GetYoffset() >= 0)
                {
                    ScreenYoffset = imgRef.GetYoffset() * 10;
                }
                else
                {
                    ImgYoffset = imgRef.GetYoffset() * -10;
                }



                for (int XcountScreen = ScreenXoffset; XcountScreen < screenImgBytes.GetLength(0); XcountScreen++)

                {
                    if (XcountScreen >= (imgRefWidth * 10) + (imgRef.GetXoffset() * 10))
                    {
                        //Console.WriteLine("STOPWidth");
                        break;
                    }
                    for (int YcountScreen = ScreenYoffset; YcountScreen < screenImgBytes.GetLength(1); YcountScreen++)
                    {
                        if (YcountScreen >= (imgRefHeight * 10) + (imgRef.GetYoffset() * 10))
                        {
                            //Console.WriteLine("STOPHeight");
                            break;
                        }
                        //Console.WriteLine("xcount : "+ Xcount + ", imgXoffset : "+ ImgXoffset+ "YcountScreen : " + YcountScreen+ "ImgYoffset : "+ ImgYoffset);
                        byte tempPixelValue = Convert.ToByte(((baseImg[(Xcount + ImgXoffset) / 10, (Ycount + ImgYoffset) / 10]) - 255) * -1);

                        if (screenImgBytes[XcountScreen, YcountScreen] < tempPixelValue)
                        {
                            for (int i = 0; i < 10; i++)
                            {
                                for (int j = 0; j < 10; j++)
                                {
                                    screenImgBytes[XcountScreen + j, YcountScreen + i] = tempPixelValue;
                                }
                            }
                        }

                        YcountScreen += 9;
                        Ycount       += 10;
                    }
                    XcountScreen += 9;
                    Xcount       += 10;
                    Ycount        = 0;
                }
                Console.WriteLine("Xoffset:" + (ImgXoffset));
            }
            Console.WriteLine("array length: " + screenImgBytes.Length);
            screen.Image = ArrayToBitmap(screenImgBytes);
        }