Class ImageProcessing
Basic image processing.
Namespace: DaggerfallWorkshop.Utility
Assembly: Assembly-CSharp.dll
Syntax
public static class ImageProcessing
Methods
| Improve this Doc View SourceChangeDye(DFBitmap, DyeColors, DyeTargets)
Dye supported bitmap image based on dye index and type.
Declaration
public static DFBitmap ChangeDye(DFBitmap srcBitmap, DyeColors dye, DyeTargets target)
Parameters
Type | Name | Description |
---|---|---|
DFBitmap | srcBitmap | Source image. |
DyeColors | dye | Dye index. |
DyeTargets | target | Dye target. |
Returns
Type | Description |
---|---|
DFBitmap | New DFBitmap dyed to specified colour. |
ChangeMask(DFBitmap, Byte)
Changes mask index to another index.
Declaration
public static DFBitmap ChangeMask(DFBitmap srcBitmap, byte replaceWith = 0)
Parameters
Type | Name | Description |
---|---|---|
DFBitmap | srcBitmap | Source image. |
Byte | replaceWith | Index to substitute for mask index. |
Returns
Type | Description |
---|---|
DFBitmap | New DFBitmap with modified mask. |
Clamp(Int32, Int32, Int32)
Declaration
public static int Clamp(int value, int min, int max)
Parameters
Type | Name | Description |
---|---|---|
Int32 | value | |
Int32 | min | |
Int32 | max |
Returns
Type | Description |
---|---|
Int32 |
ClampBorder(ref Color32[], DFSize, Int32, Boolean, Boolean, Boolean, Boolean, Boolean, Boolean)
Clamps texture into empty border area.
Declaration
public static void ClampBorder(ref Color32[] colors, DFSize size, int border, bool leftRight = true, bool topBottom = true, bool topLeft = true, bool topRight = true, bool bottomLeft = true, bool bottomRight = true)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source image. |
DFSize | size | Image size. |
Int32 | border | Border width. |
Boolean | leftRight | |
Boolean | topBottom | |
Boolean | topLeft | |
Boolean | topRight | |
Boolean | bottomLeft | |
Boolean | bottomRight |
ConvertBumpToNormals(ref Color32[], Int32, Int32, Single)
Converts bump map to normal map.
Declaration
public static Color32[] ConvertBumpToNormals(ref Color32[] colors, int width, int height, float strength = 1F)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source Color32 array. |
Int32 | width | |
Int32 | height | |
Single | strength | Normal strength. |
Returns
Type | Description |
---|---|
Color32[] | Color32[] normal map. |
CopyColors(ref Color32[], ref Color32[], DFSize, DFSize, DFPosition, DFPosition, DFSize)
Declaration
public static void CopyColors(ref Color32[] src, ref Color32[] dst, DFSize srcSize, DFSize dstSize, DFPosition srcPos, DFPosition dstPos, DFSize copySize)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Color32[] | dst | |
DFSize | srcSize | |
DFSize | dstSize | |
DFPosition | srcPos | |
DFPosition | dstPos | |
DFSize | copySize |
CreateFontAtlas(FntFile, Color, Color, out Texture2D, out Rect[])
Declaration
public static void CreateFontAtlas(FntFile fntFile, Color backColor, Color textColor, out Texture2D atlasTextureOut, out Rect[] atlasRectsOut)
Parameters
Type | Name | Description |
---|---|---|
FntFile | fntFile | |
Color | backColor | |
Color | textColor | |
Texture2D | atlasTextureOut | |
Rect[] | atlasRectsOut |
DilateColors(ref Color32[], DFSize)
Creates a blended border around transparent textures. Removes dark edges from billboards.
Declaration
public static void DilateColors(ref Color32[] colors, DFSize size)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source image. |
DFSize | size | Image size. |
FlipColors(ref Color32[], Int32, Int32)
Declaration
public static Color32[] FlipColors(ref Color32[] src, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Int32 | width | |
Int32 | height |
Returns
Type | Description |
---|---|
Color32[] |
FlipHorizontallyColors(ref Color32[], Int32, Int32)
Declaration
public static Color32[] FlipHorizontallyColors(ref Color32[] src, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Int32 | width | |
Int32 | height |
Returns
Type | Description |
---|---|
Color32[] |
FlipVerticallyColors(ref Color32[], Int32, Int32)
Declaration
public static Color32[] FlipVerticallyColors(ref Color32[] src, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Int32 | width | |
Int32 | height |
Returns
Type | Description |
---|---|
Color32[] |
GetBumpMap(ref Color32[], Int32, Int32)
Gets a bump map from source Color32 array.
Declaration
public static Color32[] GetBumpMap(ref Color32[] colors, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source Color32 array. |
Int32 | width | Image width. |
Int32 | height | Image height. |
Returns
Type | Description |
---|---|
Color32[] | DFBitmap bump image. |
GetDyeColorTable(DyeColors, DyeTargets)
Gets colour table for all supported dyes.
Declaration
public static byte[] GetDyeColorTable(DyeColors dye, DyeTargets target)
Parameters
Type | Name | Description |
---|---|---|
DyeColors | dye | |
DyeTargets | target |
Returns
Type | Description |
---|---|
Byte[] |
GetGlyphColors(FntFile, Int32, Color, Color, out Rect)
Declaration
public static Color32[] GetGlyphColors(FntFile fntFile, int index, Color backColor, Color textColor, out Rect sizeOut)
Parameters
Type | Name | Description |
---|---|---|
FntFile | fntFile | |
Int32 | index | |
Color | backColor | |
Color | textColor | |
Rect | sizeOut |
Returns
Type | Description |
---|---|
Color32[] |
GetMetalColorTable(MetalTypes)
Gets colour table for each metal type.
Declaration
public static byte[] GetMetalColorTable(MetalTypes metalType)
Parameters
Type | Name | Description |
---|---|---|
MetalTypes | metalType |
Returns
Type | Description |
---|---|
Byte[] |
GetMetalDyeColor(MetalTypes)
Converts a DaggerfallUnity metal type to dye colour.
Declaration
public static DyeColors GetMetalDyeColor(MetalTypes metalType)
Parameters
Type | Name | Description |
---|---|---|
MetalTypes | metalType |
Returns
Type | Description |
---|---|
DyeColors |
GetProportionalGlyphColors(FntFile, Int32, Color, Color, Boolean)
Declaration
public static Color32[] GetProportionalGlyphColors(FntFile fntFile, int index, Color backColor, Color textColor, bool invertY = false)
Parameters
Type | Name | Description |
---|---|---|
FntFile | fntFile | |
Int32 | index | |
Color | backColor | |
Color | textColor | |
Boolean | invertY |
Returns
Type | Description |
---|---|
Color32[] |
InsertColors(ref Color32[], ref Color32[], Int32, Int32, Int32, Int32, Int32, Int32)
Declaration
public static void InsertColors(ref Color32[] src, ref Color32[] dst, int xPos, int yPos, int srcWidth, int srcHeight, int dstWidth, int dstHeight)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Color32[] | dst | |
Int32 | xPos | |
Int32 | yPos | |
Int32 | srcWidth | |
Int32 | srcHeight | |
Int32 | dstWidth | |
Int32 | dstHeight |
MakeAverageIntensity(Color32[])
Creates average intensity Color32 array.
Declaration
public static Color32[] MakeAverageIntensity(Color32[] colors)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source Color32 array. |
Returns
Type | Description |
---|---|
Color32[] | Average intensity Color32 array. |
MakeTexture2D(ref Color32[], Int32, Int32, TextureFormat, Boolean)
Declaration
public static Texture2D MakeTexture2D(ref Color32[] src, int width, int height, TextureFormat textureFormat, bool mipMaps)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Int32 | width | |
Int32 | height | |
TextureFormat | textureFormat | |
Boolean | mipMaps |
Returns
Type | Description |
---|---|
Texture2D |
Negative(ref Color32[])
Creates a negative of image.
Declaration
public static void Negative(ref Color32[] colors)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source Color32 array. |
RotateColors(ref Color32[], Int32, Int32)
Declaration
public static Color32[] RotateColors(ref Color32[] src, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | src | |
Int32 | width | |
Int32 | height |
Returns
Type | Description |
---|---|
Color32[] |
Sharpen(ref Color32[], Int32, Int32)
Sharpen a DFBitmap.
Declaration
public static Color32[] Sharpen(ref Color32[] colors, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source Color32 array. |
Int32 | width | Image width. |
Int32 | height | Image height. |
Returns
Type | Description |
---|---|
Color32[] | Sharpened image. |
WrapBorder(ref Color32[], DFSize, Int32, Boolean, Boolean)
Wraps texture into emtpty border area on opposite side.
Declaration
public static void WrapBorder(ref Color32[] colors, DFSize size, int border, bool leftRight = true, bool topBottom = true)
Parameters
Type | Name | Description |
---|---|---|
Color32[] | colors | Source image. |
DFSize | size | Image size. |
Int32 | border | Border width. |
Boolean | leftRight | |
Boolean | topBottom |