porescene.layout module¶
- class porescene.layout.BackgroundAnnotation(pth, res=(4096, 4096), pad=(100, 100, 100, 100), bg=None)[source]¶
Bases:
AnnotationBase class for the different annotation types.
You can use this class to create a plain unicolored image without anything else. It is also possible to add an bitmap image like PNG to the center.
- Parameters:
Examples
This example creates the most simply overlay: just a simple colored image.
Create a simple colored image.¶1from collib import Color 2 3res = (1600, 900) 4fpath = Path("unicolor_image.svg") 5ovl = BackgroundAnnotation(res) 6ovl.background = Color("#382655") 7ovl.save(fpath)
- get_svg()[source]¶
Returns the SVG element without XML declaration.
Builds the
<svg>element with all its child elements. The drawn content is centered on the canvas (see_center()).- Return type:
- property color_background: Color | None¶
Image background color as
Colorobject or None for transparent background.
- class porescene.layout.DiscreteGradientAnnotation(pth, res=(4096, 4096), pad=(100, 100, 100, 100))[source]¶
Bases:
SegmentedGradientAnnotation
- class porescene.layout.Gradient(pth, res=(4096, 4096), pad=(100, 100, 100, 100))[source]¶
Bases:
TitleAnnotation,ABCCreate an annotation image with heading, subheading, text and a gradient with scaclebars.
- Parameters:
Examples
>>> ovl = Gradient('myproject') >>> ovl.heading = 'My beautiful work:' >>> ovl.subheading = 'You can see a ' >>>
- property align: CompassDirection¶
Location to place the text on the image.
There are 4 available options to choose: ‘NW’, ‘NE’, ‘SE’, ‘SW’ (like the direction of compass).
The default align is ‘NW’.
- property color_nan: Color | None¶
Colorof NaN values.If None, the label won’t beshown on the image.
- property gradient_height: float¶
Height of the gradient bar (always referred to horizontal orientation).
- property gradient_length: float¶
Length of the gradient bar (always referred to horizontal orientation).
- property orientation: Orientation¶
Orientation of the text flow and gradient bar on the image.
There are 2 available options to choose: ‘H’, ‘V’. The default orientation is ‘V’.
- property seperator_decimal: str¶
The decimal seperator of numbers of the scalebar can be either ‘COMMA’ or ‘DOT’.
- property seperator_exponent: MultiplicationSymbol¶
The multiplication sign of the scalebar exponent can be either ‘CROSS’ or ‘DOT’.
- class porescene.layout.LabelsAnnotation(pth, res=(4096, 4096), pad=(100, 100, 100, 100))[source]¶
Bases:
TitleAnnotation- property color_labeltext¶
- property font_size_labeltext¶
- class porescene.layout.SegmentedGradientAnnotation(pth, res=(4096, 4096), pad=(100, 100, 100, 100))[source]¶
Bases:
Gradient
- class porescene.layout.SmoothGradientAnnotation(pth, res=(4096, 4096), pad=(100, 100, 100, 100))[source]¶
Bases:
Gradient
- class porescene.layout.TitleAnnotation(pth, res=(4096, 4096), pad=(100, 100, 100, 100))[source]¶
Bases:
BackgroundAnnotationCreate an annotation image with heading, subheading an some lines of text.
- Parameters:
res (
tuple[int,int]) – Size of the image in pixels. The first entry specifies width, second height.
Examples
>>> from fefacolors import gray, red, light3 >>> ovl = TitleAnnotation() >>> ovl.heading = "My super topic!" >>> ovl.subheading = "Maybe its only interesting for me, not for you?" >>> ovl.text = [ "I do not know what to write here.", "It's only a few lines", "of text nobody cares."] >>> ovl.color_text = gray >>> ovl.color_heading = red >>> ovl.background = light3 >>> ovl.align = 'SE' >>> ovl.save('mytitle') *Look for the save file!*
- property align: CompassDirection¶
Location to place the text on the image.
There are 4 available options to choose: ‘NW’, ‘NE’, ‘SE’, ‘SW’ (like the direction of compass). The default align is ‘NW’.
- property heading: str | None¶
Headline of the image.
The text is displayed in bold typeface in a single line. It should not be too long.