Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 02-08-2008
madiazg madiazg is offline
Miembro
 
Registrado: sep 2005
Ubicación: Canarias
Posts: 120
Poder: 19
madiazg Va por buen camino
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); 
   }
En gflLib.pas aparece:

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;
No se si con estos datos es suficiente.
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.
Responder Con Cita
  #2  
Antiguo 02-08-2008
Avatar de seoane
[seoane] seoane is offline
Miembro Premium
 
Registrado: feb 2004
Ubicación: A Coruña, España
Posts: 3.717
Poder: 24
seoane Va por buen camino
Parece que la función gflBitmapGetEXIF devuelve un puntero a una estructura. Necesitas saber como esta definida esa estructura.
Responder Con Cita
  #3  
Antiguo 02-08-2008
madiazg madiazg is offline
Miembro
 
Registrado: sep 2005
Ubicación: Canarias
Posts: 120
Poder: 19
madiazg Va por buen camino
He editado el mensaje con el código que aparece en gflLib.pas
Saludos...
Miguel Angel
Responder Con Cita
  #4  
Antiguo 02-08-2008
[coso] coso is offline
Miembro Premium
 
Registrado: may 2008
Ubicación: Girona
Posts: 1.678
Poder: 0
coso Va por buen camino
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;
¿esto ya es correcto? ¿no serà array dinamico, esto es, array of TGFL_EXIT_ENTRY?

Última edición por coso fecha: 02-08-2008 a las 13:38:40.
Responder Con Cita
  #5  
Antiguo 02-08-2008
madiazg madiazg is offline
Miembro
 
Registrado: sep 2005
Ubicación: Canarias
Posts: 120
Poder: 19
madiazg Va por buen camino
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);
Funciona correctamente. Gracias!!!!
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

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


La franja horaria es GMT +2. Ahora son las 21:26:40.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi