Component port types


Topic:  GrossGrade for Expert >

Component port types

Previous page Parent topic Next page


Each component port has a strictly defined type. It is possible to create a connection between the ports of two components only if these ports are of the same type.

There are several types of ports:


Click toggle to expand/collapse hidden block"data" - the image data

Transfers the processed image data, which includes information about the color space in which the image is currently appeared (in the current processing node). Some components, such as ColorspaceConverter, can change the current color space of an image. In this case, the resulting space (on the output port "data") will be different from the input port (on the input port "data"). In addition, some components within themselves can work in their own color space, making a temporary translation from the current space to the internal, and then a reverse translation to the current one. This option is not recommended in the development of serious modules - it usually increases the processing time and makes it impossible to fine control over the translation parameters between color spaces.


Click toggle to expand/collapse hidden block"color" - single color

Transfers a color value (the coordinates of a point in the color space).


Click toggle to expand/collapse hidden block"coloring function" - color correction itself

In GrossGrade, a coloring function is a pattern whereby all the colors of one set (the original image) are converted to the colors of another set (the resulting image). On the other hand, we can say that the coloring function sets a certain curvature of the color space in which the image is presented. That is, some part of the colors of the original image changes its values (the coordinates of the color space) in the resulting image. What part of the colors changes, and how - is determined by the coloring function. You can think of the coloring function as a 3D LUT with a very large (infinite) dimension.


Also you can think of the coloring function as the color correction itself without reference to a specific image. That is, this color correction works with isolated colors, not with the image, and can be equally applicable to any other image. Transmitting coloring function of the connections between the components, you inform one component about how the other component does its color processing.


The coloring function cannot be inverted because, in general, the color mapping is not one-to-one operation. That is, we can not build some coloring function that performs the inverse conversion of all colors after applying a direct coloring function, since the same resulting color could be obtained from several different source colors (see details


However, a pseudo-inversion of the color correction function is possible in GrossGrade, which does not really correspond to the actual inversion. This process is essentially a reversal of the directions of the motion vectors (which are set by the color correction function) of each point in the color space. Such an action can be considered an inversion of the function only conditionally, since the real inversion is theoretically impossible. In addition, according to these principles in GrossGrade it is possible to generate various color correction functions that are intermediate between pseudo-inverted and direct functions, as well as certain operations on pairs of coloring functions - vector addition, subtraction, etc.


Click toggle to expand/collapse hidden block"weight" - weight value

Transfers a weight value - in fact, it is just a simple real value with an unlimited range. In this case, there is a conditional "working" range from 0 to 1, where 0 means no weight (0%), and 1 means full weight (100%). Values less than 0 or greater than 1 are interpreted depending on the application of the weight.


Click toggle to expand/collapse hidden block"weighting function" - assigning weights to colors

In GrossGrade, the weighting function determines the pattern by which each color in the original image is given its own weight - a value that can range from some minimum (0%) to some maximum (100%).


You can think of the weighting function as a kind of "mask" that determines which colors in an image have more weight and therefore can be more involved in further color correction, and which colors will have less or zero weight. It should be emphasized that the weighting function is not tied to a specific image, it works with isolated colors.


Click toggle to expand/collapse hidden block"boolean" - logical value

Transfers a Boolean expression that can take one of two values, true or false.


Suitable, for example, to determine the status of the check box option: the value "true" - the check box is selected, the value "false" - the check box is cleared.


Click toggle to expand/collapse hidden block"integer" - integer number

Transfers an integer (a number without a fractional part that can take positive, negative, or zero values).


Suitable, for example, to determine the current position of the slider :the extreme positions of the slider correspond to the minimum and maximum values, the remaining positions - some intermediate values that can be transmitted through the port "integer".


Click toggle to expand/collapse hidden block"enum" - enumeration

Transfers the value of the enumerated type. An enumeration is a data type that has a complete list of all possible values that a variable of this type can take. For example, you can imagine some enumeration "Figure", which can take the following three values: "triangle", "square", "circle". Then through the port "enum" the concrete value of enumeration "Figure", for example "square" can be transferred.


Suitable, for example, to determine the status of a group of mutually exclusive switches (radio buttons): the transmitted value corresponds to the name of the currently active switch.


Click toggle to expand/collapse hidden block"set" - set of elements

Transfers a set consisting of some elements. The list of all possible elements is defined (as well as for the enumeration). For example, you can imagine a set of "Shapes", the elements of which can be: "triangle", "square", "circle". Then through the port "set" can be transmitted a specific set of "Shapes", including the elements of "triangle and square".


Suitable, for example, to determine the status of a group of independent switches (check boxes): the value passed corresponds to the list of names of currently active switches.


Click toggle to expand/collapse hidden block"string" - text string

Transfers a variable-length text string.


Suitable, for example, for passing a value entered in a text field.


Click toggle to expand/collapse hidden block"event()" - event

Notifies about any event. Such an event can be, for example, a user pressing a button.


Along with the notification through the port "event()" the specific event information may be transmitted. In this case, the event has a parameter (or multiple parameters): "event(parameter1 [, parameter2 ...]) " The parameter can belong to one of the following data types:



coloring function


weighting function







Ports of type "event()" can be plugged even if the type of the event parameter of one is not the same as the type of the event parameter of the other. For example, the output port "event(color)" of component "A" can be associated with the input port "event(boolean)" of component "B". But in this case, when the event is notified, the parameter is ignored, and then the behavior of the component "B" is not clearly defined (each type of component has its own specific reaction), but usually the component uses some (its) default value.


The question may arise: why pass the parameter through one port, for example, event(integer), instead of using two ports at the same time - with the event type and with the integer type? The fact is that in the case of two ports, the integer value is passed continuously regardless of the event. And in the case of the event(integer) port, the parameter is passed only when the event occurs, and its value is stored in the receiving component as long as necessary until the next event occurs, even if the sending component has been deleted.


Click toggle to expand/collapse hidden block"instancing" - multiple instances of the component

Instancing is a specific organization of the processing process in GrossGrade. When instancing, the same component or group of components can be used multiple times. Each instance of a component (or group of components) can have its own individual settings specified by the user. The number of instances is also controlled by the user. Depending on your intended purpose, multiple instances can transmit data that will somehow be combined in subsequent nodes of the processing graph.


To organize instancing, you must specify one or more components that you want to multiply repeatedly, as well as a separate component that will manage the instancing process. Only few components - those for which this role is logically justified - can manage instancing. The most versatile component that controls instancing is the InstancingManager component (the only purpose of which is to manage instancing). This component (like any other component that manage instancing) has an output port of type "instancing". This port can be connected to the "instancing" input ports of one or more components that will participate in instancing (have multiple instances). Through the "InstancingManager" component, the user can control the number of instances and select the "current" instance - the one that is currently represented by visual components. Thus, there can be many instances, but a  visual component can represent only one instance at a time. To represent another instance, the "current" instance must be switched in the controlling component "InstancingManager", after which the user will see that all the component settings have changed. Each instance stores the entire set of component (or group of components) settings, and when you switch the "current" instance, the components load the corresponding previously saved settings.


Replicable ports


Some ports of the components are repeatable (replicable). This means that these ports can be duplicated as many times as needed. That is, from one such port you can create several copies of it, performing the same tasks.


For example, imagine a component "Color replacement" which has the following input ports: "Source color" and "Replacement color" of type "color". Let the "Source color" port be repeatable, then you can make multiple copies of that port and feed them several different colors. In this case, all submitted colors will be replaced with "Replacement color".


You can add a port instance by double-clicking on the port area. You can delete a port instance by double-clicking on the area of the port instance with the shift key pressed.


You can only specify the number of copies of a repeatable port at the build-time stage. To specify multiple entities at run time, use the instancing mechanisms (for example, the InstancingManager component).


See also


Standard ports