![]() |
![]() |
| Paypal | FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
|||||||
| Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
![]() |
|
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
|||
|
|||
|
Traducción de C a Delphi
Hola,
a ver si alguien me puede ayudar. Resulta que estoy programando una aplicación para realizar imágenes en 3D (anaglifas, Side-by-Side y Gif)(http://imagen3d.site88.net/) y quiero obtener los datos EXIF de los ficheros que cargo. Utilizo una librería denominada gflLib utilizada en el programa XnView (http://www.xnview.com/). Por lo visto, para mostrar los datos, en C se utilizaría el siguiente código: Código:
exif = gflBitmapGetEXIF(bitmap, 0);
if (exif)
{
for ( i=0; i<exif->NumberOfItems; i++)
printf("EXIF %x %x <%s> = %s\n", exif->ItemsList[i].Flag, exif->ItemsList[i].Tag, exif->ItemsList[i].Name, exif->ItemsList[i].Value );
gflFreeEXIF(exif);
}
Código:
// EXIF
const
GFL_EXIF_MAIN_IFD = $0001;
GFL_EXIF_IFD_0 = $0002;
GFL_EXIF_INTEROPERABILITY_IFD = $0004;
GFL_EXIF_IFD_THUMBNAIL = $0008;
GFL_EXIF_GPS_IFD = $0010;
GFL_EXIF_MAKERNOTE_IFD = $0020;
GFL_EXIF_MAKER = $010F;
GFL_EXIF_MODEL = $0110;
GFL_EXIF_ORIENTATION = $0112;
GFL_EXIF_EXPOSURETIME = $829A;
GFL_EXIF_FNUMBER = $829D;
GFL_EXIF_DATETIME_ORIGINAL = $9003;
GFL_EXIF_SHUTTERSPEED = $9201;
GFL_EXIF_APERTURE = $9202;
GFL_EXIF_MAXAPERTURE = $9205;
GFL_EXIF_FOCALLENGTH = $920A;
type
PGFL_EXIF_ENTRY = ^TGFL_EXIF_ENTRY;
TGFL_EXIF_ENTRY = packed record
Flag : GFL_UINT32; // EXIF_...IFD
Tag : GFL_UINT32;
Name : PChar;
Value : PChar;
end;
PTTabGFL_EXIF_ENTRY = ^TTabGFL_EXIF_ENTRY;
TTabGFL_EXIF_ENTRY = array [0..0] of TGFL_EXIF_ENTRY;
PGFL_EXIF_DATA = ^TGFL_EXIF_DATA;
TGFL_EXIF_DATA = packed record
NumberOfItems : GFL_UINT32;
ItemsList : PTTabGFL_EXIF_ENTRY; // PGFL_EXIF_ENTRY;
end;
function gflBitmapHasEXIF(src: PGFL_BITMAP): GFL_BOOL; stdcall;
function gflBitmapGetEXIF(src: PGFL_BITMAP; flags: GFL_UINT32): PGFL_EXIF_DATA; stdcall;
procedure gflFreeEXIF(exif: PGFL_EXIF_DATA); stdcall;
procedure gflBitmapRemoveEXIFThumbnail(src: PGFL_BITMAP); stdcall;
Pueden ayudarme a traducir este código a Delphi ya que no conozco C. Saludos... Miguel Angel Última edición por madiazg fecha: 02-08-2008 a las 12:57:08. |
|
#2
|
||||
|
||||
|
Parece que la función gflBitmapGetEXIF devuelve un puntero a una estructura. Necesitas saber como esta definida esa estructura.
|
|
#3
|
|||
|
|||
|
He editado el mensaje con el código que aparece en gflLib.pas
Saludos... Miguel Angel |
|
#4
|
|||
|
|||
|
Hola, solo tienes que sustituir {} por begin, end; el if exif por if assigned(exif) o exif <> nil, el for i;;i++ por for i := 0 to exif.Numbers, las -> por ., el printf() ... pues no se, con ShowMessage(format(...)), alla el printf es solo para sacar datos a pantalla, sino esta redireccionada cout..si va para un archivo o algo, Format('..',[array]) se comporta de manera similar. exif probablemente sera TGFL_EXIF_ENTRY, aunque tambien es posible que sea puntero a esto, PGLF_EXIF_ENTRY
PD : Código:
TTabGFL_EXIF_ENTRY = array [0..0] of TGFL_EXIF_ENTRY; Última edición por coso fecha: 02-08-2008 a las 13:38:40. |
|
#5
|
|||
|
|||
|
Hola, he implementado este código:
Código:
var
EXIF : PGFL_EXIF_DATA;
NItems : integer;
gfl_bmp1b: PGFL_BITMAP; // Estructura que contiene todas la información sobre una imagen cargada en memoria
...
begin
......
if gflBitMapHasEXIF(gfl_bmp1b) = gfl_no_error then
begin
LabelEXIF.Enabled := True;
Exif := gflLoadExif(Pchar(FileName1),0);
NItems := Exif.NumberOfItems;
for i := 0 to NItems-1 do
begin
FormPrincipal.ListBox1.Items.Add(Exif.ItemsList[i].Name + ': ' + Exif.ItemsList[i].Value);
end;
gflFreeEXIF(Exif);
end else MessageDlg('File not readable: ' + string(gflGetErrorString(e1)), mtError, [mbOK], 0);
|
![]() |
|
|
Temas Similares
|
||||
| Tema | Autor | Foro | Respuestas | Último mensaje |
| Traducción de JS a Delphi: FOR e ¿incrementos? | Delphius | HTML, Javascript y otros | 4 | 01-06-2007 22:09:11 |
| Traduccion de función VB a delphi !!! | Jan_polero | API de Windows | 2 | 07-02-2005 12:32:54 |
| existe traduccion de Delphi al castellano? | miguel_fr | Varios | 1 | 23-06-2004 04:01:27 |
| Recurso traduccion Delphi 6 | Repelus | Varios | 1 | 18-03-2004 20:13:11 |
|