On 5/11/2025 6:07 PM, Keith McKay wrote:
Hi all,
I've been playing with bytemaps (see the latest LuaMetaFun manual) and I
have come across a problem when I create more than 15 bytemaps. This
came about as part of a bigger project where I create a large bytemap
and then make smaller bytemaps with the data from the large bytemap.
I've made a MWE below
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\startMPpage
i := 1;
for x = 1 upto 5:
for y := 1 upto 5:
newbytemap i of (250,250,3);
setbytemap i to (floor(uniformdeviate(255) +
1),floor(uniformdeviate(255) + 1),floor(uniformdeviate(255) + 1));
fill
unitsquare xyscaled (250,250) shifted ((x) * 255, (y) *255)
withbytemap i;
i := i + 1;
endfor;
endfor;
\stopMPpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The MWE above is for a 5 X 5 grid of randomly generated colours and you
can see that the last 10m squares are black. Changing x or y to 3 will
give 15 coloured squares, but a 4 X 4 grid and above gives black
squares above 15 coloured squares. I can't see anything wrong with the
code so I'm wondering if it is a bug.
Any advice would be gratefully received. I'm running the latest update
on a mac mini M1.
Ah, we have a buglet here. It started out as max 16 bytemaps but then I
bumped to (max) 1024 but forgot to replace some range tests. You can
test the new bin from the compile farm.
Thanks for keeping me on the edge. Do we need more than 1024? I guess not.
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________