* [NTG-context] Gray gradient with Metapost
@ 2023-10-05 19:50 Fabrice Couvreur
2023-10-05 19:51 ` [NTG-context] " Henning Hraban Ramm
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2023-10-05 19:50 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1819 bytes --]
Hi,
I would like to obtain, if possible, a gray gradient like in the image. My
code uses Metapost but maybe this is possible with Metafun.
Thanks.
Fabrice
\starttext
\startMPcode
u=1.2cm;
interim ahangle := 30;
z0=(0,0);
z1=(3u,0);
z2=(3u,4u);
z3=(0,4u);
z4=(0.8u,4u);
z5=(2.2u,4u);
path rectangle;
rectangle=z0--z1--z2--z3--cycle;
picture X;
X = image(
drawoptions(withpen pencircle scaled 1.25 withcolor
\MPcolor{orange});
draw (left--right) scaled 2;
draw (down--up) scaled 2;
drawoptions();
);
fill z0--z4--z3--cycle withcolor .5[red,green];
fill z1--z5--z2--cycle withcolor .5[red,green];
fill z0--z4--z5--z1--cycle withcolor 0.625white;
draw z0--z4--z3--cycle;
draw z1--z5--z2--cycle;
draw rectangle;
path a[];
a1 = subpath (0, 1) of rectangle shifted 10 down;
a2 = subpath (3, 4) of rectangle shifted 10 left;
a3 = subpath (2.26, 2.76) of rectangle shifted 13 up;
drawdblarrow a1; label.bot("$30$", point 1/2 of a1);
drawdblarrow a2; label.lft("$x+20$", point 1/2 of a2);
drawdblarrow a3; label.top("$x$", point 1/2 of a3);
draw X shifted z0;
draw X shifted z1;
draw X shifted z2;
draw X shifted z3;
draw X shifted z4;
draw X shifted z5;
label.ulft("B",z3);
label.urt("C",z2);
label.lrt("D",z1);
label.llft("A",z0);
label.top("E",z4);
label.top("F",z5);
\stopMPcode
\stoptext
[-- Attachment #1.2: Type: text/html, Size: 2685 bytes --]
[-- Attachment #2: miroir.png --]
[-- Type: image/png, Size: 39785 bytes --]
[-- Attachment #3: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
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] 6+ messages in thread
* [NTG-context] Re: Gray gradient with Metapost
2023-10-05 19:50 [NTG-context] Gray gradient with Metapost Fabrice Couvreur
@ 2023-10-05 19:51 ` Henning Hraban Ramm
2023-10-06 8:08 ` Keith McKay
0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2023-10-05 19:51 UTC (permalink / raw)
To: ntg-context
Am 05.10.23 um 21:50 schrieb Fabrice Couvreur:
> Hi,
> I would like to obtain, if possible, a gray gradient like in the image.
> My code uses Metapost but maybe this is possible with Metafun.
Have a look into the Metafun manual, chapter 8.1 “shading”.
Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
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] 6+ messages in thread
* [NTG-context] Re: Gray gradient with Metapost
2023-10-05 19:51 ` [NTG-context] " Henning Hraban Ramm
@ 2023-10-06 8:08 ` Keith McKay
2023-10-06 8:26 ` Henning Hraban Ramm
0 siblings, 1 reply; 6+ messages in thread
From: Keith McKay @ 2023-10-06 8:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1042 bytes --]
Also look at the LuaMetaFun manual chapter 8. In fact the whole manual is
worth a read. I'm sure you find much of use in it.
Best Wishes
Keith
On Thu, 5 Oct 2023, 20:52 Henning Hraban Ramm, <texml@fiee.net> wrote:
> Am 05.10.23 um 21:50 schrieb Fabrice Couvreur:
> > Hi,
> > I would like to obtain, if possible, a gray gradient like in the image.
> > My code uses Metapost but maybe this is possible with Metafun.
>
> Have a look into the Metafun manual, chapter 8.1 “shading”.
>
> Hraban
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 1874 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
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] 6+ messages in thread
* [NTG-context] Re: Gray gradient with Metapost
2023-10-06 8:08 ` Keith McKay
@ 2023-10-06 8:26 ` Henning Hraban Ramm
2023-10-07 15:54 ` Fabrice Couvreur
0 siblings, 1 reply; 6+ messages in thread
From: Henning Hraban Ramm @ 2023-10-06 8:26 UTC (permalink / raw)
To: ntg-context
While the luametafun (“Metafun XL”) manual is also (meta)fun, I meant
the general metafun(-s|-p) manual, the big one (>400 p. in the “print”
version, >600 p. in the “screen” version). Recommended!
Hraban
Am 06.10.23 um 10:08 schrieb Keith McKay:
> Also look at the LuaMetaFun manual chapter 8. In fact the whole manual
> is worth a read. I'm sure you find much of use in it.
> Best Wishes
> Keith
>
> On Thu, 5 Oct 2023, 20:52 Henning Hraban Ramm, <texml@fiee.net
> <mailto:texml@fiee.net>> wrote:
>
> Am 05.10.23 um 21:50 schrieb Fabrice Couvreur:
> > Hi,
> > I would like to obtain, if possible, a gray gradient like in the
> image.
> > My code uses Metapost but maybe this is possible with Metafun.
>
> Have a look into the Metafun manual, chapter 8.1 “shading”.
>
> Hraban
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
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] 6+ messages in thread
* [NTG-context] Re: Gray gradient with Metapost
2023-10-06 8:26 ` Henning Hraban Ramm
@ 2023-10-07 15:54 ` Fabrice Couvreur
2023-10-07 16:29 ` Keith McKay
0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2023-10-07 15:54 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1879 bytes --]
Hi,
Sorry for the late response. Thanks for the help. So I read the documents
and managed to get a gradient even if it's not exactly like the figure.
Fabrice
draw lmt_shade [
path = (z0--z4--z5--z1--cycle),
direction = "left",
alternative = "linear",
colors = {"black", "lightgray"},
] ;
Le ven. 6 oct. 2023 à 08:27, Henning Hraban Ramm <texml@fiee.net> a écrit :
> While the luametafun (“Metafun XL”) manual is also (meta)fun, I meant
> the general metafun(-s|-p) manual, the big one (>400 p. in the “print”
> version, >600 p. in the “screen” version). Recommended!
>
> Hraban
>
> Am 06.10.23 um 10:08 schrieb Keith McKay:
> > Also look at the LuaMetaFun manual chapter 8. In fact the whole manual
> > is worth a read. I'm sure you find much of use in it.
> > Best Wishes
> > Keith
> >
> > On Thu, 5 Oct 2023, 20:52 Henning Hraban Ramm, <texml@fiee.net
> > <mailto:texml@fiee.net>> wrote:
> >
> > Am 05.10.23 um 21:50 schrieb Fabrice Couvreur:
> > > Hi,
> > > I would like to obtain, if possible, a gray gradient like in the
> > image.
> > > My code uses Metapost but maybe this is possible with Metafun.
> >
> > Have a look into the Metafun manual, chapter 8.1 “shading”.
> >
> > Hraban
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 3158 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
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] 6+ messages in thread
* [NTG-context] Re: Gray gradient with Metapost
2023-10-07 15:54 ` Fabrice Couvreur
@ 2023-10-07 16:29 ` Keith McKay
0 siblings, 0 replies; 6+ messages in thread
From: Keith McKay @ 2023-10-07 16:29 UTC (permalink / raw)
To: mailing list for ConTeXt users, Fabrice Couvreur
[-- Attachment #1.1: Type: text/plain, Size: 3277 bytes --]
Hi Fabrice,
You could define you own shades of gray (I believe there are at least
50) by adjusting the rgb values as I've shown below.
definecolor [ name = "verylightgray", r = 0.995, g = 0.995, b = 0.995 ] ;
definecolor [ name = "lightergray", r = 0.55, g = 0.55, b = 0.55 ] ;
draw lmt_shade [
path = (z0--z4--z5--z1--cycle),
direction = "left",
alternative = "linear",
colors = {"lightergray", "verylightgray"},
] xshifted 5cm;
I added it to your code after the lines:
draw z0--z4--z3--cycle;
draw z1--z5--z2--cycle;
draw rectangle;
Hope this helps.
Best Wishes
Keith
On 07/10/2023 16:54, Fabrice Couvreur wrote:
> Hi,
> Sorry for the late response. Thanks for the help. So I read the
> documents and managed to get a gradient even if it's not exactly like
> the figure.
> Fabrice
>
> draw lmt_shade [
> path = (z0--z4--z5--z1--cycle),
> direction = "left",
> alternative = "linear",
> colors = {"black", "lightgray"},
> ] ;
>
> Le ven. 6 oct. 2023 à 08:27, Henning Hraban Ramm <texml@fiee.net> a
> écrit :
>
> While the luametafun (“Metafun XL”) manual is also (meta)fun, I meant
> the general metafun(-s|-p) manual, the big one (>400 p. in the
> “print”
> version, >600 p. in the “screen” version). Recommended!
>
> Hraban
>
> Am 06.10.23 um 10:08 schrieb Keith McKay:
> > Also look at the LuaMetaFun manual chapter 8. In fact the whole
> manual
> > is worth a read. I'm sure you find much of use in it.
> > Best Wishes
> > Keith
> >
> > On Thu, 5 Oct 2023, 20:52 Henning Hraban Ramm, <texml@fiee.net
> > <mailto:texml@fiee.net>> wrote:
> >
> > Am 05.10.23 um 21:50 schrieb Fabrice Couvreur:
> > > Hi,
> > > I would like to obtain, if possible, a gray gradient like
> in the
> > image.
> > > My code uses Metapost but maybe this is possible with
> Metafun.
> >
> > Have a look into the Metafun manual, chapter 8.1 “shading”.
> >
> > Hraban
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an
> entry to the Wiki!
>
> maillist : {listname} /
> https://mailman.ntg.nl/mailman3/lists/{list_id}
> <https://mailman.ntg.nl/mailman3/lists/%7Blist_id%7D>
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net
> (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
> ___________________________________________________________________________________
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : {listname} /https://mailman.ntg.nl/mailman3/lists/{list_id}
> webpage :https://www.pragma-ade.nl /https://context.aanhet.net (mirror)
> archive :https://github.com/contextgarden/context
> wiki :https://wiki.contextgarden.net
> ___________________________________________________________________________________
[-- Attachment #1.2: Type: text/html, Size: 8912 bytes --]
[-- Attachment #2: Type: text/plain, Size: 495 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : {listname} / https://mailman.ntg.nl/mailman3/lists/{list_id}
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] 6+ messages in thread
end of thread, other threads:[~2023-10-07 16:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 19:50 [NTG-context] Gray gradient with Metapost Fabrice Couvreur
2023-10-05 19:51 ` [NTG-context] " Henning Hraban Ramm
2023-10-06 8:08 ` Keith McKay
2023-10-06 8:26 ` Henning Hraban Ramm
2023-10-07 15:54 ` Fabrice Couvreur
2023-10-07 16:29 ` 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).