texture.c - sam - An updated version of the sam text editor.
 (HTM) git clone git://vernunftzentrum.de/sam.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       texture.c (1188B)
       ---
            1 /* Copyright (c) 1998 Lucent Technologies - All rights reserved. */
            2 #include <u.h>
            3 #include <libg.h>
            4 #include "libgint.h"
            5 
            6 void
            7 texture(Bitmap *d, Rectangle r, Bitmap *s, Fcode f)
            8 {
            9     int x, y, w, h, bfunc;
           10     GC g;
           11 
           12     x = r.min.x;
           13     y = r.min.y;
           14     if(d->flag&SHIFT){
           15         x -= d->r.min.x;
           16         y -= d->r.min.y;
           17     }
           18     g = _getcopygc(f, d, s, &bfunc);
           19     if(d->flag&SHIFT){
           20         XSetTSOrigin(_dpy, g, -d->r.min.x, -d->r.min.y);
           21     }else
           22         XSetTSOrigin(_dpy, g, 0, 0);
           23     w = Dx(r);
           24     h = Dy(r);
           25     if(bfunc == UseFillRectangle){
           26         /* source isn't involved at all */
           27         XFillRectangle(_dpy, (Drawable)d->id, g, x, y, w, h);
           28     }else if(bfunc == UseCopyArea){
           29         XSetTile(_dpy, g, (Drawable)s->id);
           30         XSetFillStyle(_dpy, g, FillTiled);
           31         XFillRectangle(_dpy, (Drawable)d->id, g, x, y, w, h);
           32         XSetFillStyle(_dpy, g, FillSolid);
           33     }else{
           34         if(s->ldepth != 0)
           35             berror("unsupported texture");
           36         XSetStipple(_dpy, g, (Drawable)s->id);
           37         XSetFillStyle(_dpy, g, FillOpaqueStippled);
           38         XFillRectangle(_dpy, (Drawable)d->id, g, x, y, w, h);
           39         XSetFillStyle(_dpy, g, FillSolid);
           40     }
           41 }