2 /****************************************************************************
3 * Copyright (C) 2002 by Leo Khramov
4 * email: leo@xnc.dubna.su
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 ****************************************************************************/
16 // $Id: xwellimagefont.cxx,v 1.1.1.1 2003/01/04 11:37:22 leo Exp $
18 /// module description
19 /// X11 version of imagefont - displays text with X11 calls, work with pixmaps
20 /// loaded thought XWellEngine class
22 #include "xwellimagefont.h"
24 //===========================================================================
25 /// global XWellImageFont(Images id, unsigned int ifl, unsigned int ifh, int idx, int idy)
26 /// Constructor of base draw text class
27 /// tags XWellImageFont
28 XWellImageFont::XWellImageFont(Images id
, unsigned int ifl
, unsigned int ifh
,
30 WellImageFont(id
,ifl
,ifh
,idx
,idy
)
32 xengine
=(XWellEngine
*) default_well_engine
;
33 font_pixmap
=xengine
->get_pixmap_of_image(id
);
34 mainw
=xengine
->get_main_window();
35 maingc
=xengine
->get_main_gc();
38 //===========================================================================
39 /// global clear_region()
40 /// clear region on screen for making output
41 /// tags XWellImageFont
42 void XWellImageFont::clear_region()
44 XClearArea(disp
,mainw
,screen_x
,screen_y
,screen_l
,screen_h
,False
);
47 //===========================================================================
48 /// global clear_region()
49 /// clear region on screen for making output
50 /// tags XWellImageFont
51 void XWellImageFont::clear_region(Colors idx
)
53 unsigned long *cols
=xengine
->get_colors();
54 XSetForeground(disp
,maingc
,cols
[idx
]);
55 XFillRectangle(disp
,mainw
,maingc
,screen_x
,screen_y
,screen_l
,screen_h
);
58 //===========================================================================
59 /// global draw_symbol(...)
60 /// draw one symbol from font image to screen
61 /// tags XWellImageFont
62 void XWellImageFont::draw_symbol(int ix
, int iy
,
67 if(symb
<=32 || symb
>=127)
69 symb
-=33; //Translate to our indexation
70 XCopyArea(disp
,font_pixmap
,mainw
,maingc
,
71 dx
,dy
+(int)symb
*font_h
,