1 /**
2  ** pattstrg.c ---- patterned character string output
3  **
4  ** Copyright (c) 1998 Hartmut Schirmer
5  ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
6  ** [e-mail: csaba@vuse.vanderbilt.edu]
7  **
8  ** This file is part of the GRX graphics library.
9  **
10  ** The GRX graphics library is free software; you can redistribute it
11  ** and/or modify it under some conditions; see the "copying.grx" file
12  ** for details.
13  **
14  ** This library is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17  **
18  **/
19 
20 #include "libgrx.h"
21 #include "clipping.h"
22 #include "shapes.h"
23 #include "text/text.h"
24 
PatternFilledBmp(int x,int y,int w,int h,int ox,int oy,char far * bmp,int pitch,int start,GrColor fg,GrColor bg,GrPattern * p)25 static void PatternFilledBmp(int x,int y,int w,int h,int ox, int oy,
26 				char far *bmp,int pitch,int start,
27 				GrColor fg,GrColor bg,GrPattern *p)
28 {
29     GRX_ENTER();
30     _GrFillBitmapPattern(x,y,w,h,bmp,pitch,start,p,bg);
31     GRX_LEAVE();
32 }
33 
GrPatternDrawString(void * text,int length,int x,int y,const GrTextOption * opt,GrPattern * p)34 void GrPatternDrawString(void *text,int length,int x,int y,
35 			 const GrTextOption *opt,GrPattern *p)
36 {
37     GRX_ENTER();
38     _GrDrawString(text,length,x,y,opt,p,PatternFilledBmp);
39     GRX_LEAVE();
40 }
41 
GrPatternDrawChar(int chr,int x,int y,const GrTextOption * opt,GrPattern * p)42 void GrPatternDrawChar(int chr,int x,int y,const GrTextOption *opt,GrPattern *p)
43 {
44     char  cbuff[2];
45     short sbuff[2];
46 
47     GRX_ENTER();
48     switch(opt->txo_chrtype) {
49       case GR_WORD_TEXT:
50       case GR_ATTR_TEXT:
51 	sbuff[0] = chr;
52 	GrPatternDrawString(sbuff,1,x,y,opt,p);
53 	break;
54       default:
55 	cbuff[0] = chr;
56 	GrPatternDrawString(cbuff,1,x,y,opt,p);
57 	break;
58     }
59     GRX_LEAVE();
60 }
61 
62 
63