Is there a way to convert an PNG or Jpeg into data statements?

User avatar
zarsoft
Posts: 19
Joined: Wed Dec 29, 2021 2:20 pm
Location: Portugal
Contact:

Re: Is there a way to convert an PNG or Jpeg into data statements?

Post by zarsoft »

dr beep wrote: Mon Jun 03, 2024 3:09 pm That I can make.
I will be waiting.

Here is a test in BASIC:

Code: Select all

VAR X1, Y1, X2, Y2 TYPE BYTE
VAR PLOTX,PLOTY,X,Y TYPE BYTE
VAR INC,DX,DY TYPE BYTE
VAR I TYPE BYTE
LET X1=PEEK 16438 : REM COORDS
LET Y1=PEEK 16439 : REM LAST PIXEL PLOTTED
LET X2=PEEK 16514
LET Y2=PEEK 16515
LET PLOTX=X1
LET PLOTY=Y1
REM PLOT PLOTX,PLOTY: REM PLOTTED BY PREVIOUS PLOT OR LINE
LET X=X2-X1
LET Y=Y2-Y1
LET DX=SGN (X)
LET DY=SGN (Y)
LET X=ABS (X)
LET Y=ABS (Y)
IF (X>Y) 
  LET INC=X/2
  FOR I=X TO 1 STEP -1
    LET INC=INC+Y
    IF X<INC THEN LET PLOTY=PLOTY+DY
    IF X<INC THEN LET INC=INC-X
    LET PLOTX=PLOTX+DX
    PLOT PLOTX,PLOTY
    REM RAND USR 16516
    REM LD B,PLOTY   
    REM LD C,PLOTX   
    REM CALL 0BB2
  NEXT I
ELSE
  REM Y>X
  LET INC=Y/2
  FOR I=Y TO 1 STEP -1
    LET INC=INC+X
    IF Y<INC THEN LET PLOTX=PLOTX+DX
    IF Y<INC THEN LET INC=INC-Y
    LET PLOTY=PLOTY+DY
    PLOT PLOTX,PLOTY
    REM RAND USR 16516
    REM LD B,PLOTY   
    REM LD C,PLOTX   
    REM CALL 0BB2
  NEXT I
ENDIF
dr beep
Posts: 2237
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: Is there a way to convert an PNG or Jpeg into data statements?

Post by dr beep »

See my game BOUNCING DOTS. In stead of a ball draw a line and I am ready.

viewtopic.php?p=49692#p49692
User avatar
zarsoft
Posts: 19
Joined: Wed Dec 29, 2021 2:20 pm
Location: Portugal
Contact:

Re: Is there a way to convert an PNG or Jpeg into data statements?

Post by zarsoft »

dr beep wrote: Mon Jun 03, 2024 4:19 pm See my game BOUNCING DOTS. In stead of a ball draw a line and I am ready.

I hope so.

Nice game.
Remind me of STRON.
https://arcalusitana.org/MuseuZX/index. ... rsoft].tap
Post Reply