Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 1
 
 
Obtener Informaciones De Un File Imagen Con El API De Gdk_pixbuf
Autor Mensaje
Responder citando   Descargar mensaje 
Mensaje Obtener Informaciones De Un File Imagen Con El API De Gdk_pixbuf 
 
Utilizando unas funciones externas de la libreria "libgdk_pixbuf-2.0.so", es posible obtener informaciones de un archivo imagen.

Ejemplo:

Library "libgdk_pixbuf-2.0"

' GdkPixbuf * gdk_pixbuf_new_from_file (const char *filename, GError **error)
' Creates a new pixbuf by loading an image from a file.
Private Extern gdk_pixbuf_new_from_file(filename As String, gerro As Pointer) As Pointer

' int gdk_pixbuf_get_n_channels (const GdkPixbuf *pixbuf)
' Queries the number of channels of a pixbuf.
Private Extern gdk_pixbuf_get_n_channels(pixbuf As Pointer) As Integer

' gboolean gdk_pixbuf_get_has_alpha (const GdkPixbuf *pixbuf)
' Queries whether a pixbuf has an alpha channel (opacity information).
Private Extern gdk_pixbuf_get_has_alpha(pixbuf As Pointer) As Boolean

' int gdk_pixbuf_get_bits_per_sample (const GdkPixbuf *pixbuf)
' Queries the number of bits per color sample in a pixbuf.
Private Extern gdk_pixbuf_get_bits_per_sample(pixbuf As Pointer) As Integer

' int gdk_pixbuf_get_width (const GdkPixbuf *pixbuf)
' Queries the width of a pixbuf.
Private Extern gdk_pixbuf_get_width(pixbuf As Pointer) As Integer

' int gdk_pixbuf_get_height (const GdkPixbuf *pixbuf)
' Queries the height of a pixbuf.
Private Extern gdk_pixbuf_get_height(pixbuf As Pointer) As Integer

' int gdk_pixbuf_get_rowstride (const GdkPixbuf *pixbuf)
' Queries the rowstride of a pixbuf, which is the number of bytes between the start of a row and the start of the next row.
Private Extern gdk_pixbuf_get_rowstride(pixbuf As Pointer) As Integer

' gsize gdk_pixbuf_get_byte_length (const GdkPixbuf *pixbuf)
' Returns the length of the pixel data, in bytes.
Private Extern gdk_pixbuf_get_byte_length(pixbuf As Pointer) As Long

' void g_object_unref (gpointer object)
' Decreases the reference count of object.
Private Extern g_object_unref(gobject As Pointer)


Public Sub Main()

  Dim pb As Pointer
  Dim i As Integer
  Dim bo As Boolean
  Dim l As Long
  
   pb = gdk_pixbuf_new_from_file("/ruta/del/archivo/imagen", 0)
   If pb = 0 Then Error.Raise("ERROR !")
  
   i = gdk_pixbuf_get_n_channels(pb)
   Print i
  
   bo = gdk_pixbuf_get_has_alpha(pb)
   Print bo
  
   i = gdk_pixbuf_get_bits_per_sample(pb)
   Print i
  
   i = gdk_pixbuf_get_width(pb)
   Print i
  
   i = gdk_pixbuf_get_height(pb)
   Print i
  
   i = gdk_pixbuf_get_rowstride(pb)
   Print i
  
   l = gdk_pixbuf_get_byte_length(pb)
   Print l
  
   g_object_unref(pb)

End

 



 
vuott - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 

Publicar nuevo tema  Responder al tema  Página 1 de 1
 

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron