+ added support for XRenderColor
This commit is contained in:
parent
1476de7152
commit
8892dd700c
|
@ -1,5 +1,7 @@
|
|||
#include "xrender.h"
|
||||
|
||||
/* XGlyphInfo */
|
||||
|
||||
s48_value scx_enter_glyphinfo(XGlyphInfo *i)
|
||||
{
|
||||
s48_value girec = S48_UNSPECIFIC;
|
||||
|
@ -40,11 +42,52 @@ XGLYPHINFO_SET(scx_xglyphinfo_y_set, y);
|
|||
XGLYPHINFO_SET(scx_xglyphinfo_xOff_set, xOff);
|
||||
XGLYPHINFO_SET(scx_xglyphinfo_yOff_set, yOff);
|
||||
|
||||
/* XRenderColor */
|
||||
|
||||
s48_value scx_enter_xrendercolor(XRenderColor *xrc)
|
||||
{
|
||||
s48_value rcrec = S48_UNSPECIFIC;
|
||||
S48_DECLARE_GC_PROTECT(1);
|
||||
|
||||
S48_GC_PROTECT_1(rcrec);
|
||||
rcrec = s48_make_record(scx_xrender_xrendercolor_record_type);
|
||||
S48_RECORD_SET(rcrec, 0, s48_enter_integer((long) xrc));
|
||||
S48_GC_UNPROTECT();
|
||||
return rcrec;
|
||||
}
|
||||
|
||||
#define scx_extract_xrendercolor(x) \
|
||||
((XRenderColor *) s48_extract_integer(s48_checked_record_ref(x, 0, scx_xrender_xrendercolor_record_type)))
|
||||
|
||||
#define XRENDERCOLOR_GET(FUN, FN) \
|
||||
s48_value FUN(s48_value sv) { \
|
||||
return s48_enter_integer(scx_extract_xrendercolor(sv)->FN); \
|
||||
}
|
||||
|
||||
#define XRENDERCOLOR_SET(FUN, FN) \
|
||||
s48_value FUN(s48_value sv, s48_value nv) { \
|
||||
scx_extract_xrendercolor(sv)->FN = s48_enter_integer(nv); \
|
||||
return S48_UNSPECIFIC; \
|
||||
}
|
||||
|
||||
XRENDERCOLOR_GET(scx_xrendercolor_red_get, red);
|
||||
XRENDERCOLOR_GET(scx_xrendercolor_green_get, green);
|
||||
XRENDERCOLOR_GET(scx_xrendercolor_blue_get, blue);
|
||||
XRENDERCOLOR_GET(scx_xrendercolor_alpha_get, alpha);
|
||||
|
||||
XRENDERCOLOR_SET(scx_xrendercolor_red_set, red);
|
||||
XRENDERCOLOR_SET(scx_xrendercolor_green_set, green);
|
||||
XRENDERCOLOR_SET(scx_xrendercolor_blue_set, blue);
|
||||
XRENDERCOLOR_SET(scx_xrendercolor_alpha_set, alpha);
|
||||
|
||||
void scx_xrender_init(void)
|
||||
{
|
||||
S48_GC_PROTECT_GLOBAL(scx_xrender_glyphinfo_record_type);
|
||||
scx_xrender_glyphinfo_record_type = s48_get_imported_binding("xglyphinfo");
|
||||
|
||||
S48_GC_PROTECT_GLOBAL(scx_xrender_xrendercolor_record_type);
|
||||
scx_xrender_xrendercolor_record_type = s48_get_imported_binding("xrendercolor");
|
||||
|
||||
S48_EXPORT_FUNCTION(scx_xglyphinfo_width_get);
|
||||
S48_EXPORT_FUNCTION(scx_xglyphinfo_height_get);
|
||||
S48_EXPORT_FUNCTION(scx_xglyphinfo_x_get);
|
||||
|
@ -58,4 +101,14 @@ void scx_xrender_init(void)
|
|||
S48_EXPORT_FUNCTION(scx_xglyphinfo_y_set);
|
||||
S48_EXPORT_FUNCTION(scx_xglyphinfo_xOff_set);
|
||||
S48_EXPORT_FUNCTION(scx_xglyphinfo_yOff_set);
|
||||
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_red_get);
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_green_get);
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_blue_get);
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_alpha_get);
|
||||
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_red_set);
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_green_set);
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_blue_set);
|
||||
S48_EXPORT_FUNCTION(scx_xrendercolor_alpha_set);
|
||||
}
|
||||
|
|
|
@ -4,8 +4,12 @@
|
|||
|
||||
/* add more stuff later */
|
||||
|
||||
static s48_value scx_xrender_glyphinfo_record_type = S48_UNSPECIFIC;
|
||||
static s48_value scx_xrender_glyphinfo_record_type = S48_FALSE;
|
||||
static s48_value scx_xrender_xrendercolor_record_type = S48_FALSE;
|
||||
|
||||
s48_value scx_enter_glyphinfo(XGlyphInfo *i);
|
||||
s48_value scx_extract_glyphinfo(s48_value v);
|
||||
XGlyphInfo* scx_extract_glyphinfo(s48_value v);
|
||||
|
||||
s48_value scx_enter_xrendercolor(XRenderColor *xrc);
|
||||
XRenderColor* scx_extract_xrendercolor(s48_value v);
|
||||
|
||||
|
|
10
c/main.c
10
c/main.c
|
@ -1,20 +1,24 @@
|
|||
#include "scheme48.h"
|
||||
|
||||
extern void scx_init_xlib();
|
||||
#ifdef WITH_XFT
|
||||
extern void scx_xft_init();
|
||||
extern void scx_xrender_init();
|
||||
#endif
|
||||
/*extern void scx_init_xpm();*/
|
||||
|
||||
#define WITH_XFT
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
s48_add_external_init(scx_init_xlib);
|
||||
|
||||
#ifdef WITH_XFT
|
||||
s48_add_external_init(scx_xft_init);
|
||||
s48_add_external_init(scx_xrender_init);
|
||||
#endif
|
||||
/*s48_add_external_init(scx_init_xpm);*/
|
||||
|
||||
return s48_main(10000000, 64000,
|
||||
SCSHIMAGE,
|
||||
|
||||
--argc, ++argv);
|
||||
--argc, ++argv);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,39 @@
|
|||
scx-xft-list-fonts-pattern-objects
|
||||
scx-xft-version-major
|
||||
scx-xft-version-minor
|
||||
scx-xft-fontset-add
|
||||
scx-xft-color-alloc-name
|
||||
scx-xft-pattern-print
|
||||
scx-xft-fontset-print
|
||||
scx-xft-default-has-render?
|
||||
;; Xft version 2
|
||||
scx-xft-draw-display
|
||||
scx-xft-draw-drawable
|
||||
scx-xft-draw-colormap
|
||||
scx-xft-draw-visual))
|
||||
|
||||
(define-interface xrender-interface
|
||||
(export
|
||||
xglyphinfo?
|
||||
scx-xglyphinfo-width
|
||||
scx-xglyphinfo-height
|
||||
scx-xglyphinfo-x
|
||||
scx-xglyphinfo-y
|
||||
scx-xglyphinfo-xOff
|
||||
scx-xglyphinfo-yOff
|
||||
set-scx-xglyphinfo-width!
|
||||
set-scx-xglyphinfo-height!
|
||||
set-scx-xglyphinfo-x!
|
||||
set-scx-xglyphinfo-y!
|
||||
set-scx-xglyphinfo-xOff!
|
||||
set-scx-xglyphinfo-yOff!
|
||||
|
||||
xrendercolor?
|
||||
scx-xrendercolor-red
|
||||
scx-xrendercolor-green
|
||||
scx-xrendercolor-blue
|
||||
scx-xrendercolor-alpha
|
||||
set-scx-xrendercolor-red!
|
||||
set-scx-xrendercolor-green!
|
||||
set-scx-xrendercolor-blue!
|
||||
set-scx-xrendercolor-alpha!))
|
||||
|
|
|
@ -11,5 +11,13 @@
|
|||
xlib
|
||||
signals
|
||||
define-record-types
|
||||
srfi-1
|
||||
external-calls)
|
||||
(files xft))
|
||||
(files xft))
|
||||
|
||||
(define-structure xrender xrender-interface
|
||||
(open scheme
|
||||
define-record-types
|
||||
external-calls)
|
||||
(files xrender))
|
||||
|
|
@ -6,6 +6,13 @@
|
|||
|
||||
(define-exported-binding "xglyphinfo" :xglyphinfo)
|
||||
|
||||
(define-record-type xrendercolor :xrendercolor
|
||||
(really-make-xrender-color c-pointer)
|
||||
xrendercolor?
|
||||
(c-pointer xrendercolor-c-pointer))
|
||||
|
||||
;; XGlyphInfo
|
||||
|
||||
(import-lambda-definition scx-xglyphinfo-width
|
||||
(xglyphinfo)
|
||||
"scx_xglyphinfo_width_get")
|
||||
|
@ -53,3 +60,37 @@
|
|||
(import-lambda-definition set-scx-xglyphinfo-yOff!
|
||||
(xglyphinfo new-value)
|
||||
"scx_xglyphinfo_yOff_set")
|
||||
|
||||
;; XRenderColor
|
||||
|
||||
(import-lambda-definition scx-xrendercolor-red
|
||||
(xrendercolor)
|
||||
"scx_xrendercolor_red_get")
|
||||
|
||||
(import-lambda-definition scx-xrendercolor-green
|
||||
(xrendercolor)
|
||||
"scx_xrendercolor_green_get")
|
||||
|
||||
(import-lambda-definition scx-xrendercolor-blue
|
||||
(xrendercolor)
|
||||
"scx_xrendercolor_blue_get")
|
||||
|
||||
(import-lambda-definition scx-xrendercolor-alpha
|
||||
(xrendercolor)
|
||||
"scx_xrendercolor_alpha_get")
|
||||
|
||||
(import-lambda-definition set-scx-xrendercolor-red!
|
||||
(xrendercolor new-value)
|
||||
"scx_xrendercolor_red_set")
|
||||
|
||||
(import-lambda-definition set-scx-xrendercolor-green!
|
||||
(xrendercolor new-value)
|
||||
"scx_xrendercolor_green_set")
|
||||
|
||||
(import-lambda-definition set-scx-xrendercolor-blue!
|
||||
(xrendercolor new-value)
|
||||
"scx_xrendercolor_blue_set")
|
||||
|
||||
(import-lambda-definition set-scx-xrendercolor-alpha!
|
||||
(xrendercolor new-value)
|
||||
"scx_xrendercolor_alpha_set")
|
Loading…
Reference in New Issue