1 /**
2 ** patfplot.c
3 **
4 ** Copyright (c) 1995 Csaba Biegl, 820 Stirrup Dr, Nashville, TN 37221
5 ** [e-mail: csaba@vuse.vanderbilt.edu]
6 **
7 ** Copyright (C) 1992, Csaba Biegl
8 ** 820 Stirrup Dr, Nashville, TN, 37221
9 ** csaba@vuse.vanderbilt.edu
10 **
11 ** This file is part of the GRX graphics library.
12 **
13 ** The GRX graphics library is free software; you can redistribute it
14 ** and/or modify it under some conditions; see the "copying.grx" file
15 ** for details.
16 **
17 ** This library is distributed in the hope that it will be useful,
18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20 **
21 **/
22
23 #include "libgrx.h"
24 #include "clipping.h"
25
_GrPatternFilledPlot(int x,int y,GrPattern * p)26 void _GrPatternFilledPlot(int x,int y,GrPattern *p)
27 {
28 int xp,yp;
29
30 if(p->gp_ispixmap) {
31 xp = x % p->gp_pxp_width;
32 yp = y % p->gp_pxp_height;
33 (*CURC->gc_driver->drawpixel)(x,y,
34 (*p->gp_pxp_source.gf_driver->readpixel)(&p->gp_pxp_source,xp,yp)
35 );
36 }
37 else {
38 xp = x & 7;
39 yp = y % p->gp_bmp_height;
40 (*CURC->gc_driver->drawpixel)(x,y,
41 (p->gp_bmp_data[yp] & (0x80U >> xp)) ? p->gp_bmp_fgcolor : p->gp_bmp_bgcolor
42 );
43 }
44 }
45
GrPatternFilledPlot(int x,int y,GrPattern * p)46 void GrPatternFilledPlot(int x,int y,GrPattern *p)
47 {
48 clip_dot(CURC,x,y);
49 mouse_block(CURC,x,y,x,y);
50 _GrPatternFilledPlot(x+CURC->gc_xoffset,y+CURC->gc_yoffset, p);
51 mouse_unblock();
52 }
53
54