Pattern Table


Related topics include:

For an overview and a list of lookup tables, see Lookup Tables.

Each entry of a pattern lookup table holds a pattern definition.

--------------------------------------------------------------------------------------
Table Value                                      Description            Fallback   PEX
Mask
--------------------------------------------------------------------------------------
PEXLUTVPatternDesc                                                                  5.0
                                                 color type             (imp-dep)
                                                 number of columns (m)  (imp-dep)
                                                 number of rows (n)     (imp-dep)
                                                 cell colors            (imp-dep)
PEXLUTVPatternAll (selects entire table entry)                                      5.0
--------------------------------------------------------------------------------------

The pattern is a grid of equally sized cells. Each cell has a single color. There are m x n cells. When applying interior style PEXInteriorStylePattern to a fill area primitive, the pattern reference point and vectors are projected along a normal vector onto the plane of each facet of the primitive. A parallelogram is formed with its origin defined by the projected reference point. One side of the parallelogram is defined by a vector which has a direction parallel to the first projected reference vector and which has a length equal to the absolute value of the x-component of the pattern size. The adjacent side of the parallelogram is defined similarly by the second projected reference vector and the absolute value of the y-component of the pattern size. The pattern is applied across the parallelogram such that the first cell has the parallelogram origin in one corner. The first m colors in the pattern correspond to the row of cells nearest to and along the first projected reference vector. The pattern is mapped onto the facet by replicating the pattern parallelogram in directions parallel to the parallelogram's sides until the entire facet is covered.

The implementation accesses the pattern table during rendering whenever the pipeline state's interior style or bf interior style is PEXInteriorStylePattern, and the PEXInteriorStylePattern interior style is supported by the implementation. Determine the list of supported interior styles by inquiring the InteriorStyle enumerated type values with request PEXGetEnumeratedTypeInfo. When interior style PEXInteriorStylePattern is supported and selected, the values of the pipeline state's interior style index and bf interior style index select the desired entries of the pattern table.

If the implementation does not support the PEXInteriorStylePattern interior style, then it is not required to support the pattern table for use with a renderer resource. If the pattern table is not supported, PEXCreateLookupTable, PEXGetTableInfo and PEXGetPredefinedEntries generate a LookupTable error.

Direct color components that are out of range are treated in an implementation-dependent way. If you specify an unsupported color type, then the implementation issues a BadPEXColorType error. If the color type is PEXColorTypeIndexed and the color index is 65535, then the implementation issues a BadValue error.

Valid pattern table indices are in the range [1, 65535]. The fallback entry is entry 1.