im looking for a chessboard hatch fill routine in basic or assembler

Discussions about the BBC BASIC language, with particular reference to BB4W and BBCSDL
777
Posts: 4
Joined: Sun 04 Sep 2022, 13:21

im looking for a chessboard hatch fill routine in basic or assembler

Post by 777 »

i need it to do hatching but like a chessboard. the other fill routine i used uses lines, which is no good. any ideas? ive looked everywhere.
Hated Moron

Re: im looking for a chessboard hatch fill routine in basic or assembler

Post by Hated Moron »

777 wrote: Mon 05 Sep 2022, 11:57 i need it to do hatching but like a chessboard. the other fill routine i used uses lines, which is no good. any ideas? ive looked everywhere.
You might want to consider switching to Matrix Brandy. I think it can do hatching natively, using the same commands as in Acorn's Graphics Extension ROM. The best place to ask would be at the Distillery Forum.

The only similar thing I've done in BBC BASIC for SDL 2.0 is using the gfxlib library, which allows you to mask one pattern with another, like this.
777
Posts: 4
Joined: Sun 04 Sep 2022, 13:21

Re: im looking for a chessboard hatch fill routine in basic or assembler

Post by 777 »

Hated Moron wrote: Mon 05 Sep 2022, 12:57
777 wrote: Mon 05 Sep 2022, 11:57 i need it to do hatching but like a chessboard. the other fill routine i used uses lines, which is no good. any ideas? ive looked everywhere.
You might want to consider switching to Matrix Brandy. I think it can do hatching natively, using the same commands as in Acorn's Graphics Extension ROM. The best place to ask would be at the Distillery Forum.

The only similar thing I've done in BBC BASIC for SDL 2.0 is using the gfxlib library, which allows you to mask one pattern with another, like this.
brandy matrix basic doesnt seem to do this. the gcol command just makes the shape invisible. ill try and run the graphics rom in an emulator
Hated Moron

Re: im looking for a chessboard hatch fill routine in basic or assembler

Post by Hated Moron »

777 wrote: Mon 05 Sep 2022, 13:42 brandy matrix basic doesnt seem to do this. the gcol command just makes the shape invisible. ill try and run the graphics rom in an emulator
What exactly are you trying to do? Are you trying to fill an arbitrary shape with a chessboard-style hatch pattern? How is that shape defined, as an outline or a solid figure?
Hated Moron

Re: im looking for a chessboard hatch fill routine in basic or assembler

Post by Hated Moron »

As I mentioned above, the only way I know to do something similar is using gfxlib:

Code: Select all

      INSTALL @lib$ + "gfxlib"
      INSTALL @lib$ + "aagfxlib"
      PROC_gfxInit

      REM Draw hatch pattern:
      GCOL 4,0
      FOR X% = 0 TO 1024 STEP 64
        RECTANGLE FILL X%, 0, 30, 1022
      NEXT
      FOR Y% = 0 TO 1024 STEP 64
        RECTANGLE FILL 0, Y%, 1022, 32
      NEXT

      REM Save hatch pattern:
      OSCLI "GSAVE """ + @tmp$ + "hatch.bmp"" 0,0,1024,1024"
      hatch%% = FN_gfxLoadTexture(@tmp$ + "hatch.bmp", &1000000)

      REM Clear screen:
      PROC_gfxClrX(0, 0, 0, 0)

      REM Draw shape to be filled:
      PROC_aaellipsefill(512, 512, 200, 200, 0, &FFFFFFFF)

      REM Fill shape with hatch pattern:
      PROC_gfxReversePlotScale(hatch%%, 512, 512, 0, 4)
Hated Moron

Re: im looking for a chessboard hatch fill routine in basic or assembler

Post by Hated Moron »

There's another thread related to this subject here.