Otter
0.9.8.91
2d Game Development Framework based on SFML.Net
|
Class representing a texture. Can perform pixel operations on the CPU, but those will be pretty slow and shouldn't be used that much. More...
Public Member Functions | |
Texture (string source, bool useCache=true) | |
Load a texture from a file path. More... | |
Texture (Stream stream, bool useCache=true) | |
Create a texture from a stream of bytes. More... | |
Texture (Texture copy) | |
Creates a new texture from a copy of another texture. No cache option for this. More... | |
Texture (byte[] bytes, bool useCache=true) | |
Create a texture from a byte array. More... | |
Texture (int width, int height) | |
Creates an empty texture of width and height. This does not use the cache. More... | |
void | CopyPixels (Texture from, int fromX, int fromY, int toX, int toY) |
Copy pixels from one texture to another using blitting. More... | |
void | CopyPixels (Texture from, int fromX, int fromY, int fromWidth, int fromHeight, int toX, int toY) |
void | CreateImage (bool forceNewImage=false) |
Loads the image internally in the texture for image manipulation. This is handled automatically, but it's exposed so that it can be manually controlled. More... | |
Color | GetPixel (int x, int y) |
Get the Color from a specific pixel on the texture. Warning: This is slow! More... | |
void | SaveToFile (string path) |
Save the texture to a file. The supported image formats are bmp, png, tga and jpg. More... | |
void | SetPixel (int x, int y, Color color) |
Sets the color of a specific pixel on the texture. More... | |
void | SetRect (int x, int y, int width, int height, Color color) |
Sets the color of a rectangle of pixels on the texture. More... | |
void | Update () |
Updates the texture to reflect changes made from SetPixel. More... | |
void | SetBytes (byte[] bytes) |
Updates the texture with a byte array. Note: Updates immediately. Probably not the fastest. More... | |
void | SetBytes (byte[] bytes, int width, int height, int x=0, int y=0) |
Updates the texture with a byte array, at the given position and size. Note: Updates immediately. Probably not the fastest. More... | |
Static Public Attributes | |
static bool | DefaultSmooth = false |
The default setting to use for smoothing textures. Much easier to set this at the start of a program rather than adjust the settings for every single texture you use. More... | |
Properties | |
int | Height [get] |
The height of the texture. More... | |
byte[] | Pixels [get, set] |
The array of pixels in the texture in bytes. More... | |
Rectangle | Region [get] |
The rectangle created by the Texture's width and height. More... | |
bool | Smooth [get, set] |
Determines if the source texture is smoothed when transformed. More... | |
string | Source [get, set] |
The file path source if the texture was loaded from a file. More... | |
int | Width [get] |
The width of the Texture. More... | |
Class representing a texture. Can perform pixel operations on the CPU, but those will be pretty slow and shouldn't be used that much.
Otter.Texture.Texture | ( | string | source, |
bool | useCache = true |
||
) |
Load a texture from a file path.
source | The file path to load from. |
useCache | Determines if the cache should be checked first. |
Otter.Texture.Texture | ( | Stream | stream, |
bool | useCache = true |
||
) |
Create a texture from a stream of bytes.
stream | The stream to load from. |
useCache | Determines if the cache should be checked first. |
Otter.Texture.Texture | ( | Texture | copy | ) |
Creates a new texture from a copy of another texture. No cache option for this.
copy | The texture to copy from. |
Otter.Texture.Texture | ( | byte[] | bytes, |
bool | useCache = true |
||
) |
Create a texture from a byte array.
bytes | The byte array to load from. |
useCache | Determines if the cache should be checked first. |
Otter.Texture.Texture | ( | int | width, |
int | height | ||
) |
Creates an empty texture of width and height. This does not use the cache.
width | The width of the texture. |
height | The height of the texture. |
void Otter.Texture.CopyPixels | ( | Texture | from, |
int | fromX, | ||
int | fromY, | ||
int | toX, | ||
int | toY | ||
) |
Copy pixels from one texture to another using blitting.
from | |
fromX | |
fromY | |
toX | |
toY |
void Otter.Texture.CreateImage | ( | bool | forceNewImage = false | ) |
Loads the image internally in the texture for image manipulation. This is handled automatically, but it's exposed so that it can be manually controlled.
forceNewImage | If set to true a new image will always be created instead of only when there is no image. |
Color Otter.Texture.GetPixel | ( | int | x, |
int | y | ||
) |
void Otter.Texture.SaveToFile | ( | string | path | ) |
Save the texture to a file. The supported image formats are bmp, png, tga and jpg.
path | The file path to save to. The type of image is deduced from the extension. |
void Otter.Texture.SetBytes | ( | byte[] | bytes | ) |
Updates the texture with a byte array. Note: Updates immediately. Probably not the fastest.
bytes | The byte array containing our pixels. |
void Otter.Texture.SetBytes | ( | byte[] | bytes, |
int | width, | ||
int | height, | ||
int | x = 0 , |
||
int | y = 0 |
||
) |
Updates the texture with a byte array, at the given position and size. Note: Updates immediately. Probably not the fastest.
bytes | The byte array containing our pixels. |
width | The width of the section we are updating. |
height | The height of the section we are updating. |
x | The X coordinate of the section we are updating. |
y | The Y coordinate of the section we are updating. |
void Otter.Texture.SetPixel | ( | int | x, |
int | y, | ||
Color | color | ||
) |
Sets the color of a specific pixel on the texture.
x | The x coordinate of the pixel. |
y | The y coordinate of the pixel. |
color | The Color to set the pixel to. |
void Otter.Texture.SetRect | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
Color | color | ||
) |
Sets the color of a rectangle of pixels on the texture.
x | The x coordinate of the rectangle. |
y | The y coordinate of the rectangle. |
width | The width of the rectangle. |
height | The height of the rectangle. |
color | The color of the rectangle. |
void Otter.Texture.Update | ( | ) |
Updates the texture to reflect changes made from SetPixel.
|
static |
The default setting to use for smoothing textures. Much easier to set this at the start of a program rather than adjust the settings for every single texture you use.
|
get |
The height of the texture.
|
getset |
The array of pixels in the texture in bytes.
|
getset |
Determines if the source texture is smoothed when transformed.
|
getset |
The file path source if the texture was loaded from a file.
|
get |
The width of the Texture.