Menu

worth it?

2020-01-28
2020-01-29
  • stan cartwright

    stan cartwright - 2020-01-28

    in glcd.h I noticed

    Sub RoundRect(In  RX1 as Word, In  RY1 as Word, In  RX2 as Word, In  RY2 as Word, Optional In  Color as Word=GLCDForeground)
        if RX1>RX2 then SWAP (RX1 , RX2)
        if RY1>RY2 then SWAP (RY1 , RY2)
        if (RX2-RX1>4) and (RY2-RY1>4) Then
           Pset (RX1+1, RY1+2 , Color)
           Pset (RX1+2, RY1+1 , Color)
           Pset (RX2-2, RY1+1 , Color)
           Pset (RX2-1, RY1+2 , Color)
           Pset (RX1+1, RY2-2 , Color)
           Pset (RX1+2, RY2-1 , Color)
           Pset (RX2-2, RY2-1 , Color)
           Pset (RX2-1, RY2-2 , Color)
           Line RX1+3, RY1 , RX2-3, RY1, Color
           Line RX1+3, RY2 , RX2-3, RY2, Color
           Line RX1 , RY1+3, RX1 , RY2-3, Color
           Line RX2 , RY1+3, RX2 , RY2-3, Color
        end if
    End Sub
    
    Sub FillRoundRect(In  RX1 as Word, In  RY1 as Word, In  RX2 as Word, In  RY2 as Word, Optional In  Color as Word=GLCDForeground)
        Dim FRI as Word
        if RX1>RX2 then SWAP (RX1 , RX2)
        if RY1>RY2 then SWAP (RY1 , RY2)
        if (RX2-RX1>4) and (RY2-RY1>4) Then
           for FRI=0 to (RY2-RY1)/2
               Select Case FRI
                   Case 0
                      Line RX1+3 , RY1 , RX2-3, RY1 , Color
                      Line RX1+3 , RY2 , RX2-3, RY2 , Color
                   Case 1
                      Line RX1+2 , RY1+1 , RX2-2, RY1+1 , Color
                      Line RX1+2 , RY2-1 , RX2-1, RY2-1 , Color
                   Case 2
                      Line RX1+1 , RY1+2 , RX2-1, RY1+2 , Color
                      Line RX1+1 , RY2-2 , RX2-1, RY2-2 , Color
                   Case Else
                      Line RX1 , RY1+FRI , RX2, RY1+FRI , Color
                      Line RX1 , RY2-FRI , RX2, RY2-FRI , Color
               End Select
           Next
        End if
    End Sub
    

    would

    Sub RoundRect(In  RX1 as Word, In  RY1 as Word, In  RX2 as Word, In  RY2 as Word, Optional In  Color as Word=GLCDForeground)
        if RX1>RX2 then SWAP (RX1 , RX2)
        if RY1>RY2 then SWAP (RY1 , RY2)
        if (RX2-RX1>4) then
           if (RY2-RY1>4) then
             Pset (RX1+1, RY1+2 , Color)
             Pset (RX1+2, RY1+1 , Color)
             Pset (RX2-2, RY1+1 , Color)
             Pset (RX2-1, RY1+2 , Color)
             Pset (RX1+1, RY2-2 , Color)
             Pset (RX1+2, RY2-1 , Color)
             Pset (RX2-2, RY2-1 , Color)
             Pset (RX2-1, RY2-2 , Color)
             Line RX1+3, RY1 , RX2-3, RY1, Color
             Line RX1+3, RY2 , RX2-3, RY2, Color
             Line RX1 , RY1+3, RX1 , RY2-3, Color
             Line RX2 , RY1+3, RX2 , RY2-3, Color
           end if
        end if
    End Sub
    
    Sub FillRoundRect(In  RX1 as Word, In  RY1 as Word, In  RX2 as Word, In  RY2 as Word, Optional In  Color as Word=GLCDForeground)
        Dim FRI as Word
        if RX1>RX2 then SWAP (RX1 , RX2)
        if RY1>RY2 then SWAP (RY1 , RY2)
        if (RX2-RX1>4) then
         if (RY2-RY1>4) Then
             for FRI=0 to (RY2-RY1)/2
                 Select Case FRI
                     Case 0
                        Line RX1+3 , RY1 , RX2-3, RY1 , Color
                        Line RX1+3 , RY2 , RX2-3, RY2 , Color
                     Case 1
                        Line RX1+2 , RY1+1 , RX2-2, RY1+1 , Color
                        Line RX1+2 , RY2-1 , RX2-1, RY2-1 , Color
                     Case 2
                        Line RX1+1 , RY1+2 , RX2-1, RY1+2 , Color
                        Line RX1+1 , RY2-2 , RX2-1, RY2-2 , Color
                     Case Else
                        Line RX1 , RY1+FRI , RX2, RY1+FRI , Color
                        Line RX1 , RY2-FRI , RX2, RY2-FRI , Color
                 End Select
             Next
         End if
        end if
    End Sub
    

    be an improvement and other occurences of and ?

     
  • stan cartwright

    stan cartwright - 2020-01-28

    I got a myglcd to play with.
    eg using ili9341 the read pixel works and you showed it's a 1x1 pixel window so could a row of pixels be read and stored if the window size was changed? could become scrolling or other use.

     
  • Anobium

    Anobium - 2020-01-29

    The methods you have found are used in several programs. They may not be published in the Help.

    If you have time to create a few pages of Help based upon https://github.com/Anobium/Great-Cow-BASIC-Help/blob/master/source/box.adoc or some similar Help page then we can add these to the Help on the next release.

    Need help to do this stuff.

     

Log in to post a comment.