non solid ovals?
BlitzMax Forums/BlitzMax Beginners Area/non solid ovals?
| ||
Hi, In Blitzplus you can draw an oval that is not solid.Not such thing in max?Do I have to draw a circle pixle by pixel? Thanks mudcat |
| ||
I guess I could do it like this.Graphics 1280,1024 While Not KeyHit(KEY_ESCAPE) Cls SetColor 255,0,0 'red DrawOval 500,500,320,320 SetColor 0,0,0 'black DrawOval 501,501,318,318 'one pixel wide Flip Wend later, mudcat |
| ||
http://www.blitzbasic.com/Community/posts.php?topic=42051#471407 |
| ||
teavirus, That code doesn't work.Maybe it's me,but it draws solid and the other draws nothing. Thanks anyway, mudcat |
| ||
that code is old and doesn't take into account the changes to BMax |
| ||
speaking of, a non-solid rect .. is that possible? Or is that completely ditched form bmax2d? (and yes ofcourse I could make my own using 4 lines, or 4 rects..) |
| ||
Here are two basic functions I wrote which work well, and draw fast. You can use the circle function like this: drawEllipse (350, 340, 180,250) ' oval at coordinates 350, 340 with an x radius of 180 and y radius of 250 Or you can change some of the extended features, like so: drawEllipse (350, 340, 180, 250, 6, 3, DOTTED) ' same as above, but with a higher resolution, thicker line and dotted turned on. etc... And the rectangle function is as simple as: drawl(200,200,190,100) ' draw rectangle from 200,200 and make it 190 pixels wide and 100 pixels high ...but if you want more features, you can get those too: drawl(200,200,190,100, 2, CORNERS) ' same as above, but draw thicker lines and only draw the corners etc... You can paste this code right onto the bottom of your program or save it in it's own file so that you can just include it in any program you write. I hope you like it. ;) Const NORMAL = 0 Const DOTTED = 1 Function drawEllipse(x:Int,y:Int,xSize:Int,ySize:Int,StepSize:Int = 15, width:Int=1, style:Int = NORMAL) Local oldlinewidth:Int = GetLineWidth(), dot:Int = 1 SetLineWidth width Local a:Int = stepSize Repeat If dot DrawLine x+xSize*Sin(a), y+ySize*Cos(a),x+xSize*Sin(a-stepSize), y+ySize*Cos(a-stepSize) a:+stepSize If style dot = 1-dot Until a> 360 SetLineWidth oldlinewidth EndFunction Const FILL = 3 Const LINE = 2 Const CORNERS = 1 Const BOX = 0 Function drawl(x1:Int,y1:Int,x2:Int,y2:Int,width:Int=1,style:Int = BOX) Local oldlinewidth:Int = GetLineWidth() SetLineWidth width Select style Case 3 DrawRect x1,y1,x2,y2 Case 2 x2:+x1 y2:+y1 DrawLine x1,y1,x2,y2 Case 1 x2:+x1 y2:+y1 DrawLine (x1,y1,x1+(x2-x1)*.1,y1) DrawLine (x1,y1,x1,y1+(y2-y1)*.1) DrawLine (x1,y2-(y2-y1)*.1,x1,y2) DrawLine (x1,y2,x1+(x2-x1)*.1,y2) DrawLine (x2,y1,x2-(x2-x1)*.1,y1) DrawLine (x2,y1,x2,y1+(y2-y1)*.1) DrawLine (x2,y2-(y2-y1)*.1,x2,y2) DrawLine (x2,y2,x2-(x2-x1)*.1,y2) Default x2:+x1 y2:+y1 DrawLine (x1,y1,x2,y1) DrawLine (x1,y1,x1,y2) DrawLine (x1,y2,x2,y2) DrawLine (x2,y1,x2,y2) EndSelect SetLineWidth oldlinewidth End Function |
| ||
See the BlitzMax code archives under Graphics, for the pixel-by-pixel integer-math-only (more or less) filled and unfilled circles and ellipses routines. e.g. http://www.blitzbasic.com/codearcs/codearcs.php?code=1477 |