ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] bytemap problem
@ 2025-05-11 16:07 Keith McKay
  2025-05-11 18:11 ` [NTG-context] " Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Keith McKay @ 2025-05-11 16:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users

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.
Thanks
Best Wishes
Keith
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: bytemap problem
  2025-05-11 16:07 [NTG-context] bytemap problem Keith McKay
@ 2025-05-11 18:11 ` Hans Hagen
  2025-05-11 18:35   ` Keith McKay
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2025-05-11 18:11 UTC (permalink / raw)
  To: Keith McKay, mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: bytemap problem
  2025-05-11 18:11 ` [NTG-context] " Hans Hagen
@ 2025-05-11 18:35   ` Keith McKay
  0 siblings, 0 replies; 3+ messages in thread
From: Keith McKay @ 2025-05-11 18:35 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2150 bytes --]

Thanks Hans!
I can see that bytemaps are going to be very useful. As for needing more
than 1024...
Thanks again.
Best Wishes

On Sun, 11 May 2025, 19:11 Hans Hagen, <j.hagen@xs4all.nl> wrote:

> 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
> -----------------------------------------------------------------
>

[-- Attachment #1.2: Type: text/html, Size: 3032 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-11 18:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-05-11 16:07 [NTG-context] bytemap problem Keith McKay
2025-05-11 18:11 ` [NTG-context] " Hans Hagen
2025-05-11 18:35   ` Keith McKay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).