indent
This commit is contained in:
+221
-129
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fb.c,v 1.2 2002/07/18 15:01:31 ukai Exp $ */
|
/* $Id: fb.c,v 1.3 2002/07/18 15:10:52 ukai Exp $ */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
fb.c 0.2 Copyright (C) 2002, hito
|
fb.c 0.2 Copyright (C) 2002, hito
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -21,7 +21,8 @@
|
|||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
|
|
||||||
static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo*, struct fb_var_screeninfo *);
|
static struct fb_cmap *fb_cmap_create(struct fb_fix_screeninfo *,
|
||||||
|
struct fb_var_screeninfo *);
|
||||||
static void fb_cmap_destroy(struct fb_cmap *cmap);
|
static void fb_cmap_destroy(struct fb_cmap *cmap);
|
||||||
static int fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo);
|
static int fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo);
|
||||||
static void *fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo);
|
static void *fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo);
|
||||||
@@ -35,7 +36,9 @@ static int is_open = FALSE;
|
|||||||
static int fbfp = -1;
|
static int fbfp = -1;
|
||||||
static unsigned char *buf = NULL;
|
static unsigned char *buf = NULL;
|
||||||
|
|
||||||
int fb_open(void){
|
int
|
||||||
|
fb_open(void)
|
||||||
|
{
|
||||||
char *fbdev = { FB_DEFDEV };
|
char *fbdev = { FB_DEFDEV };
|
||||||
|
|
||||||
if (is_open == TRUE)
|
if (is_open == TRUE)
|
||||||
@@ -72,7 +75,7 @@ int fb_open(void){
|
|||||||
goto ERR_END;
|
goto ERR_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
if (fscinfo.visual == FB_VISUAL_PSEUDOCOLOR) {
|
if (fscinfo.visual == FB_VISUAL_PSEUDOCOLOR) {
|
||||||
printf("FB_VISUAL_PSEUDOCOLOR\n");
|
printf("FB_VISUAL_PSEUDOCOLOR\n");
|
||||||
if (vscinfo.bits_per_pixel != 8) {
|
if (vscinfo.bits_per_pixel != 8) {
|
||||||
@@ -97,13 +100,16 @@ int fb_open(void){
|
|||||||
|
|
||||||
for (lp = 0; lp < LINUX_LOGO_COLORS; lp++) {
|
for (lp = 0; lp < LINUX_LOGO_COLORS; lp++) {
|
||||||
if (cmap->red) {
|
if (cmap->red) {
|
||||||
*(cmap->red+lp) = (linux_logo_red[lp]<<CHAR_BIT)+linux_logo_red[lp];
|
*(cmap->red + lp) =
|
||||||
|
(linux_logo_red[lp] << CHAR_BIT) + linux_logo_red[lp];
|
||||||
}
|
}
|
||||||
if (cmap->green) {
|
if (cmap->green) {
|
||||||
*(cmap->green+lp)= (linux_logo_green[lp]<<CHAR_BIT)+linux_logo_green[lp];
|
*(cmap->green + lp) =
|
||||||
|
(linux_logo_green[lp] << CHAR_BIT) + linux_logo_green[lp];
|
||||||
}
|
}
|
||||||
if (cmap->blue) {
|
if (cmap->blue) {
|
||||||
*(cmap->blue+lp)= (linux_logo_blue[lp]<<CHAR_BIT)+linux_logo_blue[lp];
|
*(cmap->blue + lp) =
|
||||||
|
(linux_logo_blue[lp] << CHAR_BIT) + linux_logo_blue[lp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fb_cmap_set(fbfp, cmap)) {
|
if (fb_cmap_set(fbfp, cmap)) {
|
||||||
@@ -112,13 +118,12 @@ int fb_open(void){
|
|||||||
goto ERR_END;
|
goto ERR_END;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|
||||||
if (!(fscinfo.visual == FB_VISUAL_TRUECOLOR &&
|
if (!(fscinfo.visual == FB_VISUAL_TRUECOLOR &&
|
||||||
(vscinfo.bits_per_pixel == 15 ||
|
(vscinfo.bits_per_pixel == 15 ||
|
||||||
vscinfo.bits_per_pixel == 16 ||
|
vscinfo.bits_per_pixel == 16 ||
|
||||||
vscinfo.bits_per_pixel == 24 ||
|
vscinfo.bits_per_pixel == 24 || vscinfo.bits_per_pixel == 32))) {
|
||||||
vscinfo.bits_per_pixel == 32))){
|
|
||||||
fprintf(stderr, "This type of framebuffer is not supported.\n");
|
fprintf(stderr, "This type of framebuffer is not supported.\n");
|
||||||
goto ERR_END;
|
goto ERR_END;
|
||||||
}
|
}
|
||||||
@@ -131,7 +136,8 @@ int fb_open(void){
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_close(void)
|
void
|
||||||
|
fb_close(void)
|
||||||
{
|
{
|
||||||
if (is_open != TRUE)
|
if (is_open != TRUE)
|
||||||
return;
|
return;
|
||||||
@@ -152,7 +158,8 @@ void fb_close(void)
|
|||||||
is_open = FALSE;
|
is_open = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_pset(int x, int y, int r, int g, int b)
|
void
|
||||||
|
fb_pset(int x, int y, int r, int g, int b)
|
||||||
{
|
{
|
||||||
unsigned long work;
|
unsigned long work;
|
||||||
int offset;
|
int offset;
|
||||||
@@ -176,7 +183,8 @@ void fb_pset(int x, int y, int r, int g, int b)
|
|||||||
memcpy(buf + offset, &work, size);
|
memcpy(buf + offset, &work, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_get_color(int x, int y, int *r, int *g, int *b)
|
int
|
||||||
|
fb_get_color(int x, int y, int *r, int *g, int *b)
|
||||||
{
|
{
|
||||||
unsigned long work = 0;
|
unsigned long work = 0;
|
||||||
int offset;
|
int offset;
|
||||||
@@ -194,24 +202,30 @@ int fb_get_color(int x, int y, int *r, int *g, int *b)
|
|||||||
|
|
||||||
memcpy(&work, buf + offset, size);
|
memcpy(&work, buf + offset, size);
|
||||||
|
|
||||||
*r = ((work >> vscinfo.red.offset) & (0x000000ff >> (CHAR_BIT - vscinfo.red.length)))
|
*r = ((work >> vscinfo.red.
|
||||||
|
offset) & (0x000000ff >> (CHAR_BIT - vscinfo.red.length)))
|
||||||
<< (CHAR_BIT - vscinfo.red.length);
|
<< (CHAR_BIT - vscinfo.red.length);
|
||||||
*g = ((work >> vscinfo.green.offset) & (0x000000ff >> (CHAR_BIT - vscinfo.green.length)))
|
*g = ((work >> vscinfo.green.
|
||||||
|
offset) & (0x000000ff >> (CHAR_BIT - vscinfo.green.length)))
|
||||||
<< (CHAR_BIT - vscinfo.green.length);
|
<< (CHAR_BIT - vscinfo.green.length);
|
||||||
*b = ((work >> vscinfo.blue.offset) & (0x000000ff >> (CHAR_BIT - vscinfo.blue.length)))
|
*b = ((work >> vscinfo.blue.
|
||||||
|
offset) & (0x000000ff >> (CHAR_BIT - vscinfo.blue.length)))
|
||||||
<< (CHAR_BIT - vscinfo.blue.length);
|
<< (CHAR_BIT - vscinfo.blue.length);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_clear(void)
|
void
|
||||||
|
fb_clear(void)
|
||||||
{
|
{
|
||||||
if (is_open != TRUE)
|
if (is_open != TRUE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(buf, 0, (vscinfo.xres * vscinfo.yres * vscinfo.bits_per_pixel) / CHAR_BIT);
|
memset(buf, 0,
|
||||||
|
(vscinfo.xres * vscinfo.yres * vscinfo.bits_per_pixel) / CHAR_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_width(void)
|
int
|
||||||
|
fb_width(void)
|
||||||
{
|
{
|
||||||
if (is_open != TRUE)
|
if (is_open != TRUE)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -219,7 +233,8 @@ int fb_width(void)
|
|||||||
return vscinfo.xres;
|
return vscinfo.xres;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_height(void)
|
int
|
||||||
|
fb_height(void)
|
||||||
{
|
{
|
||||||
if (is_open != TRUE)
|
if (is_open != TRUE)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -227,7 +242,8 @@ int fb_height(void)
|
|||||||
return vscinfo.yres;
|
return vscinfo.yres;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_cmap_disp(void)
|
void
|
||||||
|
fb_cmap_disp(void)
|
||||||
{
|
{
|
||||||
int lp;
|
int lp;
|
||||||
|
|
||||||
@@ -240,40 +256,53 @@ void fb_cmap_disp(void)
|
|||||||
printf("red :[%8p]\n", cmap->red);
|
printf("red :[%8p]\n", cmap->red);
|
||||||
if (cmap->red) {
|
if (cmap->red) {
|
||||||
for (lp = 0; lp < cmap->len; lp++) {
|
for (lp = 0; lp < cmap->len; lp++) {
|
||||||
if((lp+1)%16==0) printf("%04x\n",*(cmap->red+lp));
|
if ((lp + 1) % 16 == 0)
|
||||||
else printf("%04x ",*(cmap->red+lp));
|
printf("%04x\n", *(cmap->red + lp));
|
||||||
|
else
|
||||||
|
printf("%04x ", *(cmap->red + lp));
|
||||||
}
|
}
|
||||||
if(lp%16) printf("\n");
|
if (lp % 16)
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("green :[%8p]\n", cmap->green);
|
printf("green :[%8p]\n", cmap->green);
|
||||||
if (cmap->green) {
|
if (cmap->green) {
|
||||||
for (lp = 0; lp < cmap->len; lp++) {
|
for (lp = 0; lp < cmap->len; lp++) {
|
||||||
if((lp+1)%16==0) printf("%04x\n",*(cmap->green+lp));
|
if ((lp + 1) % 16 == 0)
|
||||||
else printf("%04x ",*(cmap->green+lp));
|
printf("%04x\n", *(cmap->green + lp));
|
||||||
|
else
|
||||||
|
printf("%04x ", *(cmap->green + lp));
|
||||||
}
|
}
|
||||||
if(lp%16) printf("\n");
|
if (lp % 16)
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("blue :[%8p]\n", cmap->blue);
|
printf("blue :[%8p]\n", cmap->blue);
|
||||||
if (cmap->blue) {
|
if (cmap->blue) {
|
||||||
for (lp = 0; lp < cmap->len; lp++) {
|
for (lp = 0; lp < cmap->len; lp++) {
|
||||||
if((lp+1)%16==0) printf("%04x\n",*(cmap->blue+lp));
|
if ((lp + 1) % 16 == 0)
|
||||||
else printf("%04x ",*(cmap->blue+lp));
|
printf("%04x\n", *(cmap->blue + lp));
|
||||||
|
else
|
||||||
|
printf("%04x ", *(cmap->blue + lp));
|
||||||
}
|
}
|
||||||
if(lp%16) printf("\n");
|
if (lp % 16)
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
printf("transp :[%8p]\n", cmap->transp);
|
printf("transp :[%8p]\n", cmap->transp);
|
||||||
if (cmap->transp) {
|
if (cmap->transp) {
|
||||||
for (lp = 0; lp < cmap->len; lp++) {
|
for (lp = 0; lp < cmap->len; lp++) {
|
||||||
if((lp+1)%16==0) printf("%04x\n",*(cmap->transp+lp));
|
if ((lp + 1) % 16 == 0)
|
||||||
else printf("%04x ",*(cmap->transp+lp));
|
printf("%04x\n", *(cmap->transp + lp));
|
||||||
|
else
|
||||||
|
printf("%04x ", *(cmap->transp + lp));
|
||||||
}
|
}
|
||||||
if(lp%16) printf("\n");
|
if (lp % 16)
|
||||||
|
printf("\n");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fb_fscrn_disp(void)
|
void
|
||||||
|
fb_fscrn_disp(void)
|
||||||
{
|
{
|
||||||
if (is_open != TRUE)
|
if (is_open != TRUE)
|
||||||
return;
|
return;
|
||||||
@@ -285,44 +314,62 @@ void fb_fscrn_disp(void)
|
|||||||
printf("type :[%d] ", fscinfo.type);
|
printf("type :[%d] ", fscinfo.type);
|
||||||
switch (fscinfo.type) {
|
switch (fscinfo.type) {
|
||||||
case FB_TYPE_PACKED_PIXELS:
|
case FB_TYPE_PACKED_PIXELS:
|
||||||
printf("FB_TYPE_PACKED_PIXELS\n");break;
|
printf("FB_TYPE_PACKED_PIXELS\n");
|
||||||
|
break;
|
||||||
case FB_TYPE_PLANES:
|
case FB_TYPE_PLANES:
|
||||||
printf("FB_TYPE_PLANES\n");break;
|
printf("FB_TYPE_PLANES\n");
|
||||||
|
break;
|
||||||
case FB_TYPE_INTERLEAVED_PLANES:
|
case FB_TYPE_INTERLEAVED_PLANES:
|
||||||
printf("FB_TYPE_INTERLEAVED_PLANES\n");break;
|
printf("FB_TYPE_INTERLEAVED_PLANES\n");
|
||||||
|
break;
|
||||||
case FB_TYPE_TEXT:
|
case FB_TYPE_TEXT:
|
||||||
printf("FB_TYPE_TEXT\n");break;
|
printf("FB_TYPE_TEXT\n");
|
||||||
default:printf("Unknown type.\n");
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unknown type.\n");
|
||||||
}
|
}
|
||||||
printf("type_aux :[%d] ", fscinfo.type_aux);
|
printf("type_aux :[%d] ", fscinfo.type_aux);
|
||||||
switch (fscinfo.type_aux) {
|
switch (fscinfo.type_aux) {
|
||||||
case FB_AUX_TEXT_MDA:
|
case FB_AUX_TEXT_MDA:
|
||||||
printf("FB_AUX_TEXT_MDA\n");break;
|
printf("FB_AUX_TEXT_MDA\n");
|
||||||
|
break;
|
||||||
case FB_AUX_TEXT_CGA:
|
case FB_AUX_TEXT_CGA:
|
||||||
printf("FB_AUX_TEXT_CGA\n");break;
|
printf("FB_AUX_TEXT_CGA\n");
|
||||||
|
break;
|
||||||
case FB_AUX_TEXT_S3_MMIO:
|
case FB_AUX_TEXT_S3_MMIO:
|
||||||
printf("FB_AUX_TEXT_S3_MMIO\n");break;
|
printf("FB_AUX_TEXT_S3_MMIO\n");
|
||||||
|
break;
|
||||||
case FB_AUX_TEXT_MGA_STEP16:
|
case FB_AUX_TEXT_MGA_STEP16:
|
||||||
printf("FB_AUX_TEXT_MGA_STEP16\n");break;
|
printf("FB_AUX_TEXT_MGA_STEP16\n");
|
||||||
|
break;
|
||||||
case FB_AUX_TEXT_MGA_STEP8:
|
case FB_AUX_TEXT_MGA_STEP8:
|
||||||
printf("FB_AUX_TEXT_MGA_STEP8\n");break;
|
printf("FB_AUX_TEXT_MGA_STEP8\n");
|
||||||
default:printf("Unknown type_aux.\n");
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unknown type_aux.\n");
|
||||||
}
|
}
|
||||||
printf("visual :[%d] ", fscinfo.visual);
|
printf("visual :[%d] ", fscinfo.visual);
|
||||||
switch (fscinfo.visual) {
|
switch (fscinfo.visual) {
|
||||||
case FB_VISUAL_MONO01:
|
case FB_VISUAL_MONO01:
|
||||||
printf("FB_VISUAL_MONO01\n");break;
|
printf("FB_VISUAL_MONO01\n");
|
||||||
|
break;
|
||||||
case FB_VISUAL_MONO10:
|
case FB_VISUAL_MONO10:
|
||||||
printf("FB_VISUAL_MONO10\n");break;
|
printf("FB_VISUAL_MONO10\n");
|
||||||
|
break;
|
||||||
case FB_VISUAL_TRUECOLOR:
|
case FB_VISUAL_TRUECOLOR:
|
||||||
printf("FB_VISUAL_TRUECOLOR\n");break;
|
printf("FB_VISUAL_TRUECOLOR\n");
|
||||||
|
break;
|
||||||
case FB_VISUAL_PSEUDOCOLOR:
|
case FB_VISUAL_PSEUDOCOLOR:
|
||||||
printf("FB_VISUAL_PSEUDOCOLOR\n");break;
|
printf("FB_VISUAL_PSEUDOCOLOR\n");
|
||||||
|
break;
|
||||||
case FB_VISUAL_DIRECTCOLOR:
|
case FB_VISUAL_DIRECTCOLOR:
|
||||||
printf("FB_VISUAL_DIRECTCOLOR\n");break;
|
printf("FB_VISUAL_DIRECTCOLOR\n");
|
||||||
|
break;
|
||||||
case FB_VISUAL_STATIC_PSEUDOCOLOR:
|
case FB_VISUAL_STATIC_PSEUDOCOLOR:
|
||||||
printf("FB_VISUAL_STATIC_PSEUDOCOLOR\n");break;
|
printf("FB_VISUAL_STATIC_PSEUDOCOLOR\n");
|
||||||
default:printf("Unknown Visual mode.\n");
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unknown Visual mode.\n");
|
||||||
}
|
}
|
||||||
printf("xpanstep :[%d]\n", fscinfo.xpanstep);
|
printf("xpanstep :[%d]\n", fscinfo.xpanstep);
|
||||||
printf("ypanstep :[%d]\n", fscinfo.ypanstep);
|
printf("ypanstep :[%d]\n", fscinfo.ypanstep);
|
||||||
@@ -333,63 +380,91 @@ void fb_fscrn_disp(void)
|
|||||||
printf("accel :[%d] ", fscinfo.accel);
|
printf("accel :[%d] ", fscinfo.accel);
|
||||||
switch (fscinfo.accel) {
|
switch (fscinfo.accel) {
|
||||||
case FB_ACCEL_NONE:
|
case FB_ACCEL_NONE:
|
||||||
printf("FB_ACCEL_NONE\n");break;
|
printf("FB_ACCEL_NONE\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_ATARIBLITT:
|
case FB_ACCEL_ATARIBLITT:
|
||||||
printf("FB_ACCEL_ATARIBLITT\n");break;
|
printf("FB_ACCEL_ATARIBLITT\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_AMIGABLITT:
|
case FB_ACCEL_AMIGABLITT:
|
||||||
printf("FB_ACCEL_AMIGABLITT\n");break;
|
printf("FB_ACCEL_AMIGABLITT\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_S3_TRIO64:
|
case FB_ACCEL_S3_TRIO64:
|
||||||
printf("FB_ACCEL_S3_TRIO64\n");break;
|
printf("FB_ACCEL_S3_TRIO64\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_NCR_77C32BLT:
|
case FB_ACCEL_NCR_77C32BLT:
|
||||||
printf("FB_ACCEL_NCR_77C32BLT\n");break;
|
printf("FB_ACCEL_NCR_77C32BLT\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_S3_VIRGE:
|
case FB_ACCEL_S3_VIRGE:
|
||||||
printf("FB_ACCEL_S3_VIRGE\n");break;
|
printf("FB_ACCEL_S3_VIRGE\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_ATI_MACH64GX:
|
case FB_ACCEL_ATI_MACH64GX:
|
||||||
printf("FB_ACCEL_ATI_MACH64GX\n");break;
|
printf("FB_ACCEL_ATI_MACH64GX\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_DEC_TGA:
|
case FB_ACCEL_DEC_TGA:
|
||||||
printf("FB_ACCEL_DEC_TGA\n");break;
|
printf("FB_ACCEL_DEC_TGA\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_ATI_MACH64CT:
|
case FB_ACCEL_ATI_MACH64CT:
|
||||||
printf("FB_ACCEL_ATI_MACH64CT\n");break;
|
printf("FB_ACCEL_ATI_MACH64CT\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_ATI_MACH64VT:
|
case FB_ACCEL_ATI_MACH64VT:
|
||||||
printf("FB_ACCEL_ATI_MACH64VT\n");break;
|
printf("FB_ACCEL_ATI_MACH64VT\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_ATI_MACH64GT:
|
case FB_ACCEL_ATI_MACH64GT:
|
||||||
printf("FB_ACCEL_ATI_MACH64GT\n");break;
|
printf("FB_ACCEL_ATI_MACH64GT\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_CREATOR:
|
case FB_ACCEL_SUN_CREATOR:
|
||||||
printf("FB_ACCEL_SUN_CREATOR\n");break;
|
printf("FB_ACCEL_SUN_CREATOR\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_CGSIX:
|
case FB_ACCEL_SUN_CGSIX:
|
||||||
printf("FB_ACCEL_SUN_CGSIX\n");break;
|
printf("FB_ACCEL_SUN_CGSIX\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_LEO:
|
case FB_ACCEL_SUN_LEO:
|
||||||
printf("FB_ACCEL_SUN_LEO\n");break;
|
printf("FB_ACCEL_SUN_LEO\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_IMS_TWINTURBO:
|
case FB_ACCEL_IMS_TWINTURBO:
|
||||||
printf("FB_ACCEL_IMS_TWINTURBO\n");break;
|
printf("FB_ACCEL_IMS_TWINTURBO\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_3DLABS_PERMEDIA2:
|
case FB_ACCEL_3DLABS_PERMEDIA2:
|
||||||
printf("FB_ACCEL_3DLABS_PERMEDIA2\n");break;
|
printf("FB_ACCEL_3DLABS_PERMEDIA2\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_MATROX_MGA2064W:
|
case FB_ACCEL_MATROX_MGA2064W:
|
||||||
printf("FB_ACCEL_MATROX_MGA2064W\n");break;
|
printf("FB_ACCEL_MATROX_MGA2064W\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_MATROX_MGA1064SG:
|
case FB_ACCEL_MATROX_MGA1064SG:
|
||||||
printf("FB_ACCEL_MATROX_MGA1064SG\n");break;
|
printf("FB_ACCEL_MATROX_MGA1064SG\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_MATROX_MGA2164W:
|
case FB_ACCEL_MATROX_MGA2164W:
|
||||||
printf("FB_ACCEL_MATROX_MGA2164W\n");break;
|
printf("FB_ACCEL_MATROX_MGA2164W\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_MATROX_MGA2164W_AGP:
|
case FB_ACCEL_MATROX_MGA2164W_AGP:
|
||||||
printf("FB_ACCEL_MATROX_MGA2164W_AGP\n");break;
|
printf("FB_ACCEL_MATROX_MGA2164W_AGP\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_MATROX_MGAG100:
|
case FB_ACCEL_MATROX_MGAG100:
|
||||||
printf("FB_ACCEL_MATROX_MGAG100\n");break;
|
printf("FB_ACCEL_MATROX_MGAG100\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_MATROX_MGAG200:
|
case FB_ACCEL_MATROX_MGAG200:
|
||||||
printf("FB_ACCEL_MATROX_MGAG200\n");break;
|
printf("FB_ACCEL_MATROX_MGAG200\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_CG14:
|
case FB_ACCEL_SUN_CG14:
|
||||||
printf("FB_ACCEL_SUN_CG14\n");break;
|
printf("FB_ACCEL_SUN_CG14\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_BWTWO:
|
case FB_ACCEL_SUN_BWTWO:
|
||||||
printf("FB_ACCEL_SUN_BWTWO\n");break;
|
printf("FB_ACCEL_SUN_BWTWO\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_CGTHREE:
|
case FB_ACCEL_SUN_CGTHREE:
|
||||||
printf("FB_ACCEL_SUN_CGTHREE\n");break;
|
printf("FB_ACCEL_SUN_CGTHREE\n");
|
||||||
|
break;
|
||||||
case FB_ACCEL_SUN_TCX:
|
case FB_ACCEL_SUN_TCX:
|
||||||
printf("FB_ACCEL_SUN_TCX\n");break;
|
printf("FB_ACCEL_SUN_TCX\n");
|
||||||
default:printf("Unknown Visual mode.\n");
|
break;
|
||||||
|
default:
|
||||||
|
printf("Unknown Visual mode.\n");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_vscrn_disp(void)
|
void
|
||||||
|
fb_vscrn_disp(void)
|
||||||
{
|
{
|
||||||
if (is_open != TRUE)
|
if (is_open != TRUE)
|
||||||
return;
|
return;
|
||||||
@@ -434,18 +509,19 @@ void fb_vscrn_disp(void)
|
|||||||
/********* static functions **************/
|
/********* static functions **************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(struct fb_cmap)デバイスに依存しないカラーマップ情報
|
* (struct fb_cmap)デバイスに依存しないカラーマップ情報
|
||||||
|
*
|
||||||
fb_cmap_create() 新規のカラーマップ情報
|
* fb_cmap_create() 新規のカラーマップ情報
|
||||||
fb_cmap_destroy() カラーマップ情報の破棄
|
* fb_cmap_destroy() カラーマップ情報の破棄
|
||||||
fb_cmap_disp() 情報の表示
|
* fb_cmap_disp() 情報の表示
|
||||||
fb_cmap_get() 情報の獲得
|
* fb_cmap_get() 情報の獲得
|
||||||
fb_cmap_set() 情報の設定
|
* fb_cmap_set() 情報の設定
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define LUT_MAX (256)
|
#define LUT_MAX (256)
|
||||||
|
|
||||||
static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo* fscinfo,
|
static struct fb_cmap *
|
||||||
|
fb_cmap_create(struct fb_fix_screeninfo *fscinfo,
|
||||||
struct fb_var_screeninfo *vscinfo)
|
struct fb_var_screeninfo *vscinfo)
|
||||||
{
|
{
|
||||||
struct fb_cmap *cmap;
|
struct fb_cmap *cmap;
|
||||||
@@ -454,7 +530,8 @@ static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo* fscinfo,
|
|||||||
/* カラーマップの存在チェック */
|
/* カラーマップの存在チェック */
|
||||||
if (fscinfo->visual == FB_VISUAL_MONO01 ||
|
if (fscinfo->visual == FB_VISUAL_MONO01 ||
|
||||||
fscinfo->visual == FB_VISUAL_MONO10 ||
|
fscinfo->visual == FB_VISUAL_MONO10 ||
|
||||||
fscinfo->visual==FB_VISUAL_TRUECOLOR) return NULL;
|
fscinfo->visual == FB_VISUAL_TRUECOLOR)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
cmap = (struct fb_cmap *)malloc(sizeof(struct fb_cmap));
|
cmap = (struct fb_cmap *)malloc(sizeof(struct fb_cmap));
|
||||||
if (!cmap) {
|
if (!cmap) {
|
||||||
@@ -474,7 +551,8 @@ static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo* fscinfo,
|
|||||||
if (vscinfo->green.length) {
|
if (vscinfo->green.length) {
|
||||||
cmap->green = (__u16 *) malloc(sizeof(__u16) * cmaplen);
|
cmap->green = (__u16 *) malloc(sizeof(__u16) * cmaplen);
|
||||||
if (!cmap->green) {
|
if (!cmap->green) {
|
||||||
if(vscinfo->red.length) free(cmap->red);
|
if (vscinfo->red.length)
|
||||||
|
free(cmap->red);
|
||||||
perror("green lut malloc error\n");
|
perror("green lut malloc error\n");
|
||||||
return (struct fb_cmap *)-1;
|
return (struct fb_cmap *)-1;
|
||||||
}
|
}
|
||||||
@@ -482,8 +560,10 @@ static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo* fscinfo,
|
|||||||
if (vscinfo->blue.length) {
|
if (vscinfo->blue.length) {
|
||||||
cmap->blue = (__u16 *) malloc(sizeof(__u16) * cmaplen);
|
cmap->blue = (__u16 *) malloc(sizeof(__u16) * cmaplen);
|
||||||
if (!cmap->blue) {
|
if (!cmap->blue) {
|
||||||
if(vscinfo->red.length) free(cmap->red);
|
if (vscinfo->red.length)
|
||||||
if(vscinfo->green.length) free(cmap->green);
|
free(cmap->red);
|
||||||
|
if (vscinfo->green.length)
|
||||||
|
free(cmap->green);
|
||||||
perror("blue lut malloc error\n");
|
perror("blue lut malloc error\n");
|
||||||
return (struct fb_cmap *)-1;
|
return (struct fb_cmap *)-1;
|
||||||
}
|
}
|
||||||
@@ -491,9 +571,12 @@ static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo* fscinfo,
|
|||||||
if (vscinfo->transp.length) {
|
if (vscinfo->transp.length) {
|
||||||
cmap->transp = (__u16 *) malloc(sizeof(__u16) * cmaplen);
|
cmap->transp = (__u16 *) malloc(sizeof(__u16) * cmaplen);
|
||||||
if (!cmap->transp) {
|
if (!cmap->transp) {
|
||||||
if(vscinfo->red.length) free(cmap->red);
|
if (vscinfo->red.length)
|
||||||
if(vscinfo->green.length) free(cmap->green);
|
free(cmap->red);
|
||||||
if(vscinfo->blue.length) free(cmap->blue);
|
if (vscinfo->green.length)
|
||||||
|
free(cmap->green);
|
||||||
|
if (vscinfo->blue.length)
|
||||||
|
free(cmap->blue);
|
||||||
perror("transp lut malloc error\n");
|
perror("transp lut malloc error\n");
|
||||||
return (struct fb_cmap *)-1;
|
return (struct fb_cmap *)-1;
|
||||||
}
|
}
|
||||||
@@ -502,17 +585,23 @@ static struct fb_cmap* fb_cmap_create(struct fb_fix_screeninfo* fscinfo,
|
|||||||
return cmap;
|
return cmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fb_cmap_destroy(struct fb_cmap* cmap)
|
static void
|
||||||
|
fb_cmap_destroy(struct fb_cmap *cmap)
|
||||||
{
|
{
|
||||||
if(cmap->red) free(cmap->red);
|
if (cmap->red)
|
||||||
if(cmap->green) free(cmap->green);
|
free(cmap->red);
|
||||||
if(cmap->blue) free(cmap->blue);
|
if (cmap->green)
|
||||||
if(cmap->transp) free(cmap->transp);
|
free(cmap->green);
|
||||||
|
if (cmap->blue)
|
||||||
|
free(cmap->blue);
|
||||||
|
if (cmap->transp)
|
||||||
|
free(cmap->transp);
|
||||||
free(cmap);
|
free(cmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
static int fb_cmap_get(int fbfp,struct fb_cmap* cmap)
|
static int
|
||||||
|
fb_cmap_get(int fbfp, struct fb_cmap *cmap)
|
||||||
{
|
{
|
||||||
if (ioctl(fbfp, FBIOGETCMAP, cmap)) {
|
if (ioctl(fbfp, FBIOGETCMAP, cmap)) {
|
||||||
perror("ioctl FBIOGETCMAP error\n");
|
perror("ioctl FBIOGETCMAP error\n");
|
||||||
@@ -521,7 +610,8 @@ static int fb_cmap_get(int fbfp,struct fb_cmap* cmap)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fb_cmap_set(int fbfp,struct fb_cmap* cmap)
|
static int
|
||||||
|
fb_cmap_set(int fbfp, struct fb_cmap *cmap)
|
||||||
{
|
{
|
||||||
if (ioctl(fbfp, FBIOPUTCMAP, cmap)) {
|
if (ioctl(fbfp, FBIOPUTCMAP, cmap)) {
|
||||||
perror("ioctl FBIOPUTCMAP error\n");
|
perror("ioctl FBIOPUTCMAP error\n");
|
||||||
@@ -529,19 +619,21 @@ static int fb_cmap_set(int fbfp,struct fb_cmap* cmap)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
/*
|
/*
|
||||||
フレームバッファに対するアクセス
|
* フレームバッファに対するアクセス
|
||||||
|
*
|
||||||
fb_mmap() フレームバッファのメモリ上へのマップ
|
* fb_mmap() フレームバッファのメモリ上へのマップ
|
||||||
fb_munmap() フレームバッファのメモリ上からのアンマップ
|
* fb_munmap() フレームバッファのメモリ上からのアンマップ
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void *fb_mmap(int fbfp, struct fb_fix_screeninfo* scinfo)
|
static void *
|
||||||
|
fb_mmap(int fbfp, struct fb_fix_screeninfo *scinfo)
|
||||||
{
|
{
|
||||||
void *buf;
|
void *buf;
|
||||||
if ((buf = (unsigned char *)
|
if ((buf = (unsigned char *)
|
||||||
mmap(NULL, scinfo->smem_len, PROT_READ|PROT_WRITE,MAP_SHARED, fbfp, (off_t)0))
|
mmap(NULL, scinfo->smem_len, PROT_READ | PROT_WRITE, MAP_SHARED, fbfp,
|
||||||
|
(off_t) 0))
|
||||||
== MAP_FAILED) {
|
== MAP_FAILED) {
|
||||||
perror("mmap error");
|
perror("mmap error");
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -549,20 +641,20 @@ static void *fb_mmap(int fbfp, struct fb_fix_screeninfo* scinfo)
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int fb_munmap(void* buf,struct fb_fix_screeninfo* scinfo)
|
static int
|
||||||
|
fb_munmap(void *buf, struct fb_fix_screeninfo *scinfo)
|
||||||
{
|
{
|
||||||
return munmap(buf, scinfo->smem_len);
|
return munmap(buf, scinfo->smem_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(struct fb_fix_screeninfo)デバイスに依存しない固定された情報
|
* (struct fb_fix_screeninfo)デバイスに依存しない固定された情報
|
||||||
|
*
|
||||||
fb_fscrn_disp() 情報の表示
|
* fb_fscrn_disp() 情報の表示
|
||||||
fb_fscrn_get() 情報の獲得
|
* fb_fscrn_get() 情報の獲得
|
||||||
*/
|
*/
|
||||||
|
static int
|
||||||
|
fb_fscrn_get(int fbfp, struct fb_fix_screeninfo *scinfo)
|
||||||
static int fb_fscrn_get(int fbfp,struct fb_fix_screeninfo* scinfo)
|
|
||||||
{
|
{
|
||||||
if (ioctl(fbfp, FBIOGET_FSCREENINFO, scinfo)) {
|
if (ioctl(fbfp, FBIOGET_FSCREENINFO, scinfo)) {
|
||||||
perror("ioctl FBIOGET_FSCREENINFO error\n");
|
perror("ioctl FBIOGET_FSCREENINFO error\n");
|
||||||
@@ -572,15 +664,14 @@ static int fb_fscrn_get(int fbfp,struct fb_fix_screeninfo* scinfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(struct fb_var_screeninfo)デバイスに依存しない変更可能な情報
|
* (struct fb_var_screeninfo)デバイスに依存しない変更可能な情報
|
||||||
|
*
|
||||||
fb_vscrn_disp() 情報の表示
|
* fb_vscrn_disp() 情報の表示
|
||||||
fb_vscrn_get() 情報の獲得
|
* fb_vscrn_get() 情報の獲得
|
||||||
fb_vscrn_set() 情報の設定
|
* fb_vscrn_set() 情報の設定
|
||||||
*/
|
*/
|
||||||
|
static int
|
||||||
|
fb_vscrn_get(int fbfp, struct fb_var_screeninfo *scinfo)
|
||||||
static int fb_vscrn_get(int fbfp,struct fb_var_screeninfo* scinfo)
|
|
||||||
{
|
{
|
||||||
if (ioctl(fbfp, FBIOGET_VSCREENINFO, scinfo)) {
|
if (ioctl(fbfp, FBIOGET_VSCREENINFO, scinfo)) {
|
||||||
perror("ioctl FBIOGET_VSCREENINFO error\n");
|
perror("ioctl FBIOGET_VSCREENINFO error\n");
|
||||||
@@ -589,8 +680,9 @@ static int fb_vscrn_get(int fbfp,struct fb_var_screeninfo* scinfo)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
#if 0
|
||||||
static int fb_vscrn_set(int fbfp,struct fb_var_screeninfo* scinfo)
|
static int
|
||||||
|
fb_vscrn_set(int fbfp, struct fb_var_screeninfo *scinfo)
|
||||||
{
|
{
|
||||||
if (ioctl(fbfp, FBIOPUT_VSCREENINFO, scinfo)) {
|
if (ioctl(fbfp, FBIOPUT_VSCREENINFO, scinfo)) {
|
||||||
perror("ioctl FBIOPUT_VSCREENINFO error\n");
|
perror("ioctl FBIOPUT_VSCREENINFO error\n");
|
||||||
@@ -598,4 +690,4 @@ static int fb_vscrn_set(int fbfp,struct fb_var_screeninfo* scinfo)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fb_gdkpixbuf.c,v 1.4 2002/07/18 15:01:31 ukai Exp $ */
|
/* $Id: fb_gdkpixbuf.c,v 1.5 2002/07/18 15:12:06 ukai Exp $ */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
fb_gdkpixbuf.c 0.2 Copyright (C) 2002, hito
|
fb_gdkpixbuf.c 0.2 Copyright (C) 2002, hito
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
static void set_prm(IMAGE * img);
|
static void set_prm(IMAGE * img);
|
||||||
|
|
||||||
IMAGE *fb_load_image(char *filename, int w, int h)
|
IMAGE *
|
||||||
|
fb_load_image(char *filename, int w, int h)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
IMAGE *img;
|
IMAGE *img;
|
||||||
@@ -34,7 +35,8 @@ IMAGE *fb_load_image(char *filename, int w, int h)
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_draw_image(IMAGE *img, int x, int y, int sx, int sy, int width, int height)
|
int
|
||||||
|
fb_draw_image(IMAGE * img, int x, int y, int sx, int sy, int width, int height)
|
||||||
{
|
{
|
||||||
int i, j, r, g, b, offset, bpp;
|
int i, j, r, g, b, offset, bpp;
|
||||||
|
|
||||||
@@ -57,7 +59,8 @@ int fb_draw_image(IMAGE *img, int x, int y, int sx, int sy, int width, int heigh
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_resize_image(IMAGE *img, int width, int height)
|
int
|
||||||
|
fb_resize_image(IMAGE * img, int width, int height)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
if (width < 1 || height < 1 || img == NULL)
|
if (width < 1 || height < 1 || img == NULL)
|
||||||
@@ -66,7 +69,8 @@ int fb_resize_image(IMAGE *img, int width, int height)
|
|||||||
if (width == img->width && height == img->height)
|
if (width == img->width && height == img->height)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_scale_simple(img->pixbuf, width, height, GDK_INTERP_HYPER);
|
pixbuf =
|
||||||
|
gdk_pixbuf_scale_simple(img->pixbuf, width, height, GDK_INTERP_HYPER);
|
||||||
if (pixbuf == NULL)
|
if (pixbuf == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
gdk_pixbuf_finalize(img->pixbuf);
|
gdk_pixbuf_finalize(img->pixbuf);
|
||||||
@@ -76,7 +80,8 @@ int fb_resize_image(IMAGE *img, int width, int height)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_free_image(IMAGE *img)
|
void
|
||||||
|
fb_free_image(IMAGE * img)
|
||||||
{
|
{
|
||||||
if (img == NULL)
|
if (img == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -85,7 +90,8 @@ void fb_free_image(IMAGE *img)
|
|||||||
free(img);
|
free(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMAGE *fb_dup_image(IMAGE *img)
|
IMAGE *
|
||||||
|
fb_dup_image(IMAGE * img)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
IMAGE *new_img;
|
IMAGE *new_img;
|
||||||
@@ -108,12 +114,14 @@ IMAGE *fb_dup_image(IMAGE *img)
|
|||||||
return new_img;
|
return new_img;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_rotate_image(IMAGE *img, int angle)
|
int
|
||||||
|
fb_rotate_image(IMAGE * img, int angle)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_prm(IMAGE *img)
|
static void
|
||||||
|
set_prm(IMAGE * img)
|
||||||
{
|
{
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
|
|
||||||
|
|||||||
+5
-3
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fb_img.c,v 1.2 2002/07/18 15:01:31 ukai Exp $ */
|
/* $Id: fb_img.c,v 1.3 2002/07/18 15:13:13 ukai Exp $ */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
@@ -17,12 +17,14 @@ static int bg_r = 0, bg_g = 0, bg_b = 0;
|
|||||||
#error no Imlib2 and GdkPixbuf support
|
#error no Imlib2 and GdkPixbuf support
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int fb_draw_image_simple(IMAGE *img, int x, int y)
|
int
|
||||||
|
fb_draw_image_simple(IMAGE * img, int x, int y)
|
||||||
{
|
{
|
||||||
return fb_draw_image(img, x, y, 0, 0, img->width, img->height);
|
return fb_draw_image(img, x, y, 0, 0, img->width, img->height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_set_bg(int r, int g, int b)
|
void
|
||||||
|
fb_set_bg(int r, int g, int b)
|
||||||
{
|
{
|
||||||
bg_r = r;
|
bg_r = r;
|
||||||
bg_g = g;
|
bg_g = g;
|
||||||
|
|||||||
+22
-11
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: fb_imlib2.c,v 1.4 2002/07/18 15:01:31 ukai Exp $ */
|
/* $Id: fb_imlib2.c,v 1.5 2002/07/18 15:14:21 ukai Exp $ */
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
fb_imlib2.c 0.2 Copyright (C) 2002, hito
|
fb_imlib2.c 0.2 Copyright (C) 2002, hito
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -8,7 +8,8 @@
|
|||||||
|
|
||||||
static void set_prm(IMAGE * img);
|
static void set_prm(IMAGE * img);
|
||||||
|
|
||||||
IMAGE *fb_load_image(char *filename, int w, int h)
|
IMAGE *
|
||||||
|
fb_load_image(char *filename, int w, int h)
|
||||||
{
|
{
|
||||||
Imlib_Image image;
|
Imlib_Image image;
|
||||||
IMAGE *img;
|
IMAGE *img;
|
||||||
@@ -36,7 +37,8 @@ IMAGE *fb_load_image(char *filename, int w, int h)
|
|||||||
return img;
|
return img;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_draw_image(IMAGE *img, int x, int y, int sx, int sy, int width, int height)
|
int
|
||||||
|
fb_draw_image(IMAGE * img, int x, int y, int sx, int sy, int width, int height)
|
||||||
{
|
{
|
||||||
int i, j, r, g, b, a = 0, offset;
|
int i, j, r, g, b, a = 0, offset;
|
||||||
|
|
||||||
@@ -60,7 +62,8 @@ int fb_draw_image(IMAGE *img, int x, int y, int sx, int sy, int width, int heigh
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_resize_image(IMAGE *img, int width, int height)
|
int
|
||||||
|
fb_resize_image(IMAGE * img, int width, int height)
|
||||||
{
|
{
|
||||||
Imlib_Image image;
|
Imlib_Image image;
|
||||||
|
|
||||||
@@ -70,7 +73,9 @@ int fb_resize_image(IMAGE *img, int width, int height)
|
|||||||
if (width == img->width && height == img->height)
|
if (width == img->width && height == img->height)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
image = imlib_create_cropped_scaled_image(0, 0, img->width, img->height, width, height);
|
image =
|
||||||
|
imlib_create_cropped_scaled_image(0, 0, img->width, img->height, width,
|
||||||
|
height);
|
||||||
if (image == NULL)
|
if (image == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@@ -82,7 +87,8 @@ int fb_resize_image(IMAGE *img, int width, int height)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void fb_free_image(IMAGE *img)
|
void
|
||||||
|
fb_free_image(IMAGE * img)
|
||||||
{
|
{
|
||||||
if (img == NULL)
|
if (img == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -92,7 +98,8 @@ void fb_free_image(IMAGE *img)
|
|||||||
free(img);
|
free(img);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMAGE *fb_dup_image(IMAGE *img)
|
IMAGE *
|
||||||
|
fb_dup_image(IMAGE * img)
|
||||||
{
|
{
|
||||||
Imlib_Image image;
|
Imlib_Image image;
|
||||||
IMAGE *new_img;
|
IMAGE *new_img;
|
||||||
@@ -117,7 +124,8 @@ IMAGE *fb_dup_image(IMAGE *img)
|
|||||||
return new_img;
|
return new_img;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fb_rotate_image(IMAGE *img, int angle)
|
int
|
||||||
|
fb_rotate_image(IMAGE * img, int angle)
|
||||||
{
|
{
|
||||||
int orientation;
|
int orientation;
|
||||||
|
|
||||||
@@ -128,9 +136,11 @@ int fb_rotate_image(IMAGE *img, int angle)
|
|||||||
|
|
||||||
if (angle == 90) {
|
if (angle == 90) {
|
||||||
orientation = 1;
|
orientation = 1;
|
||||||
}else if(angle == -90){
|
}
|
||||||
|
else if (angle == -90) {
|
||||||
orientation = 3;
|
orientation = 3;
|
||||||
}else{
|
}
|
||||||
|
else {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +149,8 @@ int fb_rotate_image(IMAGE *img, int angle)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_prm(IMAGE *img)
|
static void
|
||||||
|
set_prm(IMAGE * img)
|
||||||
{
|
{
|
||||||
if (img == NULL)
|
if (img == NULL)
|
||||||
return;
|
return;
|
||||||
|
|||||||
+4
-3
@@ -1,8 +1,10 @@
|
|||||||
/* $Id: w3mimg.c,v 1.1 2002/07/18 06:07:39 ukai Exp $ */
|
/* $Id: w3mimg.c,v 1.2 2002/07/18 15:14:36 ukai Exp $ */
|
||||||
|
|
||||||
#include "w3mimg/w3mimg.h"
|
#include "w3mimg/w3mimg.h"
|
||||||
|
|
||||||
w3mimg_op *w3mimg_open() {
|
w3mimg_op *
|
||||||
|
w3mimg_open()
|
||||||
|
{
|
||||||
w3mimg_op *w_op = NULL;
|
w3mimg_op *w_op = NULL;
|
||||||
#ifdef USE_W3MIMG_X11
|
#ifdef USE_W3MIMG_X11
|
||||||
if (w_op == NULL)
|
if (w_op == NULL)
|
||||||
@@ -14,4 +16,3 @@ w3mimg_op *w3mimg_open() {
|
|||||||
#endif
|
#endif
|
||||||
return w_op;
|
return w_op;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: w3mimg.h,v 1.2 2002/07/18 06:07:25 ukai Exp $ */
|
/* $Id: w3mimg.h,v 1.3 2002/07/18 15:14:51 ukai Exp $ */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef USE_W3MIMG_FB
|
#ifdef USE_W3MIMG_FB
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $Id: x11_w3mimg.c,v 1.3 2002/07/18 14:32:12 ukai Exp $ */
|
/* $Id: x11_w3mimg.c,v 1.4 2002/07/18 15:15:32 ukai Exp $ */
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -160,8 +160,8 @@ x11_load_image(w3mimg_op *self, W3MImage *img, char *fname, int w, int h)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
x11_show_image(w3mimg_op *self, W3MImage *img, int sx, int sy, int sw, int sh,
|
x11_show_image(w3mimg_op * self, W3MImage * img, int sx, int sy, int sw,
|
||||||
int x, int y)
|
int sh, int x, int y)
|
||||||
{
|
{
|
||||||
struct x11_info *xi;
|
struct x11_info *xi;
|
||||||
if (self == NULL)
|
if (self == NULL)
|
||||||
@@ -173,8 +173,7 @@ x11_show_image(w3mimg_op *self, W3MImage *img, int sx, int sy, int sw, int sh,
|
|||||||
XCopyArea(xi->display, (Pixmap) img->pixmap, xi->window, xi->imageGC,
|
XCopyArea(xi->display, (Pixmap) img->pixmap, xi->window, xi->imageGC,
|
||||||
sx, sy,
|
sx, sy,
|
||||||
(sw ? sw : img->width),
|
(sw ? sw : img->width),
|
||||||
(sh ? sh : img->height),
|
(sh ? sh : img->height), x + self->offset_x, y + self->offset_y);
|
||||||
x + self->offset_x, y + self->offset_y);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user