Class ComponentTransfer

java.lang.Object
org.javagi.base.ProxyInstance
org.gnome.gsk.ComponentTransfer
All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class ComponentTransfer extends ProxyInstance

Specifies a transfer function for a color component to be applied while rendering.

The available functions include linear, piecewise-linear, gamma and step functions.

Note that the transfer function is applied to un-premultiplied values, and all results are clamped to the [0, 1] range.

Since:
4.20
  • Constructor Details

    • ComponentTransfer

      public ComponentTransfer(MemorySegment address)
      Create a ComponentTransfer proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the ComponentTransfer class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • discrete

      public static ComponentTransfer discrete(@Nullable float @Nullable [] values)

      Creates a new component transfer that applies a step function.

      The new value is computed as

      C' = values[k]
      

      where k is the smallest value such that

      k / n <= C < (k + 1) / n
      
      Component transfer: discrete
      Parameters:
      values - Values
      Returns:
      a new GskComponentTransfer
      Since:
      4.20
    • gamma

      public static ComponentTransfer gamma(float amp, float exp, float ofs)

      Creates a new component transfer that applies a gamma transform.

      The new value is computed as

      C' = amp * pow (C, exp) + ofs
      
      Component transfer: gamma
      Parameters:
      amp - Amplitude
      exp - Exponent
      ofs - Offset
      Returns:
      a new GskComponentTransfer
      Since:
      4.20
    • identity

      public static ComponentTransfer identity()

      Creates a new component transfer that doesn't change the component value.

      Component transfer: identity
      Returns:
      a new GskComponentTransfer
      Since:
      4.20
    • levels

      public static ComponentTransfer levels(float n)

      Creates a new component transfer that limits the values of the component to n levels.

      The new value is computed as

      C' = (floor (C * n) + 0.5) / n
      
      Component transfer: levels
      Parameters:
      n - Number of levels
      Returns:
      a new GskComponentTransfer
      Since:
      4.20
    • linear

      public static ComponentTransfer linear(float m, float b)

      Creates a new component transfer that applies a linear transform.

      The new value is computed as

      C' = C * m + b
      
      Component transfer: linear
      Parameters:
      m - Slope
      b - Offset
      Returns:
      a new GskComponentTransfer
      Since:
      4.20
    • table

      public static ComponentTransfer table(@Nullable float @Nullable [] values)

      Creates a new component transfer that applies a piecewise linear function.

      The new value is computed as

      C' = values[k] + (C - k / (n - 1)) * n * (values[k + 1] - values[k])
      

      where k is the smallest value such that

      k / (n - 1) <= C < (k + 1) / (n - 1)
      
      Component transfer: table
      Parameters:
      values - Values
      Returns:
      a new GskComponentTransfer
      Since:
      4.20
    • equal

      public static boolean equal(MemorySegment self, MemorySegment other)
      Compares two component transfers for equality.
      Parameters:
      self - a component transfer
      other - another component transfer
      Returns:
      true if self and other are equal
      Since:
      4.20
    • copy

      public ComponentTransfer copy()
      Creates a copy of other.
      Returns:
      a newly allocated copy of this ComponentTransfer
      Since:
      4.20
    • free

      public void free()
      Frees a component transfer.
      Since:
      4.20