I'm starting to struggle with the Icon Editor application
I've created a 32x32 grid on the Form which is going to be used to create the icon and each section of the grid is 5x5 pixels.
Now I am wanting to create a line tool that will allow the user to select the start and end point then draw a line between.
This was simple enough to implement except that I have a slight problem... I want each section of the grid that the line touches to be filled.
How can I achieve this?
Has anyone any ideas?
This is what I have so far....
Maybe I am approaching the problem in completely the wrong way, any suggestions would be greatly appreciated.
Thanks,
RandomCoder.
I've created a 32x32 grid on the Form which is going to be used to create the icon and each section of the grid is 5x5 pixels.
Now I am wanting to create a line tool that will allow the user to select the start and end point then draw a line between.
This was simple enough to implement except that I have a slight problem... I want each section of the grid that the line touches to be filled.
How can I achieve this?
Has anyone any ideas?
This is what I have so far....
B4X:
Sub Globals
Dim Type(Name,Colour,Size) Tool
Dim Palette(256)
X1="": Y1="": MouseDown=False
End Sub
Sub Designer_MouseDown (X,Y)
...
Select Tool.Name
Case "Pen"
...
Case "Sucker"
...
Case "Line"
[COLOR="Red"]X1=Int(X/5)*5: Y1=Int(Y/5)*5[/COLOR]
End Select
...
...
End Sub
Sub Designer_MouseUp (X,Y)
If MouseDown=True AND Tool.Name="Line" Then
[COLOR="red"] X2=Int(X/5)*5: If X2>Designer.Width-10 Then X2=Designer.Width-10
Y2=Int(Y/5)*5: If Y2>165 Then Y2=165
Designer.Line(X1,Y1,X2,Y2,Tool.Colour)[/COLOR]
End If
MouseDown=False
...
End Sub
Maybe I am approaching the problem in completely the wrong way, any suggestions would be greatly appreciated.
Thanks,
RandomCoder.