ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Feature request for backgrounds
@ 2007-10-11 10:16 Wolfgang Schuster
  2007-10-11 11:44 ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-10-11 10:16 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi Hans,

can you provide a backgroundimage key for localframed (ot use it in framed)
and fastlocalframed (to use it in \setupbackgrounds) to create something like:

\setupexternalfigures[location=global]
\setupcolors[state=start]

\starttext

\defineoverlay
  [Wallpaper]
  [\backgroundimage{1}{\paperwidth}{\paperheight}{\externalfigure[cow]}]

\setupbackgrounds
  [page]
  [background={color,Wallpaper},
   backgroundcolor=orange]

\startstandardmakeup
\stopstandardmakeup

\stoptext

I want to write the above example in the following way,

\setupbackgrounds
  [page]
  [background={color,image},
   backgroundcolor=orange,
   backgroundimage=cow]

The same mechanism should be also possible for \framed.

It should be possible to enable a image and a backgroundcolor at the same
time to have a fallback mechanism for the case there is no image available
or I want a colored background behind the image.

I have also a few wishes for \backgroundimage command in core-box,
is it possible let the graphics start in the left top corner and crop it only
at the ride side and at the bottom like the default bahaviour in html.

Shouldn't the \scratchbox in the \nextboxwd test be a \nextbox.

Wolfgang
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Feature request for backgrounds
  2007-10-11 10:16 Feature request for backgrounds Wolfgang Schuster
@ 2007-10-11 11:44 ` Hans Hagen
  2007-10-11 14:35   ` Wolfgang Schuster
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2007-10-11 11:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster wrote:
> Hi Hans,
> 
> can you provide a backgroundimage key for localframed (ot use it in framed)
> and fastlocalframed (to use it in \setupbackgrounds) to create something like:
> 
> \setupexternalfigures[location=global]
> \setupcolors[state=start]
> 
> \starttext
> 
> \defineoverlay
>   [Wallpaper]
>   [\backgroundimage{1}{\paperwidth}{\paperheight}{\externalfigure[cow]}]
> 
> \setupbackgrounds
>   [page]
>   [background={color,Wallpaper},
>    backgroundcolor=orange]
> 
> \startstandardmakeup
> \stopstandardmakeup
> 
> \stoptext
> 
> I want to write the above example in the following way,
> 
> \setupbackgrounds
>   [page]
>   [background={color,image},
>    backgroundcolor=orange,
>    backgroundimage=cow]
> 
> The same mechanism should be also possible for \framed.
> 
> It should be possible to enable a image and a backgroundcolor at the same
> time to have a fallback mechanism for the case there is no image available
> or I want a colored background behind the image.

- you can use background anc backgroundcolor at the same time
- you can have multiple backgrounds

\defineoverlay[one][\overlayfigure{name}]
\defineoverlay[two][abcdef]

\setupbackgrounds[page][background={one,two}]

\setupbackgrounds[page][background={one,foreground,two}]


etc

> I have also a few wishes for \backgroundimage command in core-box,
> is it possible let the graphics start in the left top corner and crop it only
> at the ride side and at the bottom like the default bahaviour in html.

i think that there is some code in the x-fo file for that

> Shouldn't the \scratchbox in the \nextboxwd test be a \nextbox.

where?

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Feature request for backgrounds
  2007-10-11 11:44 ` Hans Hagen
@ 2007-10-11 14:35   ` Wolfgang Schuster
  2007-10-11 19:42     ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-10-11 14:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

2007/10/11, Hans Hagen <pragma@wxs.nl>:
> Wolfgang Schuster wrote:
> > Hi Hans,
> >
> > can you provide a backgroundimage key for localframed (ot use it in
framed)
> > and fastlocalframed (to use it in \setupbackgrounds) to create something
like:
> >
> > \setupexternalfigures[location=global]
> > \setupcolors[state=start]
> >
> > \starttext
> >
> > \defineoverlay
> >   [Wallpaper]
> >   [\backgroundimage{1}{\paperwidth}{\paperheight}{\externalfigure[cow]}]
> >
> > \setupbackgrounds
> >   [page]
> >   [background={color,Wallpaper},
> >    backgroundcolor=orange]
> >
> > \startstandardmakeup
> > \stopstandardmakeup
> >
> > \stoptext
> >
> > I want to write the above example in the following way,
> >
> > \setupbackgrounds
> >   [page]
> >   [background={color,image},
> >    backgroundcolor=orange,
> >    backgroundimage=cow]
> >
> > The same mechanism should be also possible for \framed.
> >
> > It should be possible to enable a image and a backgroundcolor at the
same
> > time to have a fallback mechanism for the case there is no image
available
> > or I want a colored background behind the image.
>
> - you can use background anc backgroundcolor at the same time
> - you can have multiple backgrounds

I know and I used a backgroundcolor and a background simultaneously
in my posted example but what I want is a interface in localframed without
the overlay solution, the background should also repeated horizontal and
vertical and not streched in both directions.

> \defineoverlay[one][\overlayfigure{name}]
> \defineoverlay[two][abcdef]
>
> \setupbackgrounds[page][background={one,two}]
>
> \setupbackgrounds[page][background={one,foreground,two}]
>
>
> etc
>
> > I have also a few wishes for \backgroundimage command in core-box,
> > is it possible let the graphics start in the left top corner and crop it
only
> > at the ride side and at the bottom like the default bahaviour in html.
>
> i think that there is some code in the x-fo file for that
>
> > Shouldn't the \scratchbox in the \nextboxwd test be a \nextbox.
>
> where?

I meant in the \backgroundimage definition defined in core-box, bottom of
the file).

\def\backgroundimage#1#2#3% repeat hsize vsize
  {\bgroup
   \dowithnextbox
     {\ifcase#1\relax
        % just one
      \else
        \scratchdimen#2\divide\scratchdimen\nextboxwd\count0\scratchdimen\advance\count0\plusone
        \scratchdimen#3\divide\scratchdimen\nextboxht\count2\scratchdimen\advance\count2\plusone
        % to be considered, probably methods
        \ifcase#1\or % x and y
          \setbox\nextbox\hbox{\dorecurse{\count0}{\copy\nextbox}}%
          \setbox\nextbox\vbox{\dorecurse{\count2}{\copy\nextbox\endgraf}}%
        \or % x
          \setbox\nextbox\hbox{\dorecurse{\count0}{\copy\nextbox}}%
        \or % y
          \setbox\nextbox\vbox{\dorecurse{\count2}{\copy\nextbox\endgraf}}%
        \fi
      \fi
      \ifdim\nextboxwd>#2\relax
        \setbox\nextbox\hbox to #2{\hss\flushnextbox\hss}%
        \setbox\scratchbox\hbox{\expanded{\clip[\c!width=#2,\c!height=\the\nextboxht]{\box\scratchbox}}}%

^^^^^^^^^^^
^^^^^^^^^^^^^^^
      \fi
      \ifdim\nextboxht>#3\relax
        \setbox\nextbox\vbox to #3{\vss\flushnextbox\vss}%
        \setbox\nextbox\hbox{\expanded{\clip[\c!width=\the\nextboxwd,\c!height=#3]{\flushnextbox}}}%
      \fi
      \flushnextbox
      \egroup}%
   \hbox}

I want to use this to provide the user in the second version of the go
module a command to use graphics as board backgrounds where he
can use at the moment only colors. I know I could wrap this myself
into a macro but I hoped I can this without own code and pass only the
figure name and the backgroundcolor to the setup command for page
backgrounds or the frame background.

Wolfgang

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

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

___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Feature request for backgrounds
  2007-10-11 14:35   ` Wolfgang Schuster
@ 2007-10-11 19:42     ` Hans Hagen
  2007-10-12  1:21       ` Aditya Mahajan
  2007-10-12  8:28       ` Wolfgang Schuster
  0 siblings, 2 replies; 8+ messages in thread
From: Hans Hagen @ 2007-10-11 19:42 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster wrote:

> I know and I used a backgroundcolor and a background simultaneously
> in my posted example but what I want is a interface in localframed without
> the overlay solution, the background should also repeated horizontal and
> vertical and not streched in both directions.

\defineoverlay[image][\backgroundimage1\overlaywidth\overlayheight{\externalfigure[\framedparameter{backgroundimage}]}]

\framed[width=15cm,height=25cm,backgroundimage=cow.pdf,background=image]{test}

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Feature request for backgrounds
  2007-10-11 19:42     ` Hans Hagen
@ 2007-10-12  1:21       ` Aditya Mahajan
  2007-10-12  7:43         ` Hans Hagen
  2007-10-12  8:28       ` Wolfgang Schuster
  1 sibling, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2007-10-12  1:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Thu, 11 Oct 2007, Hans Hagen wrote:

> Wolfgang Schuster wrote:
>
>> I know and I used a backgroundcolor and a background simultaneously
>> in my posted example but what I want is a interface in localframed without
>> the overlay solution, the background should also repeated horizontal and
>> vertical and not streched in both directions.
>
> \defineoverlay[image][\backgroundimage1\overlaywidth\overlayheight{\externalfigure[\framedparameter{backgroundimage}]}]
>
> \framed[width=15cm,height=25cm,backgroundimage=cow.pdf,background=image]{test}

Wow, I never thought of this before. This is a really nice way to 
generate and use key-value pairs on the fly.

Aditya
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Feature request for backgrounds
  2007-10-12  1:21       ` Aditya Mahajan
@ 2007-10-12  7:43         ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2007-10-12  7:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Aditya Mahajan wrote:
> On Thu, 11 Oct 2007, Hans Hagen wrote:
> 
>> Wolfgang Schuster wrote:
>>
>>> I know and I used a backgroundcolor and a background simultaneously
>>> in my posted example but what I want is a interface in localframed without
>>> the overlay solution, the background should also repeated horizontal and
>>> vertical and not streched in both directions.
>> \defineoverlay[image][\backgroundimage1\overlaywidth\overlayheight{\externalfigure[\framedparameter{backgroundimage}]}]
>>
>> \framed[width=15cm,height=25cm,backgroundimage=cow.pdf,background=image]{test}
> 
> Wow, I never thought of this before. This is a really nice way to 
> generate and use key-value pairs on the fly.

whenever i see a reason i provide a \xxxparameter now, but beware of 
potential clashes, i can imagine prefixes in some cases,

\framed[width=15cm,height=25cm,x:backgroundimage=cow.pdf,background=image]{test}

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Feature request for backgrounds
  2007-10-11 19:42     ` Hans Hagen
  2007-10-12  1:21       ` Aditya Mahajan
@ 2007-10-12  8:28       ` Wolfgang Schuster
  2007-10-12  9:05         ` Hans Hagen
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Schuster @ 2007-10-12  8:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

2007/10/11, Hans Hagen <pragma@wxs.nl>:
>
> Wolfgang Schuster wrote:
>
> > I know and I used a backgroundcolor and a background simultaneously
> > in my posted example but what I want is a interface in localframed
> without
> > the overlay solution, the background should also repeated horizontal and
> > vertical and not streched in both directions.
>
>
> \defineoverlay[image][\backgroundimage1\overlaywidth\overlayheight{\externalfigure[\framedparameter{backgroundimage}]}]
>
> \framed[width=15cm,height=25cm,backgroundimage=cow.pdf
> ,background=image]{test}


Hi Hans,

nearly perfect but can I also test if the requested figure did really exist
with
something like
\doiffigure{\framedparameter{backgroundimage}}{\backgroundimage{...}}.

I hope there will be a hidden feature section in the ConTeXtbook with all of
ConTeXt's
little features I don't know at the moment.

Wolfgang

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

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

___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Feature request for backgrounds
  2007-10-12  8:28       ` Wolfgang Schuster
@ 2007-10-12  9:05         ` Hans Hagen
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2007-10-12  9:05 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Wolfgang Schuster wrote:
> 2007/10/11, Hans Hagen <pragma@wxs.nl>:
>> Wolfgang Schuster wrote:
>>
>>> I know and I used a backgroundcolor and a background simultaneously
>>> in my posted example but what I want is a interface in localframed
>> without
>>> the overlay solution, the background should also repeated horizontal and
>>> vertical and not streched in both directions.
>>
>> \defineoverlay[image][\backgroundimage1\overlaywidth\overlayheight{\externalfigure[\framedparameter{backgroundimage}]}]
>>
>> \framed[width=15cm,height=25cm,backgroundimage=cow.pdf
>> ,background=image]{test}
> 
> 
> Hi Hans,
> 
> nearly perfect but can I also test if the requested figure did really exist
> with
> something like
> \doiffigure{\framedparameter{backgroundimage}}{\backgroundimage{...}}.
> 
> I hope there will be a hidden feature section in the ConTeXtbook with all of
> ConTeXt's
> little features I don't know at the moment.
\starttext

\def\doiffigureelse#1%
   {\getfiguredimensions[#1]%
    \ifcase\figurewidth
      \expandafter\secondoftwoarguments
    \else
      \expandafter\firstoftwoarguments
    \fi}

\doiffigureelse{cow.pdf}{yes}{no}
\doiffigureelse{xxx.pdf}{no}{yes}

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | 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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2007-10-12  9:05 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-11 10:16 Feature request for backgrounds Wolfgang Schuster
2007-10-11 11:44 ` Hans Hagen
2007-10-11 14:35   ` Wolfgang Schuster
2007-10-11 19:42     ` Hans Hagen
2007-10-12  1:21       ` Aditya Mahajan
2007-10-12  7:43         ` Hans Hagen
2007-10-12  8:28       ` Wolfgang Schuster
2007-10-12  9:05         ` Hans Hagen

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