Hi again,
I haven't received any answers for my previous email, that's why I've built my own solution: a function called GrBitBlt1bpp. As the name suggests, it's very similar to GrBitBlt, except that the source bitmap must have 1 bpp frame mode, and that it accepts two color parameters, foreground and background.
I've put this function (provisionally) in bitblt.c
Here is the source code. I haven't tested it exhaustively, only some cases.
If anybody finds bugs, or has comments or suggestions, I would be glad to know about them.
void GrBitBlt1bpp(GrContext *dst,int dx,int dy, GrContext *src,int x1,int y1,int x2,int y2,GrColor fg, GrColor bg) { int oldx1,oldy1; int oldx2,oldy2; int dstx2,dsty2; GRX_ENTER(); if(dst == NULL) dst = CURC; if(src == NULL) src = CURC; if(src->gc_driver->num_planes != 1 || src->gc_driver->bits_per_pixel != 1) return; isort(x1,x2); oldx1 = x1; isort(y1,y2); oldy1 = y1; cxclip_ordbox(src,x1,y1,x2,y2); oldx1 = (dx += (x1 - oldx1)); oldy1 = (dy += (y1 - oldy1)); oldx2 = dstx2 = dx + x2 - x1; oldy2 = dsty2 = dy + y2 - y1; clip_ordbox(dst,dx,dy,dstx2,dsty2); x1 += (dx - oldx1); y1 += (dy - oldy1); x2 -= (oldx2 - dstx2); y2 -= (oldy2 - dsty2); mouse_block(src,x1,y1,x2,y2); mouse_addblock(dst,dx,dy,dstx2,dsty2);
(dst->gc_driver->drawbitmap)((dx + dst->gc_xoffset),(dy + dst->gc_yoffset), (x2 - x1 + 1),(y2 - y1 + 1),src->gc_baseaddr[0], src->gc_lineoffset, ((dx - oldx1) + ((dy - oldy1) * (src->gc_lineoffset << 3))), fg,bg);
mouse_unblock(); GRX_LEAVE(); }
Josu Onandia