1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
/*
* $Id$
*/
#include "../x_imagelib.h"
/* --- global functions --- */
int
x_imagelib_display_opened(
Display * display
)
{
return 1 ;
}
int
x_imagelib_display_closed(
Display * display
)
{
return 1 ;
}
Pixmap
x_imagelib_load_file_for_background(
x_window_t * win ,
char * file_path ,
x_picture_modifier_t * pic_mod
)
{
HBITMAP hbmp ;
HBITMAP hbmp_w ;
BITMAP bmp ;
HDC hdc ;
HDC hmdc_tmp ;
HDC hmdc ;
#if defined(__CYGWIN__) || defined(__MSYS__)
/* MAX_PATH which is 260 (3+255+1+1) is defined in win32 alone. */
char winpath[MAX_PATH] ;
cygwin_conv_to_win32_path( file_path , winpath) ;
file_path = winpath ;
#endif
hdc = GetDC( win->my_window) ;
if( ! ( hbmp = LoadImage( 0 , file_path , IMAGE_BITMAP , 0 , 0 , LR_LOADFROMFILE)))
{
return None ;
}
hmdc_tmp = CreateCompatibleDC( hdc) ;
SelectObject( hmdc_tmp , hbmp) ;
hbmp_w = CreateCompatibleBitmap( hdc , ACTUAL_WIDTH(win) , ACTUAL_HEIGHT(win)) ;
hmdc = CreateCompatibleDC( hdc) ;
SelectObject( hmdc , hbmp_w) ;
ReleaseDC( win->my_window , hdc) ;
GetObject( hbmp , sizeof(BITMAP) , &bmp) ;
SetStretchBltMode( hmdc , COLORONCOLOR) ;
StretchBlt( hmdc , 0 , 0 , ACTUAL_WIDTH(win) , ACTUAL_HEIGHT(win) ,
hmdc_tmp , 0 , 0 , bmp.bmWidth , bmp.bmHeight , SRCCOPY) ;
DeleteDC( hmdc_tmp) ;
DeleteObject( hbmp) ;
return hmdc ;
}
int
x_imagelib_root_pixmap_available(
Display * display
)
{
return 0 ;
}
Pixmap
x_imagelib_get_transparent_background(
x_window_t * win ,
x_picture_modifier_t * pic_mod
)
{
return None ;
}
int
x_imagelib_load_file(
x_display_t * disp ,
char * path ,
u_int32_t ** cardinal,
Pixmap * pixmap,
Pixmap * mask,
unsigned int * width,
unsigned int * height
)
{
return 0 ;
}
int
x_delete_image(
Display * display ,
Pixmap pixmap
)
{
HBITMAP bmp ;
bmp = CreateBitmap( 1 , 1 , 1 , 1 , NULL) ;
DeleteObject( SelectObject( pixmap , bmp)) ;
DeleteDC( pixmap) ;
DeleteObject( bmp) ;
return 1 ;
}
|