Esempio n. 1
0
 protected void SetColors()
 {
     MidiNoteColors         = new NoteCol[trackcount * 16];
     OriginalMidiNoteColors = new NoteCol[trackcount * 16];
     for (int i = 0; i < OriginalMidiNoteColors.Length; i++)
     {
         int r, g, b;
         HsvToRgb((i * 40) % 360, 1, 1, out r, out g, out b);
         OriginalMidiNoteColors[i] = new NoteCol()
         {
             rgba  = NoteCol.Compress((byte)r, (byte)g, (byte)b, 255),
             rgba2 = NoteCol.Compress((byte)r, (byte)g, (byte)b, 255),
         };
     }
 }
Esempio n. 2
0
        public void SetColors(Bitmap img, bool randomise)
        {
            Random r = new Random();

            double[] order  = new double[trackcount * 16];
            int[]    coords = new int[trackcount * 16];
            for (int i = 0; i < order.Length; i++)
            {
                order[i]  = r.NextDouble();
                coords[i] = i;
            }
            if (randomise)
            {
                Array.Sort(order, coords);
            }
            for (int i = 0; i < trackcount; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    int y = coords[i * 16 + j];
                    int x = y % 16;
                    y  = y - x;
                    y /= 16;
                    System.Drawing.Color col;
                    if (img.Width == 16)
                    {
                        col = img.GetPixel(x, y % img.Height);
                        OriginalMidiNoteColors[i * 16 + j].rgba  = NoteCol.Compress(col.R, col.G, col.B, col.A);
                        OriginalMidiNoteColors[i * 16 + j].rgba2 = NoteCol.Compress(col.R, col.G, col.B, col.A);
                    }
                    else
                    {
                        col = img.GetPixel(x * 2, y % img.Height);
                        OriginalMidiNoteColors[i * 16 + j].rgba = NoteCol.Compress(col.R, col.G, col.B, col.A);
                        col = img.GetPixel(x * 2 + 1, y % img.Height);
                        OriginalMidiNoteColors[i * 16 + j].rgba2 = NoteCol.Compress(col.R, col.G, col.B, col.A);
                    }
                }
            }
        }