Class ImgFile
Connects to a *.IMG file to enumerate and extract image data. Each IMG file contains a single image.
Inherited Members
Namespace: DaggerfallConnect.Arena2
Assembly: Assembly-CSharp.dll
Syntax
public class ImgFile : BaseImageFile
Constructors
| Improve this Doc View SourceImgFile()
Default constructor.
Declaration
public ImgFile()
ImgFile(String, FileUsage, DFPalette, Boolean)
Load constructor with palette assignment. Some IMG files contain palette information, this will overwrite the specified palette.
Declaration
public ImgFile(string filePath, FileUsage usage, DFPalette palette, bool readOnly)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filePath | Absolute path to *.IMG file. |
| FileUsage | usage | Specify if file will be accessed from disk, or loaded into RAM. |
| DFPalette | palette | Palette to use when building images. |
| Boolean | readOnly | File will be read-only if true, read-write if false. |
ImgFile(String, FileUsage, Boolean)
Load constructor.
Declaration
public ImgFile(string filePath, FileUsage usage, bool readOnly)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filePath | Absolute path to *.IMG file. |
| FileUsage | usage | Specify if file will be accessed from disk, or loaded into RAM. |
| Boolean | readOnly | File will be read-only if true, read-write if false. |
ImgFile(String, FileUsage, String, Boolean)
Load constructor that also loads a palette. Some IMG files contain palette information, this will overwrite the specified palette.
Declaration
public ImgFile(string filePath, FileUsage usage, string paletteFilePath, bool readOnly)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filePath | Absolute path to *.IMG file. |
| FileUsage | usage | Specify if file will be accessed from disk, or loaded into RAM. |
| String | paletteFilePath | Absolute path to Daggerfall palette file. |
| Boolean | readOnly | File will be read-only if true, read-write if false. |
Properties
| Improve this Doc View SourceDescription
Description of this file (always "IMG File" as the game files contain no text descriptions for this file type).
Declaration
public override string Description { get; }
Property Value
| Type | Description |
|---|---|
| String |
Overrides
| Improve this Doc View SourceImageOffset
Gets XOffset and YOffset from image header.
Declaration
public DFPosition ImageOffset { get; }
Property Value
| Type | Description |
|---|---|
| DFPosition |
IsPalettized
Specifies if this IMG file defines its own palette.
Declaration
public bool IsPalettized { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
PaletteName
IMG files use a variety of palettes. This property returns the correct palette filename to use for this image. Palettized images (check IsPalettized flag) will return String.Emtpy for the palette filename.
Declaration
public override string PaletteName { get; }
Property Value
| Type | Description |
|---|---|
| String |
Overrides
| Improve this Doc View SourceRecordCount
Number of image records in this Img file.
Declaration
public override int RecordCount { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Overrides
Methods
| Improve this Doc View SourceGetDFBitmap()
Gets bitmap data as indexed 8-bit byte array.
Declaration
public DFBitmap GetDFBitmap()
Returns
| Type | Description |
|---|---|
| DFBitmap | DFBitmap object. |
GetDFBitmap(Int32, Int32)
Gets bitmap data as indexed 8-bit byte array for specified record and frame. This method is an override for abstract method in parent class DFImageFile. As IMG files only have 1 image the Record and Frame indices must always be 0 when calling this method.
Declaration
public override DFBitmap GetDFBitmap(int record, int frame)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | record | Index of record. Must be 0. |
| Int32 | frame | Index of frame. Must be 0. |
Returns
| Type | Description |
|---|---|
| DFBitmap | DFBitmap object. |
Overrides
| Improve this Doc View SourceGetFrameCount(Int32)
Gets number of frames in specified record.
Declaration
public override int GetFrameCount(int record)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | record | Index of record. Must be 0 for Img files. |
Returns
| Type | Description |
|---|---|
| Int32 | Number of frames. Always 1 for loaded Img files. |
Overrides
| Improve this Doc View SourceGetHeaderlessFileImageDimensions()
IMG files have a fixed width and height not specified in a header. This method returns the correct dimensions of images inside these files.
Declaration
protected DFSize GetHeaderlessFileImageDimensions()
Returns
| Type | Description |
|---|---|
| DFSize | Dimensions of image. |
GetSize(Int32)
Gets width and height of specified record. As IMG files only have 1 record, this must be 0.
Declaration
public override DFSize GetSize(int record)
Parameters
| Type | Name | Description |
|---|---|---|
| Int32 | record | Index of record. Must be 0. |
Returns
| Type | Description |
|---|---|
| DFSize | DFSize object. |
Overrides
| Improve this Doc View SourceIsFilenameSupported(String)
Tests if a filename is supported.
Declaration
public bool IsFilenameSupported(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filename | Name of *.IMG file. |
Returns
| Type | Description |
|---|---|
| Boolean | True if supported, otherwise false. |
Load(String, FileUsage, Boolean)
Loads an IMG file.
Declaration
public override bool Load(string filePath, FileUsage usage, bool readOnly)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filePath | Absolute path to *.IMG file |
| FileUsage | usage | Specify if file will be accessed from disk, or loaded into RAM. |
| Boolean | readOnly | File will be read-only if true, read-write if false. |
Returns
| Type | Description |
|---|---|
| Boolean | True if successful, otherwise false. |
Overrides
| Improve this Doc View SourceUnsupportedFilenames()
Gets unsupported filenames. The three IMG filenames returned have no image data or are otherwise invalid.
Declaration
public string[] UnsupportedFilenames()
Returns
| Type | Description |
|---|---|
| String[] | Array of unsupported filenames. |