URI:
       tborder.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
       tborder.c (703B)
       ---
            1 #include <u.h>
            2 #include <libc.h>
            3 #include <draw.h>
            4 
            5 void
            6 borderop(Image *im, Rectangle r, int i, Image *color, Point sp, Drawop op)
            7 {
            8         if(i < 0){
            9                 r = insetrect(r, i);
           10                 sp = addpt(sp, Pt(i,i));
           11                 i = -i;
           12         }
           13         drawop(im, Rect(r.min.x, r.min.y, r.max.x, r.min.y+i),
           14                 color, nil, sp, op);
           15         drawop(im, Rect(r.min.x, r.max.y-i, r.max.x, r.max.y),
           16                 color, nil, Pt(sp.x, sp.y+Dy(r)-i), op);
           17         drawop(im, Rect(r.min.x, r.min.y+i, r.min.x+i, r.max.y-i),
           18                 color, nil, Pt(sp.x, sp.y+i), op);
           19         drawop(im, Rect(r.max.x-i, r.min.y+i, r.max.x, r.max.y-i),
           20                 color, nil, Pt(sp.x+Dx(r)-i, sp.y+i), op);
           21 }
           22 
           23 void
           24 border(Image *im, Rectangle r, int i, Image *color, Point sp)
           25 {
           26         borderop(im, r, i, color, sp, SoverD);
           27 }