Initialize imlib2
This commit is contained in:
parent
22db1ed361
commit
7121e7b468
2
Makefile
2
Makefile
|
@ -4,7 +4,7 @@ CC?=gcc
|
||||||
PREFIX?=/usr/local
|
PREFIX?=/usr/local
|
||||||
CFLAGS+= -std=c99 -Wall -pedantic -g
|
CFLAGS+= -std=c99 -Wall -pedantic -g
|
||||||
LDFLAGS+=
|
LDFLAGS+=
|
||||||
LIBS+= -lX11
|
LIBS+= -lX11 -lImlib2
|
||||||
|
|
||||||
SRCFILES=$(wildcard *.c)
|
SRCFILES=$(wildcard *.c)
|
||||||
OBJFILES=$(SRCFILES:.c=.o)
|
OBJFILES=$(SRCFILES:.c=.o)
|
||||||
|
|
2
app.c
2
app.c
|
@ -35,6 +35,8 @@ void app_init(app_t *app) {
|
||||||
app->win.h = WIN_HEIGHT;
|
app->win.h = WIN_HEIGHT;
|
||||||
|
|
||||||
win_open(&app->win);
|
win_open(&app->win);
|
||||||
|
|
||||||
|
imlib_init(&app->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_run(app_t *app) {
|
void app_run(app_t *app) {
|
||||||
|
|
11
image.c
11
image.c
|
@ -16,6 +16,17 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <Imlib2.h>
|
||||||
|
|
||||||
#include "sxiv.h"
|
#include "sxiv.h"
|
||||||
#include "image.h"
|
#include "image.h"
|
||||||
|
|
||||||
|
void imlib_init(win_t *win) {
|
||||||
|
if (!win)
|
||||||
|
return;
|
||||||
|
|
||||||
|
imlib_context_set_display(win->env.dpy);
|
||||||
|
imlib_context_set_visual(win->env.vis);
|
||||||
|
imlib_context_set_colormap(win->env.cmap);
|
||||||
|
imlib_context_set_drawable(win->xwin);
|
||||||
|
}
|
||||||
|
|
4
image.h
4
image.h
|
@ -19,6 +19,8 @@
|
||||||
#ifndef IMAGE_H
|
#ifndef IMAGE_H
|
||||||
#define IMAGE_H
|
#define IMAGE_H
|
||||||
|
|
||||||
|
#include "window.h"
|
||||||
|
|
||||||
typedef enum scalemode_e {
|
typedef enum scalemode_e {
|
||||||
SCALE_DOWN = 0,
|
SCALE_DOWN = 0,
|
||||||
SCALE_FIT,
|
SCALE_FIT,
|
||||||
|
@ -34,4 +36,6 @@ typedef struct img_s {
|
||||||
int y;
|
int y;
|
||||||
} img_t;
|
} img_t;
|
||||||
|
|
||||||
|
void imlib_init(win_t*);
|
||||||
|
|
||||||
#endif /* IMAGE_H */
|
#endif /* IMAGE_H */
|
||||||
|
|
Loading…
Reference in a new issue