Erel, I know I understand what your saying but I'm not sure I understand how to implement it. Could you post a tiny example. Thanks in advance for your help.
Erel
I do it with the use of dzimage.dll :
I draw on another form and then copy the part I need to the image control.
I just thought it can save some time and code.
Hello Erel,
could the polygon function and the circle function, which exists for forms, also be added to the Drawer object so we have all the drawing functions in one object ?
Otherwise if I want to draw a filled ellipse I have to use the Drawer function and if I want to add a filled polygon I must do it on the form and then combine both images.
Thank's Erel
I know that the circle is a particular case of an ellipse.
But from the drawing point of view:
- the circle is defined by it's center coordinates and the radius
- the ellipse is defined by it's outer rectangle
So why not include both ?
Generally speaking in order to keep the language simple I prefer not to overload it with almost duplicated functions.
You can also achieve it with:
B4X:
Sub DrawCircle(drawerObject,x,y,r,color,fill)
rect.New1(x-r,y-r,2*r,2*r)
If fill Then
brush.Color = color
Control(drawerObject,Drawer).FillEllipse(brush.Value,rect.Value)
Else
pen.Color = color
Control(drawerObject,Drawer).DrawEllipse(pen.Value,rect.Value)
End If
Control(drawerObject,Drawer).Refresh2(rect.Value)
End Sub
Calling this sub:
DrawCircle ("drawer1",100,100,30,cRed,True)
Hello Erel
I understand your point of view not to overload the laguage with duplicate functions. But on the other hand it's not that convenient to have several fuctions on different places and then need to play with bitmaps or other objects to put everything together. I have some trouble with this.