static Pt centerOfRect(Rect r) { ret r == null ? null : new Pt(r.x+r.w/2, r.y+r.h/2); }