Back to FabImage Library website
You are here: Start » Function Reference » All Functions » Image Drawing » DrawStrings_TwoColors
This is Filter Equivalent. This function may be present in generated code, but should not be used in hand-written code.
Header: | FIL.h |
---|---|
Namespace: | fis |
Module: | FoundationLite |
Draws strings (text) on an image with two colors, depending on the status of each string.
Applications: Usually: green or red for pass/fail status.
Syntax
void fis::DrawStrings_TwoColors ( const fil::Image& inImage, ftl::Conditional< const ftl::Array<ftl::Conditional<ftl::String>>&> inStrings, ftl::Conditional< const ftl::Array<ftl::Conditional<fil::Location>>&> inLocations, ftl::Optional<const fil::CoordinateSystem2D&> inLocationAlignment, const fil::Anchor2D::Type inLocationAnchor, const fil::Pixel& inColorIfTrue, const fil::Pixel& inColorIfFalse, ftl::Conditional<const ftl::Array<ftl::Conditional<bool>> &> inConditions, const fil::DrawingStyle& inDrawingStyle, float inSize, float inOrientationAngle, const bool inForceRgb, ftl::Optional<const fil::Pixel&> inBackgroundColor, fil::Image& outImage )
Parameters
Name | Type | Range | Default | Description | |
---|---|---|---|---|---|
![]() |
inImage | const Image& | Input image | ||
![]() |
inStrings | Conditional< const Array<Conditional<String>>&> | { } | ||
![]() |
inLocations | Conditional< const Array<Conditional<Location>>&> | { } | ||
![]() |
inLocationAlignment | Optional<const CoordinateSystem2D&> | NIL | ||
![]() |
inLocationAnchor | const Anchor2D::Type | MiddleCenter | ||
![]() |
inColorIfTrue | const Pixel& | Pixel ( X: 0.0f Y: 200.0f Z: 0.0f W: 0.0f ) | Color corresponding to True value on inCondition input | |
![]() |
inColorIfFalse | const Pixel& | Pixel ( X: 200.0f Y: 0.0f Z: 0.0f W: 0.0f ) | Color corresponding to False value on inCondition input | |
![]() |
inConditions | Conditional<const Array<Conditional<bool>> &> | { } | ||
![]() |
inDrawingStyle | const DrawingStyle& | DrawingStyle ( DrawingMode: HighQuality Opacity: 1.0f Thickness: 1.0f Filled: False PointShape: Nil PointSize: 1.0f ) | ||
![]() |
inSize | float | 10.0 - ![]() |
16.0f | Height of a character in pixels |
![]() |
inOrientationAngle | float | 0.0f | Orientation of text in degrees | |
![]() |
inForceRgb | const bool | True | Filter will convert monochromatic image to RGB if needed | |
![]() |
inBackgroundColor | Optional<const Pixel&> | NIL | Color of pixels drawn on image in text row | |
![]() |
outImage | Image& | Output image |
In-place Processing
This function supports in-place data processing - you can pass the same reference to inImage and outImage
Read more about In-place Computation.
Description
The operation draws a strings on the inImage aligning the inLocationAnchor location of the text at the inLocations of the inImage.
The height of the font is fixed and equals 16 pixels.
Hints
- If you want to draw on an empty background, use EmptyImage function before.
- Define inStrings. This will be the primitives to be drawn.
- For each of the strings also define its location by setting the inLocations input.
- If the locations provided on the inLocations input are in a local coordinate system, also set the inLocationAlignment input.
- Set inLocationAnchor do define how each of the strings should be aligned in relation to its location.
- Define the font size by setting the inSize input. Recommended values are: 16, 32, 48, 64.
- Define inConditions with the boolean values indicating the class (usually: OK/NOK) for each input primitive.
- Set the inColorIfTrue and inColorIfFalse inputs to define the two colors used for drawing.
- Set inForceRgb to True, if you want to get a 3-channel output regardless of what is on the input.
- Set inDrawingStyle to control quality, opacity, thickness, filling, point shapes and sizes.
Examples

Example usage of the DrawStrings_TwoColors on an empty image.
Errors
List of possible exceptions:
Error type | Description |
---|---|
DomainError | The sizes inStrings and inConditions do not match in DrawStrings_TwoColors. |
See Also
- DrawLine – Draws a line on an image.
- DrawPath – Draws a path on an image.
- DrawCircle – Draws a circle on an image.
- DrawRectangle – Draws a rectangle on an image.