summaryrefslogtreecommitdiff
path: root/fb.c
diff options
context:
space:
mode:
Diffstat (limited to 'fb.c')
-rw-r--r--fb.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/fb.c b/fb.c
index 7981961..2a46987 100644
--- a/fb.c
+++ b/fb.c
@@ -68,36 +68,10 @@ void fb_blank(void)
void fb_loadimage(int screen, const char *path)
{
printf("loading image %s\n", path);
+ convert(path, "/tmp/image.gray", fb.vsi.xres, fb.vsi.yres);
fflush(NULL); sync();
- ExceptionInfo *exception = AcquireExceptionInfo();
-
- printf("reading original image\n");
- ImageInfo *info = CloneImageInfo((ImageInfo*)NULL);
- strcpy(info->filename, path);
- Image *images = ReadImage(info, exception);
-
- printf("resizing\n");
- Image *original = RemoveFirstImageFromList(&images);
- Image *resized = ResizeImage(original, fb.vsi.xres, fb.vsi.yres, LanczosFilter, exception);
- DestroyImage(original);
-
- printf("rotating\n");
- Image *rotated = IntegralRotateImage(resized, 3, exception);
- DestroyImage(rotated);
-
- printf("writing grayscale\n");
- AppendImageToList(&images, rotated);
- strcpy(info->filename, "/tmp/converted.gray");
- WriteImage(info, images, exception);
-
- printf("cleaning up\n");
- DestroyImageList(images);
- DestroyImage(rotated);
- DestroyImageInfo(info);
- DestroyExceptionInfo(exception);
-
- int fd = open("/tmp/converted.gray", O_RDONLY);
+ int fd = open("/tmp/image.gray", O_RDONLY);
if (fd == -1) {
printf("not found\n");
fflush(NULL);
@@ -118,7 +92,7 @@ void fb_loadimage(int screen, const char *path)
printf("copying image..."); fflush(NULL); sync();
unsigned char *buffer = fb.addr + (screen * fb.size / 2);
- memcpy(buffer, img, st.st_size < fb.size ? st.st_size : fb.size);
+ memcpy(buffer, img, st.st_size);
printf("done\n"); fflush(NULL); sync();
munmap(img, st.st_size);
@@ -129,8 +103,6 @@ void fb_loadimage(int screen, const char *path)
void fb_init(void)
{
- MagickCoreGenesis(NULL, MagickFalse);
-
fb.fd = open("/dev/fb0", O_RDWR);
ioctl(fb.fd, FBIOGET_FSCREENINFO, &fb.fsi);