1 /**
2 ** BCC2GRX - Interfacing Borland based graphics programs to LIBGRX
3 ** Copyright (C) 1993-97 by Hartmut Schirmer
4 **
5 **
6 ** Contact : Hartmut Schirmer
7 ** Feldstrasse 118
8 ** D-24105 Kiel
9 ** Germany
10 **
11 ** e-mail : hsc@techfak.uni-kiel.de
12 **
13 ** This file is part of the GRX graphics library.
14 **
15 ** The GRX graphics library is free software; you can redistribute it
16 ** and/or modify it under some conditions; see the "copying.grx" file
17 ** for details.
18 **
19 ** This library is distributed in the hope that it will be useful,
20 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22 **
23 **/
24
25 #include "bccgrx00.h"
26
27 /* ----------------------------------------------------------------- */
invert_image(GrContext * gc)28 static void invert_image (GrContext *gc)
29 {
30 int i, j, psize = GrPlaneSize(gc->gc_xmax + 1,gc->gc_ymax + 1);
31 for (i = 0; i < 4; ++i)
32 {
33 char *p = gc->gc_baseaddr[i];
34 if (p)
35 for (j = 0; j < psize; ++j)
36 p[j] ^= 0xff;
37 }
38 }
39
putimage(int left,int top,void * bitmap,int op)40 void putimage(int left, int top, void *bitmap, int op)
41 {
42 GrContext *gc;
43 GrColor gr_op;
44
45 _DO_INIT_CHECK;
46 GrSetContext(NULL);
47 GrResetClipBox();
48 gc = bitmap;
49 switch (op) {
50 case XOR_PUT : gr_op = GrXorModeColor(0); break;
51 case OR_PUT : gr_op = GrOrModeColor(0); break;
52 case AND_PUT : gr_op = GrAndModeColor(0); break;
53 default : gr_op = GrWriteModeColor(0); break;
54 }
55 if (op == NOT_PUT)
56 invert_image (gc);
57 GrBitBlt( NULL, left+VL, top+VT+PY, gc, 0, 0, gc->gc_xmax, gc->gc_ymax, gr_op);
58 if (op == NOT_PUT)
59 invert_image (gc);
60 __gr_Reset_ClipBox();
61 }
62
63