Changeset 67
- Timestamp:
- 05/19/07 13:52:24 (2 years ago)
- Files:
-
- branches/bughunt/minwin/mswindows.d (modified) (1 diff)
- branches/bughunt/minwin/paint.d (modified) (4 diffs)
- branches/bughunt/minwin/window.d (modified) (1 diff)
- branches/bughunt/samples/painting.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/bughunt/minwin/mswindows.d
r53 r67 267 267 export int SetPolyFillMode(HDC hdc, int m); 268 268 export int GetPolyFillMode(HDC hdc); 269 export BOOL Polygon(HDC hdc, POINT* pts, int len); 269 270 270 271 /* branches/bughunt/minwin/paint.d
r48 r67 40 40 Dash = 1, /* ------- */ 41 41 Dot = 2, /* ······· */ 42 DashDot = 3 /* -·-·-·- */43 // todo: None?42 DashDot = 3, /* -·-·-·- */ 43 None = 4 /* */ 44 44 } 45 45 … … 120 120 } 121 121 void style(PenStyle s) { 122 native.lopnStyle = s; 122 native.lopnStyle = [ 123 PS_SOLID, 124 PS_DASH, 125 PS_DOT, 126 PS_DASHDOT, 127 PS_NULL 128 ][s]; 123 129 } 124 130 void lineJoin(LineJoin j) { … … 280 286 void drawText(int x, int y, char[] str) { 281 287 BOOL ok; 282 //int old = SetBkMode(peer,1); 288 //int old = SetBkMode(peer,1); // this fixes the solid bg problem 283 289 if (useWfuncs) { 284 wchar[]buf = toUTF16(str);290 scope buf = toUTF16(str); 285 291 ok = TextOutW(peer, x, y, buf.ptr, buf.length); 286 292 } … … 316 322 } 317 323 } 318 void drawBezier(Point[] pts) {319 // PolyBezier(peer,pts.ptr,pts.length);320 }321 324 void fillPolygon(Point[] pts) { 322 //? 325 //sysAssert(pen !is null, "Pen must be set for fillPolygon"); 326 sysAssert(brush !is null, "Brush must be set for fillPolygon"); 327 if (pts.length > 1) { 328 BOOL ok = Polygon(peer,&pts[0].native,pts.length); 329 sysAssert(ok != false, "Failed to fill polygon"); 330 } 323 331 } 324 332 void fillRegion(Region rgn) { 325 333 sysAssert(brush !is null, "Brush must be set for fillRect"); 334 sysAssert(false, "GContext.fillRegion not yet implemented"); 326 335 // FillRgn(peer,rgn,brush); 327 336 } branches/bughunt/minwin/window.d
r56 r67 388 388 this(char[] title = "", char[] name = "") { 389 389 peer = CreateWindowX("MinWinWindow", title, 390 MinWinWindowStyle | WS_VISIBLE,390 MinWinWindowStyle, 391 391 CW_USEDEFAULT, CW_USEDEFAULT, 392 392 DefaultWindowWidth, DefaultWindowHeight, branches/bughunt/samples/painting.d
r33 r67 18 18 GContext gc = im.getGContext(); 19 19 20 auto Penp2 = new Pen(RGB(0,0,0));20 scope p2 = new Pen(RGB(0,0,0)); 21 21 Pen oldPen = gc.setPen(p2); 22 22 Rect r = LTWH(0,0,100,150); 23 auto Brush b2 = new Brush(RGB(255,255,255));23 scope b2 = new Brush(RGB(200,200,200)); 24 24 Brush oldBrush = gc.setBrush(b2); 25 25 gc.fillRect(r); … … 30 30 pd.width = 4; 31 31 pd.style = PenStyle.Solid; 32 pd.color = RGB(1 00,0,120);33 auto Penp = new Pen(&pd);32 pd.color = RGB(150,0,180); 33 scope p = new Pen(&pd); 34 34 gc.setPen(p); 35 35 gc.drawLine(0,0,100,150); … … 41 41 win.paintDelegate ~= delegate void(Component source, GContext pc) { 42 42 43 auto Fontfont = new Font("", 20, FontWeight.Bold);44 Fontoldfont = pc.setFont(font);43 scope font = new Font("", 20, FontWeight.Bold); 44 auto oldfont = pc.setFont(font); 45 45 pc.drawText(100,100,"testing"); 46 46 pc.setFont(oldfont); … … 55 55 pc.drawPolygon(pts2); 56 56 57 // use a background brush 58 scope b1 = new Brush(RGB(0,255,0)); 59 auto oldBrush = pc.setBrush(b1); 60 57 61 static Point[4] pts3 = [{{100,10}},{{105,50}},{{110,30}},{{120,10}}]; 58 62 pc.fillPolygon(pts3); 59 63 64 scope b2 = new Brush(RGB(255,0,0)); 65 pc.setBrush(b2); 66 pc.fillRect(LTWH(130,10,20,20)); 67 68 pc.setBrush(oldBrush); 69 60 70 // try different line styles and colors 61 PenData pd;62 71 pd.width = 4; 63 72 pd.color = RGB(100,200,0); 64 73 pd.style = PenStyle.Dash; 65 auto Penp1 = new Pen(&pd);74 scope p1 = new Pen(&pd); 66 75 Pen oldPen = pc.setPen(p1); 67 76 pc.drawLine(10,100,20,200); 68 77 69 78 pd.color = RGB(0,200,200); 70 auto Penp2 = new Pen(&pd);79 scope p2 = new Pen(&pd); 71 80 pc.setPen(p2); 72 81 pc.drawLine(50,100,50,200);
