Hallo zusammen,
ich verwende für ein Projekt die Advanced Image Library, ein VB-Wrapper für die Free Image Library. Leider sind da noch nicht alle Funktionen umgesetzt und ich bräuchte die Möglichkeit, ICC-Profile in Bitmaps einzulesen. In der Dokumentation zu Free Image sind nur Beispiele für C/C++ angegeben.
Da meine Kenntnisse hier nur sehr minimal sind, könnte mir vielleicht jemand bei der Übersetzung des Teils "read profile data from file and zero-terminate" helfen?
Das Öffnen der Profildatei, Auslesen der Dateigröße und Anfügen der Daten ist kein Problem.
' Creates a new FIICCPROFILE block from ICC profile data previously read from a
' 'file or built by a color management system. The profile data are attached to _
the bitmap. 'The function returns a pointer to the FIICCPROFILE structure
' created.
'
' Example Code:
'
' // this code assumes there is a bitmap loaded and
' // present in a variable called 'bitmap'
' DWORD size = _filelength(fileno(hProfile));
'
' // read profile data from file and zero-terminate
' if (size && (data = (void *)malloc(size + 1))) {
' size = fread(data, 1, size, hProfile);
' *(data + size) = 0;
'
' // attach retrieved profile data to bitmap
' FIICCPROFILE *profile = FreeImage_CreateICCProfile (bitmap, data, size);
' free (data);
' }
'------------------------------------------------------------------------------
' -------------------------------
'DLL_API FIICCPROFILE *DLL_CALLCONV FreeImage_CreateICCProfile(FIBITMAP *dib,
' void *data, long size);
'------------------------------------------------------------------------------
' -------------------------------
Public Declare Function FreeImage_CreateICCProfile Lib "FreeImage3.dll" _
Alias "_FreeImage_CreateICCProfile@12" (ByVal fiBITMAP As Long, _
ByRef Data As Any, ByVal lngSize As Long) As Long Ach ja, die Struktur von FIICPROFILE:
' ICC profile support
Public Type FIICCPROFILE
Flags As Integer '// WORD - Info flag
Size As Long '// DWORD - Profile's size measured in bytes
Data() As Byte '// void * - Points to a block of contiguous memory
' containing the 'profile
End Type Gru?, Stefan |