public jpeg_save_markers ( int marker_code, int length_limit ) : void | ||
marker_code | int | The marker type to save (see JPEG_MARKER enumeration). /// To arrange to save all the special marker types, you need to call this /// routine 17 times, for COM and APP0-APP15 markers. |
length_limit | int | If the incoming marker is longer than |
Результат | void |
public void TestMarkerList() { jpeg_decompress_struct cinfo = new jpeg_decompress_struct(); using (FileStream input = new FileStream(Path.Combine(Tester.Testcase, "PARROTS.JPG"), FileMode.Open)) { /* Specify data source for decompression */ cinfo.jpeg_stdio_src(input); const int markerDataLengthLimit = 1000; cinfo.jpeg_save_markers((int)JPEG_MARKER.COM, markerDataLengthLimit); cinfo.jpeg_save_markers((int)JPEG_MARKER.APP0, markerDataLengthLimit); /* Read file header, set default decompression parameters */ cinfo.jpeg_read_header(true); Assert.AreEqual(cinfo.Marker_list.Count, 3); int[] expectedMarkerType = { (int)JPEG_MARKER.APP0, (int)JPEG_MARKER.APP0, (int)JPEG_MARKER.COM }; int[] expectedMarkerOriginalLength = { 14, 3072, 10 }; for (int i = 0; i < cinfo.Marker_list.Count; ++i) { jpeg_marker_struct marker = cinfo.Marker_list[i]; Assert.IsNotNull(marker); Assert.AreEqual(marker.Marker, expectedMarkerType[i]); Assert.AreEqual(marker.OriginalLength, expectedMarkerOriginalLength[i]); Assert.LessOrEqual(marker.Data.Length, markerDataLengthLimit); } } }