Tema: Histograma
Ver Mensaje Individual
  #5  
Antiguo 06-07-2008
madiazg madiazg is offline
Miembro
 
Registrado: sep 2005
Ubicación: Canarias
Posts: 120
Reputación: 19
madiazg Va por buen camino
Hola,
para el desarrollo del programa estoy utilizando la librería gráfica GFL SDK. En esta librería se define la función gflGetColorAt:

Cita:
gflGetColorAt: The gflGetColorAt function gets the color at a position of the picture.
GFL_ERROR gflGetColorAt(
GFL_BITMAP * src,
GFL_INT32 x,
GFL_INT32 y,
GFL_COLOR * color
);

Parameters
  • src: Pointer to a GFL_BITMAP structure.
  • x: X position.
  • y:Y position.
  • color: Pointer to a GFL_COLOR structure to obtain the result.
Return value
  • The function returns GFL_NO_ERROR if it is successful or a value of GFL_ERROR.
pgfl_colorSBS es, por tanto, una estructura del tipo GFL_COLOR:

Cita:
GFL_COLOR: The GFL_COLOR structure allow to define a color.
typedef struct (
GFL_UINT16
Red,
GFL_UINT16 Green,
GFL_UINT16 Blue,
GFL_UINT16 Alpha
} GFL_COLOR

Members
  • Red: Define the red component.
  • Green: Define the green component.
  • Blue: Define the blue component.
  • Alpha: Define the alpha component.
GFL_BITMAP:

Cita:
GFL_BITMAP: The GFL_BITMAP structure contains all informations about picture in memory.
typedef struct (
GFL_BITMAP_TYPE
Type,
GFL_ORIGIN Origin,
GFL_INT32 Width,
GFL_INT32 Height,
GFL_UINT32 BytesPerLine,
GFL_INT16 LinePadding,
GFL_UINT16 BitsPerComponent,
GFL_UINT16 ComponentsPerPixel,
GFL_UINT16 BytesPerPixel,
GFL_UINT16 Xdpi,
GFL_UINT16 Ydpi,
GFL_INT16 TransparentIndex,
GFL_INT32 ColorUsed,
GFL_COLORMAP * ColorMap,
GFL_UINT8 * Data,
char * Comment,
void * MetaData
} GFL_BITMAP

Members
  • Type Type of the picture
    • GFL_BINARY 0x0001 Binary
    • GFL_GREY 0x0002 Grey scale
    • GFL_COLORS 0x0004 Colors with colormap
    • GFL_RGB 0x00010 TrueColors - Red/Green/Blue
    • GFL_RGBA 0x0020 TrueColors - Red/Green/Blue/Alpha
    • GFL_BGR 0x0040 TrueColors - Blue/Green/Red
    • GFL_ABGR 0x0080 TrueColors - Alpha/Blue/Green/Red
    • GFL_BGRA 0x0100 TrueColors - Blue/Green/Red/Alpha
    • GFL_ARGB 0x0200 TrueColors - Alpha/Red/Green/Blue
    • GFL_CMYK 0x0400 TrueColors - Cyan/Magenta/Yellow/Black
  • Origin Origin of the picture.
    • GFL_TOP_LEFT 0 Top left (default)
    • GFL_BOTTOM_LEFT 2 Bottom left GFL_TOP_RIGHT 1 Top right
    • GFL_BOTTOM_RIGHT 3 Bottom right
  • Width Width in pixels of the picture.
  • Height Height in pixels of the picture.
  • BytesPerLine Bytes per line of pixels.
  • LinePadding Internal use, do not modify.
  • BitsPerComponent Bits per component, can be 1, 8, 16
  • ComponentsPerPixel Component per pixel, can be 1, 3 or 4
  • BytesPerPixel Bytes per pixel (For example: 1, 3 or 4).
  • Xdpi Pixels per inch in X axis.
  • Ydpi Pixels per inch in Y axis.
  • TransparentIndex Index of transparency (only for GFL_COLORS & GFL_GREY type).
  • ColorUsed Number of color used in the picture (only for GFL_COLORS & GFL_GREY type).
  • ColorMap Address of a GFL_COLORMAP structure for the colormap (only for GFL_COLORS type).
  • Data Pointer of the picture data.
  • Comment Address of a string used by the comment. You must use gflSetComment to change the comment.
  • MetaData Pointer of Metadata. You must use gflBitmapGetIPTC & gflBitmapGetEXIF to obtain readable data.
HMaxSideCal es una variable del tipo Boolean que utilizo para determinar si realizo el cálculo del valor máximo del histograma. Este cálculo sólo lo realizo cuando se carga incialmente la imagen y no lo vuelvo a realizar cuando dicha imagen se refrezca al cambiar el brillo, contraste, saturación, etc...
HMaxSide es el valor máximo del histograma, y es del tipo integer.

GFL_SDK es una librería desarrollada en C y me da algunos quebraderos de cabeza que todavía no he podido resolver (como la obtención de los datos EXIF de una fotografía, lo Metadatos, etc...). Aún así, es muy potente a la hora de 'gestionar' fotografías, tal y como queda demostrado en la aplicación XnView.

Saludos y gracias por el interés...
Miguel Angel
Responder Con Cita