You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Gergely Hajdu <gh...@abprodata.com> on 2003/12/11 13:55:51 UTC

How to create a black rectangle

Could someone PLEASE help me how to write code,
to obtain black background ( maybe this can be set directly, or
maybe by inserting a black rectangle that covers the hole page)
for an image to be rendered ? And where should this code be
inserted ?

For the moment I have something like this :

<fo:block-container position="absolute" width="100%" height="100%"
fillColor="black"></fo:block-container>

I know this is not right, but maybe you get an idea of what I am trying to
do.

Thanks in advance
/Gergely



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: How to create a black rectangle

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Gergely Hajdu wrote:
[impreciese stuff]

At least you mentioned unambiguously that you are *generating*
a TIFF image, rather than including one.

Try setting a black background on all your regions:
  <fo:simple-page-master name="foo">
    <fo:region-body background-color="black" ... />
    <fo:region-before background-color="black" .../>
   ...

Don't forget to set the normal text color to white. I think
it should work to set it on the page sequence or even root:
   <fo:page-sequence color="white" ...>

J.Pietschmann


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: How to create a black rectangle

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Gergely Hajdu [mailto:ghajdu@abprodata.com]
>
> Which are the places where I could insert a background
> property ? And how should the code look like ?
>

You almost had it right in the fo you sent. Just put the block-container
inside the fo:flow (and add another in the fo:static-content if you want the
background there as well...)

(In any case, the Driver object is not where you would want to be looking
for this. If you want to set the background of the rendered TIFF, you're
going to have to ask Oleg --or delve through the source of the TIFFRenderer
yourself, as this is not part of the FOP distro yet )


Cheers,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: How to create a black rectangle

Posted by Gergely Hajdu <gh...@abprodata.com>.
Hi, I am running this XSL-FO through :
org.apache.fop.apps.Driver

to generate the TIFF.In this package I can?t
find how to set the background ( if it is possible ?)
of the created image. So therefore I would like to
do it at this level. Even if it is possible to set
background in org.apache.fop.apps.Driver, I would
like to do it at this level as well, to see if the
size of the created TIFF will be the same.

Which are the places where I could insert a background
property ? And how should the code look like ?

The "Image" we are talking about here, is just black
printing on white background when rendered. And I would
like to have it the other way around.

BIG thanks for helping me !
/Gergely


-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
Sent: Thursday, December 11, 2003 4:16 PM
To: fop-user@xml.apache.org
Subject: Re: How to create a black rectangle


Gergely Hajdu wrote:
> 	<fo:page-sequence master-reference="first" language="en"
hyphenate="true">
>   	<fo:block-container position="absolute" width="1024pt" height="1024pt"
> background-color="black"></fo:block-container>
>
A block container must be a descendant of a fo:flow or fo:static-content
according to the spec (a child for getting absolute positioning
correctly in FOP).
...

> So I would like to have black background to this template when creating
the
> TIFF.

There is no reference to any external or other graphic in what you
call your template. I still have no idea what you want to achieve.
I have absolutely no idea what the phrase "black background to
this template" indicates. You posted a complete, though slightly
errorneous FO document. There are quite a few places there where
a background property would apply, in particular all the block FOs.

An image doesn't usually need a background, because the image area
is, well, already filled with the image. Are you sure you want to do
something at the FO level? I suspect you should grab an image
manipulating program.

J.Pietschmann




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: How to create a black rectangle

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Gergely Hajdu wrote:
> 	<fo:page-sequence master-reference="first" language="en" hyphenate="true">
>   	<fo:block-container position="absolute" width="1024pt" height="1024pt"
> background-color="black"></fo:block-container>
> 
A block container must be a descendant of a fo:flow or fo:static-content
according to the spec (a child for getting absolute positioning
correctly in FOP).
...

> So I would like to have black background to this template when creating the
> TIFF.

There is no reference to any external or other graphic in what you
call your template. I still have no idea what you want to achieve.
I have absolutely no idea what the phrase "black background to
this template" indicates. You posted a complete, though slightly
errorneous FO document. There are quite a few places there where
a background property would apply, in particular all the block FOs.

An image doesn't usually need a background, because the image area
is, well, already filled with the image. Are you sure you want to do
something at the FO level? I suspect you should grab an image
manipulating program.

J.Pietschmann




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: How to create a black rectangle

Posted by Gergely Hajdu <gh...@abprodata.com>.
Hi, what I am trying to do, is to get a black background
for the TIFF-image I am creating (by the template used
below). And I thought there are 2 ways to achieve this :

1.Set the background to black directly ( by using some
fo:region/fo:container tag)
2.If 1 doesn't work, insert a black-rectangle covering the hole image, so I
achieve
the same result as I would have done if 1 work.

But I just can't find which code to include and to include it at
the right place.This is what i need help with :=)

For the moment my XSL-FO looks like this :

<?xml version="1.0" encoding="ISO-8859-1" ?>

<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:fox="http://xml.apache.org/fop/extensions">

	<fo:layout-master-set>

		<fo:simple-page-master margin-right="1.0cm" margin-left="1.0cm"
margin-bottom="1.0cm" margin-top="1.0cm" page-width="20cm"
page-height="29.7cm" master-name="first">

			<fo:region-before extent="1.0cm"/>

			<fo:region-body margin-bottom="1.0cm" margin-top="1.0cm"/>

			<fo:region-after extent="1.0cm"/>

		</fo:simple-page-master>

	</fo:layout-master-set>

	<fo:page-sequence master-reference="first" language="en" hyphenate="true">

  	<fo:block-container position="absolute" width="1024pt" height="1024pt"
background-color="black"></fo:block-container>

<fo:static-content flow-name="xsl-region-before">

<fo:block line-height="12pt" font-size="10pt" space-before.optimum="1.5pt"
space-after.optimum="1.5pt"
keep-together="always">Template</fo:block></fo:static-content>

<fo:static-content flow-name="xsl-region-after">

<fo:block line-height="12pt" font-size="10pt" space-before.optimum="1.5pt"
space-after.optimum="1.5pt" keep-together="always">

	Testing Header

</fo:block></fo:static-content>

<fo:flow flow-name="xsl-region-body">

<fo:table table-layout="fixed" text-align="start">
<fo:table-column column-width="8.15cm"/>
<fo:table-column column-width="8.15cm"/>
<fo:table-body>

<fo:table-row>
	<fo:table-cell><fo:block line-height="12pt" font-size="10pt"
space-before.optimum="1.5pt" space-after.optimum="1.5pt"
keep-together="always" text-align="end">Test Cell
1</fo:block></fo:table-cell>
	<fo:table-cell><fo:block line-height="12pt" font-size="10pt"
space-before.optimum="1.5pt" space-after.optimum="1.5pt"
keep-together="always" text-align="start">Test Cell
2</fo:block></fo:table-cell>
</fo:table-row>

</fo:table-body></fo:table>

 <fo:block space-before.optimum="1.5pt" space-after.optimum="1.5pt"
keep-together="always" id="LastPage" line-height="1pt"
font-size="1pt"></fo:block></fo:flow>
</fo:page-sequence></fo:root>

So I would like to have black background to this template when creating the
TIFF.

Regards
/Gergely


-----Original Message-----
From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
Sent: Thursday, December 11, 2003 2:15 PM
To: fop-user@xml.apache.org
Subject: Re: How to create a black rectangle


Gergely Hajdu wrote:

> Could someone PLEASE help me how to write code,
> to obtain black background ( maybe this can be set directly, or
> maybe by inserting a black rectangle that covers the hole page)
> for an image to be rendered ? And where should this code be
> inserted ?
>
> For the moment I have something like this :
>
> <fo:block-container position="absolute" width="100%" height="100%"
> fillColor="black"></fo:block-container>
>
> I know this is not right, but maybe you get an idea of what I am trying to
> do.

Adding another clue or two on what you are trying to achieve wouldn't
have hurt.
You can set background color for regions, or use a background image.
check here:
http://www.w3.org/TR/xsl/slice6.html#fo_region-body
http://www.w3.org/TR/xsl/slice7.html#common-border-padding-and-background-pr
operties

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: How to create a black rectangle

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Gergely Hajdu wrote:

> Could someone PLEASE help me how to write code,
> to obtain black background ( maybe this can be set directly, or
> maybe by inserting a black rectangle that covers the hole page)
> for an image to be rendered ? And where should this code be
> inserted ?
> 
> For the moment I have something like this :
> 
> <fo:block-container position="absolute" width="100%" height="100%"
> fillColor="black"></fo:block-container>
> 
> I know this is not right, but maybe you get an idea of what I am trying to
> do.

Adding another clue or two on what you are trying to achieve wouldn't
have hurt.
You can set background color for regions, or use a background image.
check here:
http://www.w3.org/TR/xsl/slice6.html#fo_region-body
http://www.w3.org/TR/xsl/slice7.html#common-border-padding-and-background-properties

J.Pietschmann



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org