Class Util
Inheritance
System.Object
Util
Syntax
Methods
BytesFromBitDepth(Int32)
Returns the number of bytes needed to store a single pixel of the
specified bit depth.
Declaration
public static int BytesFromBitDepth(int depth)
Parameters
Type |
Name |
Description |
System.Int32 |
depth |
|
Returns
Type |
Description |
System.Int32 |
|
BytesPerRow(Size, Int32)
Calculates the number of bytes required to store a row of an image
with the specified bit depth.
Declaration
public static int BytesPerRow(Size size, int bitDepth)
Parameters
Type |
Name |
Description |
Size |
size |
The size of the image in pixels.
|
System.Int32 |
bitDepth |
The bit depth of the image.
|
Returns
Type |
Description |
System.Int32 |
The number of bytes needed to store a row of the image.
|
CheckBufferBounds(Byte[], Int32, Int32)
Verify that the offset and count will remain within the bounds of the
buffer.
Declaration
public static bool CheckBufferBounds(byte[] data, int offset, int count)
Parameters
Type |
Name |
Description |
System.Byte[] |
data |
|
System.Int32 |
offset |
|
System.Int32 |
count |
|
Returns
Type |
Description |
System.Boolean |
True if in bounds, false if out of bounds.
|
CheckByteArrayLength(Int64)
Declaration
public static void CheckByteArrayLength(long length)
Parameters
Type |
Name |
Description |
System.Int64 |
length |
|
DebugMessage(Stream, String, Object[])
Writes a message to the debug console, indicating the current position
in the stream in both decimal and hexadecimal formats.
Declaration
[Conditional("DEBUG")]
public static void DebugMessage(Stream stream, string message, params object[] args)
Parameters
Type |
Name |
Description |
System.IO.Stream |
stream |
|
System.String |
message |
|
System.Object[] |
args |
|
Fill(Byte[], Int32, Int32, Byte)
Fills a buffer with a byte value.
Declaration
public static void Fill(byte[] ptr, int start, int end, byte value)
Parameters
Type |
Name |
Description |
System.Byte[] |
ptr |
|
System.Int32 |
start |
|
System.Int32 |
end |
|
System.Byte |
value |
|
GetPadding(Int32, Int32)
Get number of bytes required to pad to the specified multiple.
Declaration
public static int GetPadding(int length, int padMultiple)
Parameters
Type |
Name |
Description |
System.Int32 |
length |
|
System.Int32 |
padMultiple |
|
Returns
Type |
Description |
System.Int32 |
|
IntersectWith(Rectangle, Rectangle)
Declaration
public static Rectangle IntersectWith(this Rectangle thisRect, Rectangle rect)
Parameters
Returns
Invert(Byte[], Int32, Int32)
Declaration
public static void Invert(byte[] ptr, int ptrStart, int ptrEnd)
Parameters
Type |
Name |
Description |
System.Byte[] |
ptr |
|
System.Int32 |
ptrStart |
|
System.Int32 |
ptrEnd |
|
MinChannelCount(PsdColorMode)
Declaration
public static short MinChannelCount(this PsdColorMode colorMode)
Parameters
Returns
Type |
Description |
System.Int16 |
|
RoundUp(Int32, Int32)
Round the integer to a multiple.
Declaration
public static int RoundUp(int value, int multiple)
Parameters
Type |
Name |
Description |
System.Int32 |
value |
|
System.Int32 |
multiple |
|
Returns
Type |
Description |
System.Int32 |
|
SwapByteArray(Int32, Byte[], Int32, Int32)
Declaration
public static void SwapByteArray(int bitDepth, byte[] byteArray, int startIdx, int count)
Parameters
Type |
Name |
Description |
System.Int32 |
bitDepth |
|
System.Byte[] |
byteArray |
|
System.Int32 |
startIdx |
|
System.Int32 |
count |
|
SwapByteArray2(Byte[], Int32, Int32)
Reverses the endianness of 2-byte words in a byte array.
Declaration
public static void SwapByteArray2(byte[] byteArray, int startIdx, int count)
Parameters
Type |
Name |
Description |
System.Byte[] |
byteArray |
Byte array containing the sequence on which to swap endianness
|
System.Int32 |
startIdx |
Byte index of the first word to swap
|
System.Int32 |
count |
Number of words to swap
|
SwapByteArray4(Byte[], Int32, Int32)
Reverses the endianness of 4-byte words in a byte array.
Declaration
public static void SwapByteArray4(byte[] byteArray, int startIdx, int count)
Parameters
Type |
Name |
Description |
System.Byte[] |
byteArray |
Byte array containing the sequence on which to swap endianness
|
System.Int32 |
startIdx |
Byte index of the first word to swap
|
System.Int32 |
count |
Number of words to swap
|
SwapBytes(Byte[], Int32, Int32)
Reverses the endianness of a word of arbitrary length.
Declaration
public static void SwapBytes(byte[] ptr, int start, int nLength)
Parameters
Type |
Name |
Description |
System.Byte[] |
ptr |
|
System.Int32 |
start |
|
System.Int32 |
nLength |
|
SwapBytes2(Byte[], Int32)
Reverses the endianness of a 2-byte word.
Declaration
public static void SwapBytes2(byte[] ptr, int start)
Parameters
Type |
Name |
Description |
System.Byte[] |
ptr |
|
System.Int32 |
start |
|
SwapBytes4(Byte[], Int32)
Reverses the endianness of a 4-byte word.
Declaration
public static void SwapBytes4(byte[] ptr, int start)
Parameters
Type |
Name |
Description |
System.Byte[] |
ptr |
|
System.Int32 |
start |
|