Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with DRAW or my "scanning" routine?
#7
Thumbs Up 
(06-25-2023, 06:12 PM)TempodiBasic Wrote: @James D Jarvis

SOLVED!
the issue starts from the bug  that if you set a position on the screen and then you use a DRAW command to draws a line also of one pixel (S4r1) it draws the pixel of r command plus the pixel of the starting position!

buuut if you see at this your code you get the right output using a simple continue r command without bling moving of the graphic cursor.

Code: (Select All)
Rem 26 06 2023 SOLVED  TdB
'***************************************************************
'scanning a section of the screen converting and writing it with DRAW
'why doesn't it work?
'***************************************************************
Screen _NewImage(480, 400, 256)
$Console
_Console Off
Randomize Timer
Cls
_PrintMode _KeepBackground
_PrintString (0, 0), "AB"
'Line (1, 1)-(1, 14), 15
_Delay 0.5
msg$ = "<-- scanning this as a sample image"
_PrintString (40, 0), msg$
x = 0: y = 0
dd$ = ""
wid = 16
ht = 16
Draw "s4"
dd$ = Scan_draw$(x, y, ht, wid)
_Delay 1
Locate 4, 4
Line (40, 0)-(40 + Len(msg$) * 8, 15), 0, BF
msg$ = "ready (press any key)"
_PrintString (0, 100), msg$

Sleep
Line (0, 100)-(Len(msg$) * 8, 115), 0, BF
Locate 4, 4
Print "Draw Scanned image, Why isn't it drawing correctly?"
Print "Is the problem in the scanning routine or in how draw functions?"
putdraw 50, 0, dd$
drawto_console dd$
Input alldone$
End
'***************************************************************
' subroutines for making use of draw strings in 256 color mode.
' color 0 is treated as transpaernt
Sub putdraw (xx, yy, dd$)
    Draw "bm" + Str$(xx) + "," + Str$(yy) + dd$
End Sub
Sub drawto_console (dd$)
    'program must have console output activated earlier
    'prints the string in a clean console window so it may be copied and pasted on any system with console support
    sd& = _Dest
    _Console On
    _Dest _Console
    Cls
    Print dd$
    Print
    Print "Copy and Paste the above text for future use in DRAW commands"
    _Dest sd&
End Sub
Function Scan_draw$ (sx, sy, ht, wid)
    'scan a screen area starting at point sx,sy and saving it to the string DRW$ for use in later draw commands
    'simply scans each row and tracks color changes
    For y = 0 To ht - 1
        x = 0
        Do
            klr = Point(sx + x, sy + y)
            n = -1
            Do
                n = n + 1
                nklr = Point(x + n, y)

            Loop Until nklr <> klr Or x + n >= wid
            'If klr = 0 Then
            '    dd$ = dd$ + "br" + _Trim$(Str$(n))
            'Else
            dd$ = dd$ + "C" + _Trim$(Str$(klr)) + " " + "R" + _Trim$(Str$(n))
            ' End If
            x = x + n
        Loop Until x >= wid
        dd$ = dd$ + "bd1bl" + Str$(wid)
    Next y
    Scan_draw$ = dd$
End Function
in other words you have typed too code, REM out these lines of code 
Quote:'If klr = 0 Then
            '    dd$ = dd$ + "br" + _Trim$(Str$(n))
            'Else
       
            ' End If
and let work the  R command!
Quote:            dd$ = dd$ + "C" + _Trim$(Str$(klr)) + " " + "R" + _Trim$(Str$(n))
good continuation of developing you app

If the goal was to remove blur then you did it TempodiBasic! Smile
  724  855  599  923  575  468  400  206  147  564  878  823  652  556 bxor cross forever
Reply


Messages In This Thread
RE: Problem with DRAW or my "scanning" routine? - by bplus - 06-25-2023, 06:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm looking for suggestions to solve the problem! Petr 10 685 02-05-2026, 04:56 PM
Last Post: ahenry3068
  Nth problem with hardware images Ikerkaz 9 507 01-23-2026, 02:58 PM
Last Post: bplus
  Install problem...... jssantoro 6 397 12-17-2025, 08:31 PM
Last Post: madscijr
  maths problem with percentage pmackay 3 543 09-04-2025, 09:57 AM
Last Post: pmackay
  Problem with font in Teletext browser. SquirrelMonkey 7 763 08-27-2025, 11:38 AM
Last Post: BDS107

Forum Jump:


Users browsing this thread: 1 Guest(s)