ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* metaobj and transparent colors with \MPcolor
@ 2004-07-23  7:53 Eckhart Guthöhrlein
  2004-07-23  9:45 ` Vit Zyka
  2004-07-23 21:31 ` Denis Roegel
  0 siblings, 2 replies; 12+ messages in thread
From: Eckhart Guthöhrlein @ 2004-07-23  7:53 UTC (permalink / raw)


Hi,

I try to achieve transparently filled objects using the metaobj package.
However, transparency is ignored completely in the output, I just get a
normal white. Here is my test file:

\setupcolors[state=start]
\setupbackgrounds[page][background=color,backgroundcolor=red]

\startMPenvironment[global]
  \definecolor[Durchsichtig][r=1.0,g=1.0,b=1.0,t=0.0,a=normal]
\stopMPenvironment

\startreusableMPgraphic{test}
	input metaobj;
	setObjectDefaultOption("Box")("fillcolor")(\MPcolor{Durchsichtig});
	newBox.test(btex Transparent? etex) "filled(true)";
	Obj(test).c=origin;
	drawObj(test);
\stopreusableMPgraphic

\starttext
	\reuseMPgraphic{test}
\stoptext


If I use the fillcolor as an argument to the object

	newBox.test(btex Transparent? etex) "filled(true)"
		"fillcolor(\MPcolor{Durchsichtig})";

I get error messages from the mpost run. So it seems that metaobj and
\MPcolor don't like each other.
Any ideas how to circumvent this problem?

Regards,
Eckhart

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23  7:53 metaobj and transparent colors with \MPcolor Eckhart Guthöhrlein
@ 2004-07-23  9:45 ` Vit Zyka
  2004-07-23 11:44   ` Eckhart Guthöhrlein
  2004-07-23 18:38   ` Hans Hagen Outside
  2004-07-23 21:31 ` Denis Roegel
  1 sibling, 2 replies; 12+ messages in thread
From: Vit Zyka @ 2004-07-23  9:45 UTC (permalink / raw)


Sorry, I can not reproduce your example. I get only red page with black 
page number in header. No white box. And I do not known metaobj macro.

But I have a question. It is really needed to surround \definecolor by 
\startMPenvironment? Since \definecolor has to result to \pdfobj and 
\pdfliteral (pdftex primitives) and propagation to mpost (which is EPS 
not PDF generator) has no sence. Only reference to color is needed and 
it is done via \MPcolor. Am I right?

Vit Zyka

> I try to achieve transparently filled objects using the metaobj package.
> However, transparency is ignored completely in the output, I just get a
> normal white. Here is my test file:
> 
> \setupcolors[state=start]
> \setupbackgrounds[page][background=color,backgroundcolor=red]
> 
> \startMPenvironment[global]
>   \definecolor[Durchsichtig][r=1.0,g=1.0,b=1.0,t=0.0,a=normal]
> \stopMPenvironment
> 
> \startreusableMPgraphic{test}
> 	input metaobj;
> 	setObjectDefaultOption("Box")("fillcolor")(\MPcolor{Durchsichtig});
> 	newBox.test(btex Transparent? etex) "filled(true)";
> 	Obj(test).c=origin;
> 	drawObj(test);
> \stopreusableMPgraphic
> 
> \starttext
> 	\reuseMPgraphic{test}
> \stoptext
> 
> 
> If I use the fillcolor as an argument to the object
> 
> 	newBox.test(btex Transparent? etex) "filled(true)"
> 		"fillcolor(\MPcolor{Durchsichtig})";
> 
> I get error messages from the mpost run. So it seems that metaobj and
> \MPcolor don't like each other.
> Any ideas how to circumvent this problem?
> 
> Regards,
> Eckhart

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23  9:45 ` Vit Zyka
@ 2004-07-23 11:44   ` Eckhart Guthöhrlein
  2004-07-24  9:28     ` Vit Zyka
  2004-07-23 18:38   ` Hans Hagen Outside
  1 sibling, 1 reply; 12+ messages in thread
From: Eckhart Guthöhrlein @ 2004-07-23 11:44 UTC (permalink / raw)


On Fri, Jul 23, 2004 at 11:45:32AM +0200, Vit Zyka wrote:
> Sorry, I can not reproduce your example. I get only red page with black 
> page number in header. No white box. And I do not known metaobj macro.

The graphics won't compile without metaobj, which is a very nice macro
package for metapost, available at
CTAN/graphics/metapost/contrib/macros/metaobj/

> But I have a question. It is really needed to surround \definecolor by 
> \startMPenvironment? Since \definecolor has to result to \pdfobj and 
> \pdfliteral (pdftex primitives) and propagation to mpost (which is EPS 
> not PDF generator) has no sence. Only reference to color is needed and 
> it is done via \MPcolor. Am I right?

During a texexec run, inline MP graphics are automatically generated and
converted in case of PDF output, provided that you have configured your
texexec to do so.
Definitions enclosed in \startMPenvironment ... \stopMPenvironment are
made available not only inside MP graphics, but also for the main
document by the [global] option. In this case, I use it to maintainn
color consistency between metapost and tex.
Without \startMPenvironment, the color definition would be available in
context only, not for inline graphics.

-- 
Eckhart

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23  9:45 ` Vit Zyka
  2004-07-23 11:44   ` Eckhart Guthöhrlein
@ 2004-07-23 18:38   ` Hans Hagen Outside
  2004-07-27 11:02     ` Eckhart Guthöhrlein
  1 sibling, 1 reply; 12+ messages in thread
From: Hans Hagen Outside @ 2004-07-23 18:38 UTC (permalink / raw)


Vit Zyka wrote:

> Sorry, I can not reproduce your example. I get only red page with 
> black page number in header. No white box. And I do not known metaobj 
> macro.
>
> But I have a question. It is really needed to surround \definecolor by 
> \startMPenvironment? Since \definecolor has to result to \pdfobj and 
> \pdfliteral (pdftex primitives) and propagation to mpost (which is EPS 
> not PDF generator) has no sence. Only reference to color is needed and 
> it is done via \MPcolor. Am I right?

only things that are needed in btex ... etex or textext(..) need to be 
put into \startMPenvironment, so in your case the color def can stay 
outside the env.

> Vit Zyka
>
>> I try to achieve transparently filled objects using the metaobj package.
>> However, transparency is ignored completely in the output, I just get a
>> normal white. Here is my test file:
>>
>> \setupcolors[state=start]
>> \setupbackgrounds[page][background=color,backgroundcolor=red]
>>
>> \startMPenvironment[global]
>>   \definecolor[Durchsichtig][r=1.0,g=1.0,b=1.0,t=0.0,a=normal]
>> \stopMPenvironment
>>
>> \startreusableMPgraphic{test}
>>     input metaobj;
>>     setObjectDefaultOption("Box")("fillcolor")(\MPcolor{Durchsichtig});
>>     newBox.test(btex Transparent? etex) "filled(true)";
>>     Obj(test).c=origin;
>>     drawObj(test);
>> \stopreusableMPgraphic
>>
>> \starttext
>>     \reuseMPgraphic{test}
>> \stoptext
>>
>>
>> If I use the fillcolor as an argument to the object
>>
>>     newBox.test(btex Transparent? etex) "filled(true)"
>>         "fillcolor(\MPcolor{Durchsichtig})";
>
can you try
                 fillcolor \MPcolor{...}

or maybe

color xxxx ; xxxx := \MPcolor{...} ; fillcolor(xxxx) ;

>>
>> I get error messages from the mpost run. So it seems that metaobj and
>> \MPcolor don't like each other.
>> Any ideas how to circumvent this problem?
>>
>> Regards,
>> Eckhart
>
>
> _______________________________________________
> 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
              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
-----------------------------------------------------------------

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23  7:53 metaobj and transparent colors with \MPcolor Eckhart Guthöhrlein
  2004-07-23  9:45 ` Vit Zyka
@ 2004-07-23 21:31 ` Denis Roegel
  2004-07-24  6:24   ` Hans Hagen Outside
  1 sibling, 1 reply; 12+ messages in thread
From: Denis Roegel @ 2004-07-23 21:31 UTC (permalink / raw)
  Cc: Denis Roegel

On Fri, Jul 23, 2004 at 09:53:22AM +0200, Eckhart Guthöhrlein wrote:
> Hi,
> 
> I try to achieve transparently filled objects using the metaobj package.
> However, transparency is ignored completely in the output, I just get a
> normal white. Here is my test file:
>

Hi,

I have never considered transparency in metaobj, and each part of an object
is merely drawn, in some order depending on that object, and with some (opaque) color.
It seems some serious surgery would be needed to seamlessly add transparency
handling. It can certainly be done, be it only by working on an object
structure, but I don't see a quick fix.

Denis Roegel

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23 21:31 ` Denis Roegel
@ 2004-07-24  6:24   ` Hans Hagen Outside
  0 siblings, 0 replies; 12+ messages in thread
From: Hans Hagen Outside @ 2004-07-24  6:24 UTC (permalink / raw)


Denis Roegel wrote:

>On Fri, Jul 23, 2004 at 09:53:22AM +0200, Eckhart Guthöhrlein wrote:
>  
>
>>Hi,
>>
>>I try to achieve transparently filled objects using the metaobj package.
>>However, transparency is ignored completely in the output, I just get a
>>normal white. Here is my test file:
>>
>>    
>>
>
>Hi,
>
>I have never considered transparency in metaobj, and each part of an object
>is merely drawn, in some order depending on that object, and with some (opaque) color.
>It seems some serious surgery would be needed to seamlessly add transparency
>handling. It can certainly be done, be it only by working on an object
>structure, but I don't see a quick fix.
>  
>
no, transparency is handled by the colors themselves so if metaobj can carry along a color it's should work ok 

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

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23 11:44   ` Eckhart Guthöhrlein
@ 2004-07-24  9:28     ` Vit Zyka
  2004-07-27 10:50       ` Eckhart Guthöhrlein
  0 siblings, 1 reply; 12+ messages in thread
From: Vit Zyka @ 2004-07-24  9:28 UTC (permalink / raw)


>>Sorry, I can not reproduce your example. I get only red page with black 
>>page number in header. No white box. And I do not known metaobj macro.
> 
> The graphics won't compile without metaobj, which is a very nice macro
> package for metapost, available at
> CTAN/graphics/metapost/contrib/macros/metaobj/

I, of course, checked if the package metaobj is installed and loaded. 
Perhaps my is too old (v0.83)?

I had a look to metaobj manual and it is good to know about it.
Thank you.

Vit Zyka

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-24  9:28     ` Vit Zyka
@ 2004-07-27 10:50       ` Eckhart Guthöhrlein
  0 siblings, 0 replies; 12+ messages in thread
From: Eckhart Guthöhrlein @ 2004-07-27 10:50 UTC (permalink / raw)


On Sat, Jul 24, 2004 at 11:28:36AM +0200, Vit Zyka wrote:
> I, of course, checked if the package metaobj is installed and loaded. 
> Perhaps my is too old (v0.83)?

That's the current version.

-- 
Eckhart

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-23 18:38   ` Hans Hagen Outside
@ 2004-07-27 11:02     ` Eckhart Guthöhrlein
  2004-07-27 11:28       ` Hans Hagen
       [not found]       ` <410A1E21.3030803@seznam.cz>
  0 siblings, 2 replies; 12+ messages in thread
From: Eckhart Guthöhrlein @ 2004-07-27 11:02 UTC (permalink / raw)


On Fri, Jul 23, 2004 at 11:38:28AM -0700, Hans Hagen Outside wrote:
> >>If I use the fillcolor as an argument to the object
> >>
> >>    newBox.test(btex Transparent? etex) "filled(true)"
> >>        "fillcolor(\MPcolor{Durchsichtig})";
> >
> can you try
>                 fillcolor \MPcolor{...}
> 
> or maybe
> 
> color xxxx ; xxxx := \MPcolor{...} ; fillcolor(xxxx) ;

Here is my current file, which just gives a white background in the box.

\setupcolors[state=start]
\setupbackgrounds[page][background=color,backgroundcolor=red]
\definecolor[Transparent][r=0,g=1,b=1,t=0,a=normal]
\startreusableMPgraphic{test}
	input metaobj;
	color t; t:=\MPcolor{Transparent};
	setObjectDefaultOption("Box")("fillcolor")(t);
	newBox.test(btex Transparent? etex) "filled(true)";
	Obj(test).c=origin;
	drawObj(test);
\stopreusableMPgraphic
\starttext
	\reuseMPgraphic{test}
\stoptext

Experimenting with default degrees of transparency, e.g. t=0.5, I have
noticed that the object is indeed filled using the Transparent color.
The problem seems to be that all objects in metaobj are filled using a
non-transparent white by default. Subsequent filling with a completely
transparent color then of course gives just white.
Well, I just want to see my normal page background through the object.
Can I achieve this?

-- 
Eckhart

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

* Re: metaobj and transparent colors with \MPcolor
  2004-07-27 11:02     ` Eckhart Guthöhrlein
@ 2004-07-27 11:28       ` Hans Hagen
       [not found]       ` <410A1E21.3030803@seznam.cz>
  1 sibling, 0 replies; 12+ messages in thread
From: Hans Hagen @ 2004-07-27 11:28 UTC (permalink / raw)


Eckhart Guthöhrlein wrote:

>The problem seems to be that all objects in metaobj are filled using a
>non-transparent white by default. Subsequent filling with a completely
>transparent color then of course gives just white.
>  
>
ah, maybe denis uses the metapost 'backgroundcolor' which is white; i'd say: never use that ! just don't fill! 

btw, i recently introduced nocolor, being (-1,-1,-1) 

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

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

* Re: metaobj and transparent colors with \MPcolor
       [not found]       ` <410A1E21.3030803@seznam.cz>
@ 2004-08-02  9:11         ` Eckhart Guthöhrlein
       [not found]           ` <410E237B.4030807@seznam.cz>
  0 siblings, 1 reply; 12+ messages in thread
From: Eckhart Guthöhrlein @ 2004-08-02  9:11 UTC (permalink / raw)


On Fri, Jul 30, 2004 at 12:08:33PM +0200, Vit Zyka wrote:
> >Here is my current file, which just gives a white background in the box.
> >
> >\setupcolors[state=start]
> >\setupbackgrounds[page][background=color,backgroundcolor=red]
> >\definecolor[Transparent][r=0,g=1,b=1,t=0,a=normal]
> >\startreusableMPgraphic{test}
> >	input metaobj;
> >	color t; t:=\MPcolor{Transparent};
> >	setObjectDefaultOption("Box")("fillcolor")(t);
> >	newBox.test(btex Transparent? etex) "filled(true)";
> >	Obj(test).c=origin;
> >	drawObj(test);
> >\stopreusableMPgraphic
> >\starttext
> >	\reuseMPgraphic{test}
> >\stoptext
> 
> Sorry I still do not see your white box. Perhaps something is corrupted 
> in my context installation.
> 
> I had a quick look into mpobj source and I tried to remove default white 
> background, but I was not successful.

Me either.

> Vit Zyka
> 
> P.S. I played with raw MP code:
> 
> input metaobj;
> beginfig(1)
>   fill fullcircle scaled 1cm withcolor red;
> 	color t; t:=(1,1,0);
> 	%setObjectDefaultOption("Box")("fillcolor")(t);
> 	newBox.test("");
> 	Obj(test).c=origin;
> 	drawObj(test);
> endfig;
> 
> end.

Your color is not transparent, so it will work as expected: no white
box.

-- 
Eckhart

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

* Re: metaobj and transparent colors with \MPcolor
       [not found]           ` <410E237B.4030807@seznam.cz>
@ 2004-08-02 11:44             ` Eckhart Guthöhrlein
  0 siblings, 0 replies; 12+ messages in thread
From: Eckhart Guthöhrlein @ 2004-08-02 11:44 UTC (permalink / raw)


On Mon, Aug 02, 2004 at 01:20:27PM +0200, Vit Zyka wrote:
> >>input metaobj;
> >>beginfig(1)
> >> fill fullcircle scaled 1cm withcolor red;
> >>	color t; t:=(1,1,0);
> >>	%setObjectDefaultOption("Box")("fillcolor")(t);
> >>	newBox.test("");
> >>	Obj(test).c=origin;
> >>	drawObj(test);
> >>endfig;
> >>
> >>end.
> >
> >Your color is not transparent, so it will work as expected: no white
> >box.
> 
> ???
> 
> The example demonstrated that it *IS* drawn white box in the background 
> of every metaobj object. Exactly as you mentioned.

Yes of course. Sorry.

> But I had a second look into mpobj.mp and probably find out the white 
> box tiger. Comment line 750:
>   unfill BpathObj(n);
> I am sure this hack will cause some unpleasant side-effects (e.g. with 
> shaded boxes) but in some limited situations...

Indeed, the hack works for me. Thank you very much for your time and
effort!

-- 
Eckhart

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

end of thread, other threads:[~2004-08-02 11:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-23  7:53 metaobj and transparent colors with \MPcolor Eckhart Guthöhrlein
2004-07-23  9:45 ` Vit Zyka
2004-07-23 11:44   ` Eckhart Guthöhrlein
2004-07-24  9:28     ` Vit Zyka
2004-07-27 10:50       ` Eckhart Guthöhrlein
2004-07-23 18:38   ` Hans Hagen Outside
2004-07-27 11:02     ` Eckhart Guthöhrlein
2004-07-27 11:28       ` Hans Hagen
     [not found]       ` <410A1E21.3030803@seznam.cz>
2004-08-02  9:11         ` Eckhart Guthöhrlein
     [not found]           ` <410E237B.4030807@seznam.cz>
2004-08-02 11:44             ` Eckhart Guthöhrlein
2004-07-23 21:31 ` Denis Roegel
2004-07-24  6:24   ` Hans Hagen Outside

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