Exemplo n.º 1
0
        public mainForm()
        {
            InitializeComponent();

            PaletteForm.loadDefaultPalette();
            PaletteForm.lineLengthConstraint = lineLengthConstraint;
        }
Exemplo n.º 2
0
        private void paletteButton_Click(object sender, EventArgs e)
        {
            PaletteForm paletteForm = new PaletteForm();

            paletteForm.currentPath = currentPath;
            paletteForm.ShowDialog();
        }
Exemplo n.º 3
0
        private string ColorToString(Color color)
        {
            switch (imageFormat)
            {
            //8-bit format
            case ImageFormat.ImageFormat8bit:
                return(String.Format("0x{0:X2}", PaletteForm.colorToPaletteIndex(color)));

            //16-bit format
            case ImageFormat.ImageFormat16Bit:
                return(String.Format("0x{0:X4}", (((Int16)1 << 15) |
                                                  (((Int16)color.R & 0xF8) << 7) |
                                                  (((Int16)color.G & 0xF8) << 2) |
                                                  (((Int16)color.B & 0xF8) >> 3))));

            //24-bit format
            case ImageFormat.ImageFormat24Bit:
                return(String.Format("0x00{0:X2}{1:X2}{2:X2}", color.R, color.G, color.B));
            }
            ;
            return(""); //not reachable line indeed
        }