/* gui_image.c - GUI component to display an image. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/gui_string_util.h>
#include <grub/bitmap_scale.h>
struct grub_gui_image
{
char *id;
char *theme_dir;
};
static void
{
/* Free the scaled bitmap, unless it's a reference to the raw bitmap. */
if (self->raw_bitmap)
}
static const char *
{
}
static int
{
}
static void
{
return;
return;
0, 0, 0, 0,
}
static void
{
}
static grub_gui_container_t
{
}
static grub_err_t
{
signed width;
signed height;
if (! self->raw_bitmap)
{
{
}
return grub_errno;
}
{
/* Nothing to do; already the right size. */
return grub_errno;
}
/* Free any old scaled bitmap,
*unless* it's a reference to the raw bitmap. */
/* Create a scaled bitmap, unless the requested size is the same
as the raw size -- in that case a reference is made. */
{
return grub_errno;
}
/* Don't scale to an invalid size. */
return grub_errno;
/* Create the scaled bitmap. */
if (grub_errno != GRUB_ERR_NONE)
{
grub_error_push ();
}
return grub_errno;
}
static void
{
}
static void
{
}
/* FIXME: inform rendering system it's not forced minimum. */
static void
{
if (self->raw_bitmap)
{
}
else
{
*width = 0;
*height = 0;
}
}
static grub_err_t
{
return grub_errno;
if (self->raw_bitmap)
return rescale_image (self);
}
static grub_err_t
{
{
}
{
char *absvalue;
/* Resolve to an absolute path. */
if (! absvalue)
return grub_errno;
return err;
}
{
if (value)
else
}
return grub_errno;
}
{
.destroy = image_destroy,
.get_id = image_get_id,
.paint = image_paint,
};
grub_gui_image_new (void)
{
if (! image)
return 0;
return (grub_gui_component_t) image;
}