ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>,
	Alfredo Catalina <alfredo.catalina@gmail.com>
Subject: Re: Laundry symbols (now: altered picture)
Date: Sun, 2 Jan 2022 15:36:36 +0100	[thread overview]
Message-ID: <adc5deeb-4420-e0e4-b8cb-8d17628fea2a@xs4all.nl> (raw)
In-Reply-To: <CAJ0n9ecc-DuOCe2xcWgnvxNE_bvAA96pG=7JFwcpghYN-7VF=Q@mail.gmail.com>

On 1/2/2022 3:12 PM, Alfredo Catalina via ntg-context wrote:
> I'm trying to use ConTeXt with Metafun to produce a map of a videogame I 
> am working on. In fact I did it 9 years ago but it seems that now it 
> doesn't work.
> 
> I have two 32 pixels wide by 40 pixels high sprites. They are saved in 
> the skysprite.png and sandsprite.png files. Since 32 = 4 x 8 and 40 = 5 
> x 8, the width/height ratio is 4/5.
> 
> This should produce a page with a sky sprite and a sand sprite, one 
> below the other. It worked in the past. Each sprite should be 4 x 0.095 
> cm = 0,38 cm wide and 5 x 0.095 cm = 0.475 cm high:
> 
> \starttext
> \setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,8pt]}]
> \startuseMPgraphic{mapa}
> u:=.095cm;
> draw externalfigure "./skysprite.png" xscaled 4u yscaled 5u shifted 
> (0u,-0u);
> draw externalfigure "./sandsprite.png" xscaled 4u yscaled 5u shifted 
> (0u,-5u);
> \stopuseMPgraphic
> \useMPgraphic{mapa}
> \stoptext
> 
> But instead I got two huge sprites of 2.8 cm x 4.4 cm.
> 
> Am I forgetting something?
Originally that worked because the image was always 'included' at 1 bp 
and then scaled but that was (1) inaccurate and (2) a bit depending on 
the image and (3) could overflow metapost.

Use xsized and ysized instead (absolute measures instead of scaling the 
unknown)

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 / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-01-02 14:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-05 13:18 Procházka Lukáš Ing. - Pontex s. r. o.
2012-06-05 14:26 ` Marco
2012-06-05 14:32   ` Wolfgang Schuster
2012-06-05 14:57     ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-06-05 15:01       ` Wolfgang Schuster
2012-06-05 15:13         ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-06-05 16:06           ` Wolfgang Schuster
2012-06-06  6:40             ` Procházka Lukáš Ing. - Pontex s. r. o.
2022-01-02 14:12 ` Alfredo Catalina via ntg-context
2022-01-02 14:36   ` Hans Hagen via ntg-context [this message]
2022-01-02 17:10     ` Alfredo Catalina via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adc5deeb-4420-e0e4-b8cb-8d17628fea2a@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=alfredo.catalina@gmail.com \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).