Log In  
Log In  

Cart [#56400#] | Code | 2018-09-08 | License: CC4-BY-NC-SA | Embed

This is a small tool I wrote to help me visualize fill patterns for the fillp() function. I thought other people may find it useful so I posted it here.

The bit pattern is shown in hex below the pattern grid. You can select the colours to use and see a preview of the pattern in the lower half of the screen.


Cursor keys - move marker in grid
Z - change pattern bit or select colour
X - swap between colour grid and pattern grid.

or use the mouse.

P#56401 2018-09-08 06:20 ( Edited 2018-09-13 01:16)

:: dw817

I'm liking this tutorial, Neomech.

Could you please include a small bit of visible code in the demo showing the color selections as well as the commands used to select the pattern and drawing the rectangle ?

color(xx) if needed

Filling in a region with a colored pattern is pretty new for me to understand.

P#56424 2018-09-08 19:17 ( Edited 2018-09-08 23:17)
:: dw817

Bump, Neomech. Can you update this please ?

P#56492 2018-09-10 15:03 ( Edited 2018-09-10 19:03)

Hey dw817,

Perhaps give Neomech more than a couple of days to respond to your demands?
Unfortunately, not everyone be active every day on the BBS. :o/

P#56513 2018-09-11 01:28 ( Edited 2018-09-11 05:28)
:: dw817

No worries, LD. :) Like the postman, I only ask twice on any inquiry.

P#56524 2018-09-11 12:56 ( Edited 2018-09-11 21:37)

Hi dw817,

as Liquidream kindly pointed out I don't check this forum that often.

This cart was not really intended to be a tutorial, but rather a tool to help me interactively visualize patterns of colours, and I thought that others may find it useful for that too which is why I posted it.

Filling rectangles with colours is a pretty trivial process and only requires 2 lines of code such as this:

rectfill(0,0,128,128, 0x3a) 

this page explains it much better than i can:


hope that helps you.

P#56563 2018-09-12 09:11 ( Edited 2018-09-12 13:11)

Thanks! This will be very useful for designing patterns! (Like 0x1A48, a pretty cool looking diagonal brick pattern!)

P#56567 2018-09-12 09:30 ( Edited 2018-09-12 13:30)
:: dw817

Hi NeoMech:

  • Thanks for this information and your program. I guess what was confusing me was how to create a =2= color pattern. This code shows thus:
circfill(80, 80, 10, 6)
circfill(80, 80, 10, 8)

I thought it was something more complex. Guess not.

Thanks to your info I can now add PATTERNS to the paint program I'm working on.

P#56570 2018-09-12 11:48 ( Edited 2018-09-12 15:48)

you don't need to call circfill twice, you can specify both colours at once.

circfill(80, 80, 10, 0x68)

this is explained in the page I linked:

the color parameter to the drawing functions (such as circfill()) can set two colors, to be used for the on bits (1's) and off bits (0's) of the pattern. The four lower bits of the color value are the "on" color, and the higher bits are the "off" color. For example, to draw the on bits as light blue (12, or 0xc) and the off bits as dark blue (1), set the color to 0x1c (28).

P#56582 2018-09-12 16:07 ( Edited 2018-09-12 21:13)
:: dw817

Oh ! That's the part I didn't understand, that you can can set 2-colors per graphic element by going greater than 16, in this case 104.

That was the missing piece to my puzzle. Thanks, Neomech !

P#56590 2018-09-12 21:16 ( Edited 2018-09-13 01:16)

[Please log in to post a comment]

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-02-17 02:12 | 0.027s | 4194k | Q:36