예제 #1
0
    public void SaveAnnotationPicture()
    {
        // Save current record to the records
        SaveCurrentRecord();
        if (!Directory.Exists(Path.Combine(data.source_directory, "pic")))
        {
            Directory.CreateDirectory(Path.Combine(data.source_directory, "pic"));
        }

        foreach (var record in data.records)
        {
            // Create a blank texture
            var texture = ImageWindow.CreateBlankTexture(record.width, record.height);
            foreach (var annotation in record.annotations)
            {
                texture = annotation.SetPixels(texture, Color.black, radius: 1);
            }
            texture.Apply();
            byte[] _bytes = texture.EncodeToPNG();

            string path = Path.Combine(data.source_directory, "pic", record.filename + ".png");
            System.IO.File.WriteAllBytes(path, _bytes);
        }
    }