2012-09-12 13:42:42 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
|
|
|
|
*
|
|
|
|
* GPL v2
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __IMAGE_RENDER_H__
|
|
|
|
#define __IMAGE_RENDER_H__
|
|
|
|
|
|
|
|
#include <filetype.h>
|
|
|
|
#include <linux/list.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <linux/err.h>
|
|
|
|
#include <fb.h>
|
2012-09-26 09:59:00 +00:00
|
|
|
#include <gui/image.h>
|
2012-09-26 09:59:02 +00:00
|
|
|
#include <gui/gui.h>
|
2012-09-12 13:42:42 +00:00
|
|
|
|
|
|
|
struct image_renderer {
|
|
|
|
enum filetype type;
|
|
|
|
struct image *(*open)(char *data, int size);
|
|
|
|
void (*close)(struct image *img);
|
2012-09-26 09:59:02 +00:00
|
|
|
int (*renderer)(struct screen *sc, struct surface *s, struct image *img);
|
2012-09-12 13:42:42 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* do not free the data read from the file
|
|
|
|
* needed by bmp support
|
|
|
|
*/
|
|
|
|
int keep_file_data;
|
|
|
|
|
|
|
|
struct list_head list;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef CONFIG_IMAGE_RENDERER
|
|
|
|
int image_renderer_register(struct image_renderer *ir);
|
|
|
|
void image_render_unregister(struct image_renderer *ir);
|
|
|
|
|
2012-09-26 09:59:02 +00:00
|
|
|
int image_renderer_image(struct screen *sc, struct surface *s, struct image *img);
|
2012-09-12 13:42:42 +00:00
|
|
|
|
|
|
|
struct image *image_renderer_open(const char* file);
|
|
|
|
void image_renderer_close(struct image *img);
|
|
|
|
|
|
|
|
#else
|
|
|
|
static inline int image_renderer_register(struct image_renderer *ir)
|
|
|
|
{
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
static inline void image_renderer_unregister(struct image_renderer *ir) {}
|
|
|
|
|
|
|
|
static inline struct image *image_renderer_open(const char* file)
|
|
|
|
{
|
|
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void image_renderer_close(struct image *img) {}
|
|
|
|
|
2012-09-26 09:59:02 +00:00
|
|
|
int image_renderer_image(struct surface *s, struct image *img);
|
2012-09-12 13:42:42 +00:00
|
|
|
#endif
|
|
|
|
|
2012-09-26 09:59:02 +00:00
|
|
|
static inline int image_renderer_file(struct screen *sc, struct surface *s, const char* file)
|
2012-09-12 13:42:42 +00:00
|
|
|
{
|
|
|
|
struct image* img = image_renderer_open(file);
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (IS_ERR(img))
|
|
|
|
return PTR_ERR(img);
|
|
|
|
|
2012-09-26 09:59:02 +00:00
|
|
|
ret = image_renderer_image(sc, s, img);
|
2012-09-12 13:42:42 +00:00
|
|
|
|
|
|
|
image_renderer_close(img);
|
|
|
|
|
2012-10-03 19:12:19 +00:00
|
|
|
return ret;
|
2012-09-12 13:42:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* __IMAGE_RENDERER_H__ */
|