Coordinates to the right and below the screen will not display using DrawRect. Is this a bug?
'Activity module
Sub Process_Globals
End Sub
Sub Globals
Type CDI_DDD_POINT(x As Float, y As Float, z As Float)
Dim ScreenExtents As Float
Dim pnlCursor As Panel
Dim pnlDrawing As Panel
Dim rectPanels As Rect
Dim DrawingCanvas As Canvas
Dim CursorCanvas As Canvas
Dim cx1 As Float
Dim cy1 As Float
Dim cx2 As Float
Dim cy2 As Float
ScreenExtents=1280
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlDrawing.Initialize("pnlDrawing")
Activity.AddView(pnlDrawing, 0, 0, ScreenExtents, ScreenExtents)
rectPanels.Initialize(0, 0, pnlDrawing.Width, pnlDrawing.Height)
DrawingCanvas.Initialize(pnlDrawing)
pnlCursor.Initialize("pnlCursor")
Activity.AddView(pnlCursor, 0, 0 , ScreenExtents, ScreenExtents)
rectPanels.Initialize(0, 0, pnlCursor.Width, pnlCursor.Height)
CursorCanvas.Initialize(pnlCursor)
Dim r As Rect
r.Initialize(0, 0, 100%x, 100%y)
DrawingCanvas.DrawRECT(r, Colors.Transparent, True, 0)
pnlDrawing.Invalidate
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
Select Case KeyCode
Case KeyCodes.KEYCODE_BACK
Return True
Case Else
Return False
End Select
End Sub
Sub DrawRECT(cnvs As Canvas, px1 As Float, py1 As Float, px2 As Float,py2 As Float, color As Int, weight As Int)
Dim Rect1 As Rect
Rect1.Initialize(px1, py1, px2, py2)
cnvs.DrawRECT(Rect1, color, False, weight)
pnlDrawing.Invalidate
End Sub
Sub pnlCursor_Touch(Action As Int, x As Float, y As Float)
Dim CurrentLineColor As Int
Dim CurrentLineWeight As Int
Dim CurrentCursorColor As Int
Dim Rect1 As Rect
Dim MirrorPoint As CDI_DDD_POINT
CurrentLineColor=Colors.ARGB(255,255,255,255)
CurrentLineWeight=25
CurrentCursorColor=Colors.Green
Select Action
Case Activity.ACTION_DOWN
cx1 = x
cy1 = y
cx2 = x
cy2 = y
Case Activity.ACTION_MOVE
CursorCanvas.DrawLINE(cx1, cy1, cx2, cy2, Colors.Transparent, CurrentLineWeight)
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, cx2, cy2, 0)
CursorCanvas.DrawLINE(cx1, cy1, cx1, MirrorPoint.y, Colors.Transparent, CurrentLineWeight)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, cx2, cy2)
CursorCanvas.DrawRECT(Rect1, Colors.Transparent, False, CurrentLineWeight)
pnlCursor.Invalidate
cx2 = x
cy2 = y
CursorCanvas.DrawLINE(cx1, cy1, cx2, cy2, CurrentCursorColor, CurrentLineWeight)
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, cx2, cy2, 0)
CursorCanvas.DrawLINE(cx1, cy1, cx1, MirrorPoint.y, CurrentCursorColor, CurrentLineWeight)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, cx2, cy2)
CursorCanvas.DrawRECT(Rect1, CurrentCursorColor , False, CurrentLineWeight)
pnlCursor.Invalidate
Case Activity.ACTION_UP
CursorCanvas.DrawLINE(cx1, cy1, cx2, cy2, Colors.Transparent, CurrentLineWeight)
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, cx2, cy2, 0)
CursorCanvas.DrawLINE(cx1, cy1, cx1, MirrorPoint.y, Colors.Transparent, CurrentLineWeight)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, cx2, cy2)
CursorCanvas.DrawRECT(Rect1, Colors.Transparent, False, CurrentLineWeight)
pnlCursor.Invalidate
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, x, y, 0)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, x, y)
DrawRECT(DrawingCanvas, MirrorPoint.x, MirrorPoint.y, x, y, CurrentLineColor, CurrentLineWeight)
pnlCursor.Invalidate
End Select
End Sub
Sub GetMirrorPoint(pnt0x As Float, pnt0y As Float, pnt0z As Float, pnt1x As Float, pnt1y As Float, pnt1z As Float) As CDI_DDD_POINT
Dim result As CDI_DDD_POINT
result.x = pnt0x - (pnt1x - pnt0x)
result.y = pnt0y - (pnt1y - pnt0y)
result.z = pnt0z - (pnt1z - pnt0z)
Return result
End Sub
Sub AddWebView(x1 As Float, y1 As Float,x2 As Float, y2 As Float)
pnlDrawing.AddView(MakeWebView("http://nycissues.org"),x1,y1,x2,y2)
End Sub
Sub MakeWebView(URL As String) As WebView
Dim TempWebView As WebView
TempWebView.Initialize("TempWebView")
TempWebView.LoadUrl(URL)
Return TempWebView
End Sub
'Activity module
Sub Process_Globals
End Sub
Sub Globals
Type CDI_DDD_POINT(x As Float, y As Float, z As Float)
Dim ScreenExtents As Float
Dim pnlCursor As Panel
Dim pnlDrawing As Panel
Dim rectPanels As Rect
Dim DrawingCanvas As Canvas
Dim CursorCanvas As Canvas
Dim cx1 As Float
Dim cy1 As Float
Dim cx2 As Float
Dim cy2 As Float
ScreenExtents=1280
End Sub
Sub Activity_Create(FirstTime As Boolean)
pnlDrawing.Initialize("pnlDrawing")
Activity.AddView(pnlDrawing, 0, 0, ScreenExtents, ScreenExtents)
rectPanels.Initialize(0, 0, pnlDrawing.Width, pnlDrawing.Height)
DrawingCanvas.Initialize(pnlDrawing)
pnlCursor.Initialize("pnlCursor")
Activity.AddView(pnlCursor, 0, 0 , ScreenExtents, ScreenExtents)
rectPanels.Initialize(0, 0, pnlCursor.Width, pnlCursor.Height)
CursorCanvas.Initialize(pnlCursor)
Dim r As Rect
r.Initialize(0, 0, 100%x, 100%y)
DrawingCanvas.DrawRECT(r, Colors.Transparent, True, 0)
pnlDrawing.Invalidate
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'return true if you want to consume the event
Select Case KeyCode
Case KeyCodes.KEYCODE_BACK
Return True
Case Else
Return False
End Select
End Sub
Sub DrawRECT(cnvs As Canvas, px1 As Float, py1 As Float, px2 As Float,py2 As Float, color As Int, weight As Int)
Dim Rect1 As Rect
Rect1.Initialize(px1, py1, px2, py2)
cnvs.DrawRECT(Rect1, color, False, weight)
pnlDrawing.Invalidate
End Sub
Sub pnlCursor_Touch(Action As Int, x As Float, y As Float)
Dim CurrentLineColor As Int
Dim CurrentLineWeight As Int
Dim CurrentCursorColor As Int
Dim Rect1 As Rect
Dim MirrorPoint As CDI_DDD_POINT
CurrentLineColor=Colors.ARGB(255,255,255,255)
CurrentLineWeight=25
CurrentCursorColor=Colors.Green
Select Action
Case Activity.ACTION_DOWN
cx1 = x
cy1 = y
cx2 = x
cy2 = y
Case Activity.ACTION_MOVE
CursorCanvas.DrawLINE(cx1, cy1, cx2, cy2, Colors.Transparent, CurrentLineWeight)
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, cx2, cy2, 0)
CursorCanvas.DrawLINE(cx1, cy1, cx1, MirrorPoint.y, Colors.Transparent, CurrentLineWeight)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, cx2, cy2)
CursorCanvas.DrawRECT(Rect1, Colors.Transparent, False, CurrentLineWeight)
pnlCursor.Invalidate
cx2 = x
cy2 = y
CursorCanvas.DrawLINE(cx1, cy1, cx2, cy2, CurrentCursorColor, CurrentLineWeight)
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, cx2, cy2, 0)
CursorCanvas.DrawLINE(cx1, cy1, cx1, MirrorPoint.y, CurrentCursorColor, CurrentLineWeight)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, cx2, cy2)
CursorCanvas.DrawRECT(Rect1, CurrentCursorColor , False, CurrentLineWeight)
pnlCursor.Invalidate
Case Activity.ACTION_UP
CursorCanvas.DrawLINE(cx1, cy1, cx2, cy2, Colors.Transparent, CurrentLineWeight)
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, cx2, cy2, 0)
CursorCanvas.DrawLINE(cx1, cy1, cx1, MirrorPoint.y, Colors.Transparent, CurrentLineWeight)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, cx2, cy2)
CursorCanvas.DrawRECT(Rect1, Colors.Transparent, False, CurrentLineWeight)
pnlCursor.Invalidate
MirrorPoint=GetMirrorPoint(cx1, cy1, 0, x, y, 0)
Rect1.Initialize(MirrorPoint.x, MirrorPoint.y, x, y)
DrawRECT(DrawingCanvas, MirrorPoint.x, MirrorPoint.y, x, y, CurrentLineColor, CurrentLineWeight)
pnlCursor.Invalidate
End Select
End Sub
Sub GetMirrorPoint(pnt0x As Float, pnt0y As Float, pnt0z As Float, pnt1x As Float, pnt1y As Float, pnt1z As Float) As CDI_DDD_POINT
Dim result As CDI_DDD_POINT
result.x = pnt0x - (pnt1x - pnt0x)
result.y = pnt0y - (pnt1y - pnt0y)
result.z = pnt0z - (pnt1z - pnt0z)
Return result
End Sub
Sub AddWebView(x1 As Float, y1 As Float,x2 As Float, y2 As Float)
pnlDrawing.AddView(MakeWebView("http://nycissues.org"),x1,y1,x2,y2)
End Sub
Sub MakeWebView(URL As String) As WebView
Dim TempWebView As WebView
TempWebView.Initialize("TempWebView")
TempWebView.LoadUrl(URL)
Return TempWebView
End Sub