ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Backgrounds
@ 2003-03-24 14:37 Giuseppe Bilotta
  2003-03-24 16:45 ` Backgrounds Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Giuseppe Bilotta @ 2003-03-24 14:37 UTC (permalink / raw)


Hello,

I would like to discuss a few points about backgrounds
(\startbackground ... \stopbackground).

First of all, it would be nice to have "background classes", so
that I can have different backgrounds for different things without
having to reset it each time. (Think
\definebackground[this][options=values], \setupthis, \startthis
... \stopthis, as usual.)

The second point is about the splitting capabilities in
backgrounds. This is incredibly nice to have, but needs a little
finetuning, IMO: it should be possible to specify whether the
various options that concern the "border" of the background (i.e.
background corner, frame, frame corner, etc) should act at split
time or not; example: assume that I set my background to have a
frame (frame=on) If the background gets split across pages, I get
two "boxed" text: the first in the first page, the second in the
second page. Instead, to show that the block continues on the next
page, it should be possible to turn this off. I suggest options
like: splitframe, splitframecorner, splitbackgoundcorner analogous
to topframe/bottomframe and the like, which defines the behaviour
of frames and angles in the "split area".

Moreover (now I'm getting picky, but while we're at it ...) it
would be nice, even for generic framed text, to be able to specify
the behaviour of each single corner separately (say, top left and
top right rounded, bottom left and right rectangular).

-- 
Giuseppe "Oblomov" Bilotta

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

* Re: Backgrounds
  2003-03-24 14:37 Backgrounds Giuseppe Bilotta
@ 2003-03-24 16:45 ` Hans Hagen
  2003-03-24 18:52   ` Re[2]: Backgrounds Giuseppe Bilotta
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2003-03-24 16:45 UTC (permalink / raw)


At 03:37 PM 3/24/2003 +0100, you (GB) wrote:
>Hello,
>
>I would like to discuss a few points about backgrounds
>(\startbackground ... \stopbackground).

Got you! Did you read details.pdf? It's all in there, you can hook in your 
own graphics, it works with columnsets, in graphics, tables, nests quite 
well, is layered, classes, and more. (\startbackground will be there for 
old times sake).

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re[2]: Backgrounds
  2003-03-24 16:45 ` Backgrounds Hans Hagen
@ 2003-03-24 18:52   ` Giuseppe Bilotta
  0 siblings, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2003-03-24 18:52 UTC (permalink / raw)


Monday, March 24, 2003 Hans Hagen wrote:

HH> At 03:37 PM 3/24/2003 +0100, you (GB) wrote:
>>Hello,
>>
>>I would like to discuss a few points about backgrounds
>>(\startbackground ... \stopbackground).

HH> Got you! Did you read details.pdf? It's all in there, you can hook in your
HH> own graphics, it works with columnsets, in graphics, tables, nests quite
HH> well, is layered, classes, and more. (\startbackground will be there for
HH> old times sake).

Actually I did have a look at it (assuming you're talking about
textbackgrounds), but I found their behaviour to be rather
different from that of backgrounds even when location=paragraph.
For example, setting frame=on doesn't give me a frame, and it
doesn't seem to support rounded corners for neither the background
nor the frame. Also, setting a largish offset "covers" the text
that precedes the background, and this isn't nice at all. I think
that textbackgrounds and backgrounds serve different purpouses.

And what about the other requests? (Behaviour at splits, different
corner styles)

-- 
Giuseppe "Oblomov" Bilotta

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

* Re[2]: Backgrounds
  2003-04-18 14:33           ` Backgrounds Johannes Hüsing
@ 2003-04-18 14:36             ` Giuseppe Bilotta
  0 siblings, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2003-04-18 14:36 UTC (permalink / raw)


Friday, April 18, 2003 Johannes Hüsing wrote:

JH> Patrick Gundlach <pg@levana.de> [Thu, Apr 10, 2003 at 11:50:43AM CEST]:
JH> [...]
>> 
>> BTW: that looks very nice.

JH> I am only loosely following here, but after processing Giuseppe's
JH> file I get the following output 

JH> http://www.panix.com/~derwisch/hannes/tex/giuseppe.pdf

JH> and I don't think this is what Giuseppe intended.

JH> (This is pdfeTeX, Version 3.14159-1.00b-pretest-20020211-2.1)
JH> (ConTeXt  ver: 2003.1.28  fmt: 2003.1.28)

Well, that's not what I get, running ConTeXt 2003.3.17 on pdfeTeX
3.141592-1.10b-2.1

-- 
Giuseppe "Oblomov" Bilotta

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

* Re[2]: Backgrounds
  2003-04-09 16:57       ` Re[2]: Backgrounds Giuseppe Bilotta
  2003-04-10  9:50         ` Backgrounds Patrick Gundlach
@ 2003-04-10 20:00         ` Hans Hagen
  1 sibling, 0 replies; 8+ messages in thread
From: Hans Hagen @ 2003-04-10 20:00 UTC (permalink / raw)


At 18:57 09/04/2003 +0200, you wrote:
>Wednesday, April 9, 2003 Patrick Gundlach wrote:
>
>PG> Giuseppe Bilotta <gip.bilotta@iol.it> writes:
>
>PG> Hello Giuseppe,
>
> >> \startuseMPgraphic{mpos:par:columnset}
> >>    path p, q;
> >>    for i := 1 upto nofmultipars :
> >>      p := counterclockwise simplified multipars[i] leftenlarged 5pt
> >>    rightenlarged 5pt ;
>
>PG> why did you use "counterclockwise simplified..." ? What is this?
>
>I used that to make sure that p didn't have extra points
>(simplified) and went in a specific direction (counterclockwise);
>anyway, I rewrote my code:

which can be simplified to:

\startuseMPgraphic{mpos:par:columnset}
    path q ; picture r ; color framecolor, backgroundcolor ;
    cornerradius := 5pt ; offset := 7.5pt ;
    framecolor := red ; framethickness := 2pt ;
    backgroundcolor := lightgray ;
    for i := 1 upto nofmultipars :
      multipars[i] := multipars[i] enlarged offset ;
      if multilocs[i] = 1 : % top
        q := multipars[i] bottomenlarged (4cornerradius) ;
      elseif multilocs[i] = 2 :
        q := multipars[i] bottomenlarged (4cornerradius) ;
        q := q topenlarged (4cornerradius) ;
      else:
        q := multipars[i] topenlarged (4cornerradius) ;
      fi ;
      q := q smoothed (2cornerradius) ;
      r := image
        ( fill q withcolor backgroundcolor ;
          draw q withcolor framecolor
            withpen pencircle scaled framethickness ; ) ;
      clip r to boundingbox multipars[i] ;
      addto currentpicture also r ;
    endfor ;
\stopuseMPgraphic

watch the usage of "enlarged" and the "smoothed"

Hans


>===
>
>\starttext
>
>\setupcolors[state=start]
>
>\definetextbackground[gb][state=start]
>
>\startuseMPgraphic{mpos:par:columnset}
>    pair urc, ulc, llc, lrc ; % corners
>    path urcp, ulcp, llcp, lrcp ; % paths
>    path q ;
>    cornerradius := 5pt ;
>    offset := 7.5pt ;
>    color framecolor, backgroundcolor ;
>    pen framepen ;
>    framecolor := red ;
>    framepen := pensquare rotated 45 ;
>    framethickness := 2pt ;
>    backgroundcolor := lightgray ;
>    for i := 1 upto nofmultipars :
>      urc := urcorner multipars[i] + (offset, offset) ;
>      ulc := ulcorner multipars[i] + (-offset, offset) ;
>      llc := llcorner multipars[i] + (-offset, -offset) ;
>      lrc := lrcorner multipars[i] + (offset, -offset) ;
>      ulcp := quartercircle
>              rotated 90
>              scaled (2*cornerradius)
>              shifted (ulc + (cornerradius, -cornerradius)) ;
>      urcp := quartercircle
>              scaled (2*cornerradius)
>              shifted (urc + (-cornerradius, -cornerradius)) ;
>      llcp := quartercircle
>              rotated 180
>              scaled (2*cornerradius)
>              shifted (llc + (cornerradius, cornerradius)) ;
>      lrcp := quartercircle
>              rotated -90
>              scaled (2*cornerradius)
>              shifted (lrc + (-cornerradius, cornerradius)) ;
>      if multilocs[i] = 1 : % top
>        q := lrc -- urcp -- ulcp -- llc ;
>        fill q--cycle
>             withcolor backgroundcolor ;
>        draw q
>             withcolor framecolor
>             withpen framepen scaled framethickness ;
>      elseif multilocs[i] = 2 :
>        fill llc -- lrc -- urc -- ulc -- cycle
>             withcolor backgroundcolor ;
>        draw ulc -- llc
>             withcolor framecolor
>             withpen framepen scaled framethickness ;
>        draw lrc -- urc
>             withcolor framecolor
>             withpen framepen scaled framethickness ;
>      else:
>        q := ulc -- llcp -- lrcp -- urc ;
>        fill q--cycle
>             withcolor backgroundcolor ;
>        draw q
>             withcolor framecolor
>             withpen framepen scaled framethickness ;
>      fi
>    endfor ;
>\stopuseMPgraphic
>
>\starttextbackground[gb]
>\input tufte
>\stoptextbackground
>
>\blank[2*big]
>
>\starttextbackground[gb]
>\dorecurse{5}{\input tufte \par}
>\stoptextbackground
>\blank \input tufte
>
>\stoptext
>
>===
>
>Now the only thing we need is a way to know when the background is
>split and when it's not. Hans?
>
>--
>Giuseppe "Oblomov" Bilotta
>
>
>
>_______________________________________________
>ntg-context mailing list
>ntg-context@ntg.nl
>http://www.ntg.nl/mailman/listinfo/ntg-context
>
>================================================================
>Deze e-mail is door E-mail VirusScanner van Planet Internet gecontroleerd 
>op virussen.
>Op http://www.planet.nl/evs staat een verwijzing naar de actuele lijst 
>waar op wordt gecontroleerd.

-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

* Re[2]: Backgrounds
  2003-04-10  9:50         ` Backgrounds Patrick Gundlach
@ 2003-04-10 11:43           ` Giuseppe Bilotta
  2003-04-18 14:33           ` Backgrounds Johannes Hüsing
  1 sibling, 0 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2003-04-10 11:43 UTC (permalink / raw)


Thursday, April 10, 2003 Patrick Gundlach wrote:
>> PG> why did you use "counterclockwise simplified..." ? What is this?
>>
>> I used that to make sure that p didn't have extra points
>> (simplified) and went in a specific direction (counterclockwise);
>> anyway, I rewrote my code:

PG> Well, does it have to be simplified? Is there a chance that there are
PG> unwanted (extra) points?

Actually I have no idea! I just wanted to be on the safe side of
things :)

PG> BTW: that looks very nice.

Yes, I think so too ;) Thanks. Feel free to use it as needed. I
tried to make it as parametric as possible. As soon as Hans
provides the hook to determine if the background split or not I'll
try to package it into a module.

-- 
Giuseppe "Oblomov" Bilotta

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

* Re[2]: Backgrounds
  2003-04-09 14:52     ` Backgrounds Patrick Gundlach
@ 2003-04-09 16:57       ` Giuseppe Bilotta
  2003-04-10  9:50         ` Backgrounds Patrick Gundlach
  2003-04-10 20:00         ` Hans Hagen
  0 siblings, 2 replies; 8+ messages in thread
From: Giuseppe Bilotta @ 2003-04-09 16:57 UTC (permalink / raw)


Wednesday, April 9, 2003 Patrick Gundlach wrote:

PG> Giuseppe Bilotta <gip.bilotta@iol.it> writes:

PG> Hello Giuseppe,

>> \startuseMPgraphic{mpos:par:columnset}
>>    path p, q;
>>    for i := 1 upto nofmultipars :
>>      p := counterclockwise simplified multipars[i] leftenlarged 5pt
>>    rightenlarged 5pt ;

PG> why did you use "counterclockwise simplified..." ? What is this?

I used that to make sure that p didn't have extra points
(simplified) and went in a specific direction (counterclockwise);
anyway, I rewrote my code:

===

\starttext

\setupcolors[state=start]

\definetextbackground[gb][state=start]

\startuseMPgraphic{mpos:par:columnset}
   pair urc, ulc, llc, lrc ; % corners
   path urcp, ulcp, llcp, lrcp ; % paths
   path q ;
   cornerradius := 5pt ;
   offset := 7.5pt ;
   color framecolor, backgroundcolor ;
   pen framepen ;
   framecolor := red ;
   framepen := pensquare rotated 45 ;
   framethickness := 2pt ;
   backgroundcolor := lightgray ;
   for i := 1 upto nofmultipars :
     urc := urcorner multipars[i] + (offset, offset) ;
     ulc := ulcorner multipars[i] + (-offset, offset) ;
     llc := llcorner multipars[i] + (-offset, -offset) ;
     lrc := lrcorner multipars[i] + (offset, -offset) ;
     ulcp := quartercircle
             rotated 90
             scaled (2*cornerradius)
             shifted (ulc + (cornerradius, -cornerradius)) ;
     urcp := quartercircle
             scaled (2*cornerradius)
             shifted (urc + (-cornerradius, -cornerradius)) ;
     llcp := quartercircle
             rotated 180
             scaled (2*cornerradius)
             shifted (llc + (cornerradius, cornerradius)) ;
     lrcp := quartercircle
             rotated -90
             scaled (2*cornerradius)
             shifted (lrc + (-cornerradius, cornerradius)) ;
     if multilocs[i] = 1 : % top
       q := lrc -- urcp -- ulcp -- llc ;
       fill q--cycle
            withcolor backgroundcolor ;
       draw q
            withcolor framecolor
            withpen framepen scaled framethickness ;
     elseif multilocs[i] = 2 :
       fill llc -- lrc -- urc -- ulc -- cycle
            withcolor backgroundcolor ;
       draw ulc -- llc
            withcolor framecolor
            withpen framepen scaled framethickness ;
       draw lrc -- urc
            withcolor framecolor
            withpen framepen scaled framethickness ;
     else:
       q := ulc -- llcp -- lrcp -- urc ;
       fill q--cycle
            withcolor backgroundcolor ;
       draw q
            withcolor framecolor
            withpen framepen scaled framethickness ;
     fi
   endfor ;
\stopuseMPgraphic

\starttextbackground[gb]
\input tufte
\stoptextbackground

\blank[2*big]

\starttextbackground[gb]
\dorecurse{5}{\input tufte \par}
\stoptextbackground
\blank \input tufte

\stoptext

===

Now the only thing we need is a way to know when the background is
split and when it's not. Hans?

-- 
Giuseppe "Oblomov" Bilotta

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

* Re[2]: Backgrounds
@ 2003-03-25  8:46 Hans Hagen
  2003-03-25 12:25 ` Re[3]: Backgrounds Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: Hans Hagen @ 2003-03-25  8:46 UTC (permalink / raw)


At 07:52 PM 3/24/2003 +0100, you wrote:

>Actually I did have a look at it (assuming you're talking about
>textbackgrounds), but I found their behaviour to be rather
>different from that of backgrounds even when location=paragraph.
>For example, setting frame=on doesn't give me a frame, and it
>doesn't seem to support rounded corners for neither the background
>nor the frame. Also, setting a largish offset "covers" the text
>that precedes the background, and this isn't nice at all. I think
>that textbackgrounds and backgrounds serve different purpouses.
>
>And what about the other requests? (Behaviour at splits, different
>corner styles)

\starttext

\setupcolors[state=start]

\definetextbackground[gb][state=start]

\startuseMPgraphic{mpos:par:columnset}
   for i := 1 upto nofmultipars :
     fill multipars[i] enlarged 5pt cornered 5pt withcolor green ;
     draw multipars[i] enlarged 5pt cornered 5pt withcolor red ;
   endfor ;
\stopuseMPgraphic

\input tufte \blank
\starttextbackground[gb]
\dorecurse{10}{\input tufte \par}
\stoptextbackground
\blank \input tufte

\stoptext

they split, can have corners, lay behind the text, ...

only some spacing issues need to be solved (working on that on and off)

Hans
-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

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

end of thread, other threads:[~2003-04-18 14:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-24 14:37 Backgrounds Giuseppe Bilotta
2003-03-24 16:45 ` Backgrounds Hans Hagen
2003-03-24 18:52   ` Re[2]: Backgrounds Giuseppe Bilotta
2003-03-25  8:46 Hans Hagen
2003-03-25 12:25 ` Re[3]: Backgrounds Hans Hagen
2003-03-25 14:36   ` Re[4]: Backgrounds Giuseppe Bilotta
2003-04-09 14:52     ` Backgrounds Patrick Gundlach
2003-04-09 16:57       ` Re[2]: Backgrounds Giuseppe Bilotta
2003-04-10  9:50         ` Backgrounds Patrick Gundlach
2003-04-10 11:43           ` Re[2]: Backgrounds Giuseppe Bilotta
2003-04-18 14:33           ` Backgrounds Johannes Hüsing
2003-04-18 14:36             ` Re[2]: Backgrounds Giuseppe Bilotta
2003-04-10 20:00         ` 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).