Structure to define CIE XYZ.
Exemple #1
0
        public ColorTable(string palettedata)
        {
            Colors = new Dictionary<string, ColorRecord>();
            string[] lines = palettedata.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
            foreach (var line in lines)
            {
                if (line.StartsWith("COLS"))
                {
                    COLS = RleParser.StripLenFromString(line.Substring(4).Trim()).Trim(RleParser.Term); //TODO: what does it mean?
                    Name = line.Trim(RleParser.Term).Substring(line.LastIndexOf("NIL") + 3);
                    ObjectId = Convert.ToInt32(COLS.Substring(2, 5));
                }
                if (line.StartsWith("CCIE"))
                {
                    // Yxy -> XYZ conversion
                    double x = double.Parse(
                        RleParser.StripLenFromString(line.Substring(4).Trim()).Substring(
                            5).Split(RleParser.Term)[0], CultureInfo.InvariantCulture);
                    double y = double.Parse(line.Trim().Split(RleParser.Term)[1],
                                            CultureInfo.InvariantCulture);
                    double Y = double.Parse(line.Trim().Split(RleParser.Term)[2],
                                               CultureInfo.InvariantCulture);

                    CIEYxy color = new CIEYxy(Y, x, y);
                    Colors.Add(RleParser.StripLenFromString(line.Substring(4).Trim()).Substring(0, 5),
                               new ColorRecord(RleParser.StripLenFromString(line.Substring(4).Trim()).Substring(0, 5),
                                               line.Trim().Split(RleParser.Term)[3], color
                                   ));
                }
            }
        }
Exemple #2
0
 /// <summary>
 /// Converts CIEYxy to CIEXYZ structure.
 /// </summary>
 public static CIEXYZ YxytoXYZ(CIEYxy Yxy)
 {
     return YxytoXYZ(Yxy.Y, Yxy.x, Yxy.y);
 }
Exemple #3
0
 /// <summary>
 /// Converts CIEYxy to CIEXYZ structure.
 /// </summary>
 public static CIEXYZ YxytoXYZ(CIEYxy Yxy)
 {
     return(YxytoXYZ(Yxy.Y, Yxy.x, Yxy.y));
 }
Exemple #4
0
 private void buttonCommitColorChange_Click(object sender, EventArgs e)
 {
     CIEYxy yxy = new CIEYxy((double)numericUpDownEditColorY.Value, (double)numericUpDownEditColorx.Value,
                             (double)numericUpDownEditColory1.Value);
     if (yxy.x > 0 && yxy.y > 0)
     {
         parser.ColorTables[comboBoxColorTablesList.SelectedItem.ToString()].Colors[
             listViewColorTable.FocusedItem.Text].Yxy = yxy;
         FillColorTableView(comboBoxColorTablesList.SelectedItem.ToString());
     }
     changesSaved = false;
 }
Exemple #5
0
 private void ShowColorChanges()
 {
     CIEYxy yxy = new CIEYxy((double)numericUpDownEditColorY.Value, (double)numericUpDownEditColorx.Value,
                             (double)numericUpDownEditColory1.Value);
     if (yxy.x > 0 && yxy.y > 0)
     {
         pictureBoxColorSample.BackColor = Color.FromArgb(255,
                                                          ColorSpaceHelper.XYZtoRGB(ColorSpaceHelper.YxytoXYZ(yxy))
                                                              .Red,
                                                          ColorSpaceHelper.XYZtoRGB(ColorSpaceHelper.YxytoXYZ(yxy))
                                                              .Green,
                                                          ColorSpaceHelper.XYZtoRGB(ColorSpaceHelper.YxytoXYZ(yxy))
                                                              .Blue);
     }
 }
Exemple #6
0
 public ColorRecord(string code, string name, CIEYxy cieyxy)
 {
     Code = code;
     Name = name;
     Yxy = cieyxy;
 }