# absoluteInteger
function absoluteInteger(value)Return an absolute integer without converting the hot scaler path to float.
| Parameter | Type | Default | Description |
|---|---|---|---|
value | dynamic | — | Value consumed by `absoluteInteger`. |
src/miniquake/render/texture_upscale.mlminiquake/native.ml as native → src/miniquake/native.mlfunction absoluteInteger(value)Return an absolute integer without converting the hot scaler path to float.
| Parameter | Type | Default | Description |
|---|---|---|---|
value | dynamic | — | Value consumed by `absoluteInteger`. |
function apply(pixels, width, height, mode)Apply one selected load-time upscaler and return [pixels, width, height].
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `apply`. |
width | dynamic | — | Requested width in pixels or data units. |
height | dynamic | — | Requested height in pixels or data units. |
mode | dynamic | — | The mode input consumed by `apply`. |
function blendCorner(destination, destinationOffset, source, center, first, second, centerWeight, neighborWeight)Blend a center pixel with two edge neighbors in premultiplied-alpha space. This prevents the hidden RGB value of Quake palette index 255 from forming colored fringes around sprite and alias-model cutouts.
| Parameter | Type | Default | Description |
|---|---|---|---|
destination | dynamic | — | Destination value or collection to update. |
destinationOffset | dynamic | — | Zero-based offset of the requested data. |
source | dynamic | — | Source value or collection to read. |
center | dynamic | — | The center input consumed by `blendCorner`. |
first | dynamic | — | The first input consumed by `blendCorner`. |
second | dynamic | — | The second input consumed by `blendCorner`. |
centerWeight | dynamic | — | The center weight input consumed by `blendCorner`. |
neighborWeight | dynamic | — | The neighbor weight input consumed by `blendCorner`. |
function clampMode(mode)Clamp a persisted or console-provided mode to the supported range.
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | dynamic | — | The mode input consumed by `clampMode`. |
function copyPixel(destination, destinationOffset, source, sourceOffset)Copy one complete pixel into an already allocated destination image.
| Parameter | Type | Default | Description |
|---|---|---|---|
destination | dynamic | — | Destination value or collection to update. |
destinationOffset | dynamic | — | Zero-based offset of the requested data. |
source | dynamic | — | Source value or collection to read. |
sourceOffset | dynamic | — | Zero-based offset of the requested data. |
function edgeAware2x(pixels, width, height, xbr)Apply HQ2x or xBR2x edge-directed smoothing without touching flat regions.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `edgeAware2x`. |
width | dynamic | — | Requested width in pixels or data units. |
height | dynamic | — | Requested height in pixels or data units. |
xbr | dynamic | — | The xbr input consumed by `edgeAware2x`. |
function hqCorner(output, destination, pixels, center, first, second)Blend one HQ2x corner when its two adjoining colors form a coherent edge.
| Parameter | Type | Default | Description |
|---|---|---|---|
output | dynamic | — | Destination buffer updated with the HQ-filtered corner. |
destination | dynamic | — | Destination value or collection to update. |
pixels | dynamic | — | The pixels input consumed by `hqCorner`. |
center | dynamic | — | The center input consumed by `hqCorner`. |
first | dynamic | — | The first input consumed by `hqCorner`. |
second | dynamic | — | The second input consumed by `hqCorner`. |
function modeName(mode)Return the stable English display name for one texture-upscale mode.
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | dynamic | — | The mode input consumed by `modeName`. |
function nearest(pixels, width, height, factor)Enlarge an RGBA image with exact nearest-neighbor replication.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `nearest`. |
width | dynamic | — | Requested width in pixels or data units. |
height | dynamic | — | Requested height in pixels or data units. |
factor | dynamic | — | The factor input consumed by `nearest`. |
function pixelDistance(pixels, first, second)Measure perceptual RGBA distance with extra weight on green and alpha.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `pixelDistance`. |
first | dynamic | — | The first input consumed by `pixelDistance`. |
second | dynamic | — | The second input consumed by `pixelDistance`. |
function pixelsEqual(pixels, first, second)Report exact equality for two RGBA pixels in the same byte buffer.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `pixelsEqual`. |
first | dynamic | — | The first input consumed by `pixelsEqual`. |
second | dynamic | — | The second input consumed by `pixelsEqual`. |
function pixelsSimilar(pixels, first, second, threshold)Report perceptual similarity at the supplied HQ/xBR edge threshold.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `pixelsSimilar`. |
first | dynamic | — | The first input consumed by `pixelsSimilar`. |
second | dynamic | — | The second input consumed by `pixelsSimilar`. |
threshold | dynamic | — | The threshold input consumed by `pixelsSimilar`. |
function scale2x(pixels, width, height)Apply the canonical Scale2x neighborhood rules to an RGBA image.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `scale2x`. |
width | dynamic | — | Requested width in pixels or data units. |
height | dynamic | — | Requested height in pixels or data units. |
function scale3x(pixels, width, height)Apply the canonical Scale3x 3x3 neighborhood rules to an RGBA image.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `scale3x`. |
width | dynamic | — | Requested width in pixels or data units. |
height | dynamic | — | Requested height in pixels or data units. |
function scaleFactor(mode)Return the integer enlargement factor associated with a mode.
| Parameter | Type | Default | Description |
|---|---|---|---|
mode | dynamic | — | The mode input consumed by `scaleFactor`. |
const UPSCALE_HQ2X = 4Defines the upscale hq2 x value used by `miniquake.render.texture_upscale`.
const UPSCALE_MODE_COUNT = 7Defines the upscale mode count value used by `miniquake.render.texture_upscale`.
const UPSCALE_NEAREST_2X = 1Defines the upscale nearest 2 x value used by `miniquake.render.texture_upscale`.
const UPSCALE_OFF = 0Defines the upscale off value used by `miniquake.render.texture_upscale`.
const UPSCALE_SCALE2X = 2Defines the upscale scale2 x value used by `miniquake.render.texture_upscale`.
const UPSCALE_SCALE3X = 3Defines the upscale scale3 x value used by `miniquake.render.texture_upscale`.
const UPSCALE_XBR2X = 5Defines the upscale xbr2 x value used by `miniquake.render.texture_upscale`.
const UPSCALE_XBR4X = 6Defines the upscale xbr4 x value used by `miniquake.render.texture_upscale`.
function validateSource(pixels, width, height)Validate dimensions and the complete RGBA source span before scaling.
| Parameter | Type | Default | Description |
|---|---|---|---|
pixels | dynamic | — | The pixels input consumed by `validateSource`. |
width | dynamic | — | Requested width in pixels or data units. |
height | dynamic | — | Requested height in pixels or data units. |
function xbrCorner(output, destination, pixels, center, first, second, diagonal, farFirst, farSecond)Blend one xBR corner after comparing the two competing diagonal gradients.
| Parameter | Type | Default | Description |
|---|---|---|---|
output | dynamic | — | Destination buffer updated with the xBR-filtered corner. |
destination | dynamic | — | Destination value or collection to update. |
pixels | dynamic | — | The pixels input consumed by `xbrCorner`. |
center | dynamic | — | The center input consumed by `xbrCorner`. |
first | dynamic | — | The first input consumed by `xbrCorner`. |
second | dynamic | — | The second input consumed by `xbrCorner`. |
diagonal | dynamic | — | The diagonal input consumed by `xbrCorner`. |
farFirst | dynamic | — | The far first input consumed by `xbrCorner`. |
farSecond | dynamic | — | The far second input consumed by `xbrCorner`. |