Exemple #1
0
/**
 * itdb_track_get_thumbnail:
 * @track:  an #Itdb_Track
 * @width:  width of the pixbuf to retrieve, -1 for the biggest possible size
 *          (with no scaling)
 * @height: height of the pixbuf to retrieve, -1 for the biggest possible size
 *          (with no scaling)
 *
 * Get a thumbnail representing the cover associated with the current track,
 * scaling it if appropriate. If either height or width is -1, then the biggest
 * unscaled thumbnail available will be returned.
 *
 * Returns: a #GdkPixbuf that must be unreffed when no longer used, NULL
 * if no artwork could be found or if libgpod is compiled without GdkPixbuf
 * support
 *
 * Since: 0.7.0
 */
gpointer itdb_track_get_thumbnail (Itdb_Track *track, gint width, gint height)
{
    g_return_val_if_fail (track != NULL, NULL);
    if (!itdb_track_has_thumbnails (track)) {
        return NULL;
    }
    if (track->itdb != NULL) {
        return itdb_thumb_to_pixbuf_at_size (track->itdb->device,
                                             track->artwork->thumbnail,
                                             width, height);
    } else {
        return itdb_thumb_to_pixbuf_at_size (NULL, track->artwork->thumbnail,
                                             width, height);
    }
}
/**
 * itdb_artwork_get_pixbuf:
 * @artwork:    an #Itdb_Artwork
 * @device:     an #Itdb_Device
 * @width:      width of the pixbuf to retrieve, -1 for the biggest
 *              possible size and 0 for the smallest possible size (with no
 *              scaling)
 * @height:     height of the pixbuf to retrieve, -1 for the biggest possible
 *              size and 0 for the smallest possible size (with no scaling)
 *
 * Returns a #GdkPixbuf representing the thumbnail stored in @artwork
 * scaling it if appropriate. If either height or width is -1, then the
 * biggest unscaled thumbnail available will be returned
 *
 * Returns: a #GdkPixbuf that must be unreffed when no longer used, NULL
 * if no artwork could be found or if libgpod is compiled without GdkPixbuf
 * support
 *
 * Since: 0.7.0
 */
gpointer itdb_artwork_get_pixbuf (Itdb_Device *device, Itdb_Artwork *artwork,
                                  gint width, gint height)
{
    g_return_val_if_fail (artwork != NULL, NULL);
    if (artwork->thumbnail == NULL) {
        return NULL;
    }
    return itdb_thumb_to_pixbuf_at_size (device, artwork->thumbnail,
                                         width, height);
}