Added support for iCCP and cHRM chunks.
This commit is contained in:
		
							parent
							
								
									4ad99d6769
								
							
						
					
					
						commit
						e6ea2bfd35
					
				@ -153,7 +153,7 @@
 | 
				
			|||||||
        End While
 | 
					        End While
 | 
				
			||||||
    End Sub
 | 
					    End Sub
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Private Function BigEndianUInt32(ByRef buf As Byte(), Optional offset As Integer = 0) As UInt32
 | 
					    Private Function BigEndianUInt32(ByRef buf As Byte(), Optional offset As Integer = 0) As UInteger
 | 
				
			||||||
        Return &H1000000L * buf(0 + offset) + &H10000L * buf(1 + offset) + &H100L * buf(2 + offset) + buf(3 + offset)
 | 
					        Return &H1000000L * buf(0 + offset) + &H10000L * buf(1 + offset) + &H100L * buf(2 + offset) + buf(3 + offset)
 | 
				
			||||||
    End Function
 | 
					    End Function
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -262,13 +262,31 @@
 | 
				
			|||||||
                End If
 | 
					                End If
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            Case "tEXt"
 | 
					            Case "tEXt"
 | 
				
			||||||
                Dim keywordlength As Integer = Array.FindIndex(data, Function(x) x = &H0) - 1
 | 
					                Dim keywordlength As Integer = Array.FindIndex(data, Function(x) x = &H0)
 | 
				
			||||||
                Dim keyword(keywordlength - 1) As Byte
 | 
					                Dim keyword(keywordlength - 1) As Byte
 | 
				
			||||||
                Dim textstring(data.Length - keywordlength - 1 - 1) As Byte
 | 
					                Dim textstring(data.Length - keywordlength - 1 - 1) As Byte
 | 
				
			||||||
                Array.Copy(data, 0, keyword, 0, keywordlength)
 | 
					                Array.Copy(data, 0, keyword, 0, keywordlength)
 | 
				
			||||||
                Array.Copy(data, keywordlength + 1, textstring, 0, data.Length - keywordlength - 1)
 | 
					                Array.Copy(data, keywordlength + 1, textstring, 0, data.Length - keywordlength - 1)
 | 
				
			||||||
                Console.WriteLine("keyword: {0}", System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(keyword))
 | 
					                Console.WriteLine("keyword: {0}", System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(keyword))
 | 
				
			||||||
                Console.WriteLine("value: {0}", System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(textstring))
 | 
					                Console.WriteLine("value: {0}", System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(textstring))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Case "iCCP"
 | 
				
			||||||
 | 
					                Dim namelength As Integer = Array.FindIndex(data, Function(x) x = &H0)
 | 
				
			||||||
 | 
					                Dim profilename(namelength - 1) As Byte
 | 
				
			||||||
 | 
					                Array.Copy(data, 0, profilename, 0, namelength)
 | 
				
			||||||
 | 
					                Console.WriteLine("profile name: {0}", System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(profilename))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            Case "cHRM"
 | 
				
			||||||
 | 
					                Dim offset As Integer = 0
 | 
				
			||||||
 | 
					                For Each pointname As String In {"white point", "red", "green ", "blue"}
 | 
				
			||||||
 | 
					                    Dim xcounts, ycounts As UInteger
 | 
				
			||||||
 | 
					                    xcounts = BigEndianUInt32(data, offset)
 | 
				
			||||||
 | 
					                    ycounts = BigEndianUInt32(data, offset + 4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    Console.WriteLine("{0}: x = {1:g} y = {2:g}", pointname, xcounts / 100000.0, ycounts / 100000.0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    offset += 8
 | 
				
			||||||
 | 
					                Next
 | 
				
			||||||
        End Select
 | 
					        End Select
 | 
				
			||||||
    End Sub
 | 
					    End Sub
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user