Ogre Procedural  0.3.0 unstable
Procedural Geometry & Textures for Ogre3D
Public Member Functions | List of all members
Procedural::TextureBuffer Class Reference

class to store image data while processing More...

#include <ProceduralTextureBuffer.h>

Public Member Functions

void setPixel (size_t x, size_t y, Ogre::ColourValue colour)
 Set colour of a specified pixel. More...
 
void setPixel (size_t x, size_t y, Ogre::uchar red, Ogre::uchar green, Ogre::uchar blue, Ogre::uchar alpha=255)
 Set colour of a specified pixel. More...
 
void setPixel (size_t x, size_t y, Ogre::Real red, Ogre::Real green, Ogre::Real blue, Ogre::Real alpha=1.0f)
 Set colour of a specified pixel. More...
 
void setRed (size_t x, size_t y, Ogre::uchar red)
 Set red colour value of a specified pixel. More...
 
void setGreen (size_t x, size_t y, Ogre::uchar green)
 Set green colour value of a specified pixel. More...
 
void setBlue (size_t x, size_t y, Ogre::uchar blue)
 Set blue colour value of a specified pixel. More...
 
void setAlpha (size_t x, size_t y, Ogre::uchar alpha)
 Set alpha colour value of a specified pixel. More...
 
void setRed (size_t x, size_t y, Ogre::Real red)
 Set red colour value of a specified pixel. More...
 
void setGreen (size_t x, size_t y, Ogre::Real green)
 Set green colour value of a specified pixel. More...
 
void setBlue (size_t x, size_t y, Ogre::Real blue)
 Set blue colour value of a specified pixel. More...
 
void setAlpha (size_t x, size_t y, Ogre::Real alpha)
 Set alpha colour value of a specified pixel. More...
 
void setData (size_t width, size_t height, Ogre::uchar *data)
 Copy image data (RGBA) from a buffer to this object. More...
 
void setData (TextureBufferPtr buffer)
 Copy image data (RGBA) from an other TextureBuffer object. More...
 
Ogre::ColourValue getPixel (size_t x, size_t y) const
 Get colour value of a specified pixel. More...
 
Ogre::uchar getPixelRedByte (size_t x, size_t y) const
 Get red colour value of a specified pixel. More...
 
Ogre::uchar getPixelGreenByte (size_t x, size_t y) const
 Get green colour value of a specified pixel. More...
 
Ogre::uchar getPixelBlueByte (size_t x, size_t y) const
 Get blue colour value of a specified pixel. More...
 
Ogre::uchar getPixelAlphaByte (size_t x, size_t y) const
 Get alpha colour value of a specified pixel. More...
 
Ogre::Real getPixelRedReal (size_t x, size_t y) const
 Get red colour value of a specified pixel. More...
 
Ogre::Real getPixelGreenReal (size_t x, size_t y) const
 Get green colour value of a specified pixel. More...
 
Ogre::Real getPixelBlueReal (size_t x, size_t y) const
 Get blue colour value of a specified pixel. More...
 
Ogre::Real getPixelAlphaReal (size_t x, size_t y) const
 Get alpha colour value of a specified pixel. More...
 
TextureBufferPtr clone () const
 Create a copy of the current texture image buffer. More...
 
 TextureBuffer (TextureBufferPtr tocopy)
 Standard constructor which copy a given image. More...
 
 TextureBuffer (Ogre::uint width_height)
 Standard constructor which creates a quadratic image buffer with the given size. More...
 
 ~TextureBuffer ()
 Destructor which release memory. More...
 
Ogre::uint getWidth () const
 Get the width of the stored image in px. More...
 
Ogre::uint getHeight () const
 Get the height of the stored image in px. More...
 
Ogre::ImagegetImage () const
 Create a new image from buffer. More...
 
void saveImage (Ogre::String filename) const
 Save the image from the buffer to a file. More...
 
Ogre::TexturePtr createTexture (Ogre::String name, Ogre::String group=Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) const
 Creates an OGRE texture and add it to current TextureManager instance. More...
 

Detailed Description

class to store image data while processing

Create a TextureBuffer object and move it to all classes inherited from TextureProcessing

Todo:
Increase speed of reading and writeing pixel values.

Constructor & Destructor Documentation

◆ TextureBuffer() [1/2]

Procedural::TextureBuffer::TextureBuffer ( TextureBufferPtr  tocopy)

Standard constructor which copy a given image.

Parameters
tocopyImage which to copy
Exceptions
Ogre::InvalidParametersExceptionPointer to source image must not be NULL!

◆ TextureBuffer() [2/2]

Procedural::TextureBuffer::TextureBuffer ( Ogre::uint  width_height)

Standard constructor which creates a quadratic image buffer with the given size.

Parameters
width_heightEdge length in px
Exceptions
Ogre::InvalidParametersExceptionMinimum edge size is 8!

◆ ~TextureBuffer()

Procedural::TextureBuffer::~TextureBuffer ( )

Destructor which release memory.

Member Function Documentation

◆ clone()

TextureBufferPtr Procedural::TextureBuffer::clone ( ) const

Create a copy of the current texture image buffer.

Note
You have to delete cloned object by yourself!

◆ createTexture()

Ogre::TexturePtr Procedural::TextureBuffer::createTexture ( Ogre::String  name,
Ogre::String  group = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME 
) const

Creates an OGRE texture and add it to current TextureManager instance.

Parameters
nameName of the texture
groupName of the resource group where to list the texture

◆ getHeight()

Ogre::uint Procedural::TextureBuffer::getHeight ( ) const

◆ getImage()

Ogre::Image* Procedural::TextureBuffer::getImage ( ) const

Create a new image from buffer.

◆ getPixel()

Ogre::ColourValue Procedural::TextureBuffer::getPixel ( size_t  x,
size_t  y 
) const

Get colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return colour value as an Ogre::ColourValue object.
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelAlphaByte()

Ogre::uchar Procedural::TextureBuffer::getPixelAlphaByte ( size_t  x,
size_t  y 
) const

Get alpha colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return alpha colour value as a byte [0, 255].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelAlphaReal()

Ogre::Real Procedural::TextureBuffer::getPixelAlphaReal ( size_t  x,
size_t  y 
) const

Get alpha colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return alpha colour value as a Ogre::Real [0.0, 1.0].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelBlueByte()

Ogre::uchar Procedural::TextureBuffer::getPixelBlueByte ( size_t  x,
size_t  y 
) const

Get blue colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return blue colour value as a byte [0, 255].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelBlueReal()

Ogre::Real Procedural::TextureBuffer::getPixelBlueReal ( size_t  x,
size_t  y 
) const

Get blue colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return blue colour value as a Ogre::Real [0.0, 1.0].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelGreenByte()

Ogre::uchar Procedural::TextureBuffer::getPixelGreenByte ( size_t  x,
size_t  y 
) const

Get green colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return green colour value as a byte [0, 255].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelGreenReal()

Ogre::Real Procedural::TextureBuffer::getPixelGreenReal ( size_t  x,
size_t  y 
) const

Get green colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return green colour value as a Ogre::Real [0.0, 1.0].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelRedByte()

Ogre::uchar Procedural::TextureBuffer::getPixelRedByte ( size_t  x,
size_t  y 
) const

Get red colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return red colour value as a byte [0, 255].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getPixelRedReal()

Ogre::Real Procedural::TextureBuffer::getPixelRedReal ( size_t  x,
size_t  y 
) const

Get red colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
Returns
Return red colour value as a Ogre::Real [0.0, 1.0].
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ getWidth()

Ogre::uint Procedural::TextureBuffer::getWidth ( ) const

◆ saveImage()

void Procedural::TextureBuffer::saveImage ( Ogre::String  filename) const

Save the image from the buffer to a file.

Parameters
filenameName (and path) of the image file where to save the buffer.

◆ setAlpha() [1/2]

void Procedural::TextureBuffer::setAlpha ( size_t  x,
size_t  y,
Ogre::Real  alpha 
)

Set alpha colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
alphaNew alpha value of pixel colour [0.0, 1.0]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setAlpha() [2/2]

void Procedural::TextureBuffer::setAlpha ( size_t  x,
size_t  y,
Ogre::uchar  alpha 
)

Set alpha colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
alphaNew alpha value of pixel colour [0, 255]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setBlue() [1/2]

void Procedural::TextureBuffer::setBlue ( size_t  x,
size_t  y,
Ogre::Real  blue 
)

Set blue colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
blueNew blue value of pixel colour [0.0, 1.0]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setBlue() [2/2]

void Procedural::TextureBuffer::setBlue ( size_t  x,
size_t  y,
Ogre::uchar  blue 
)

Set blue colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
blueNew blue value of pixel colour [0, 255]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setData() [1/2]

void Procedural::TextureBuffer::setData ( size_t  width,
size_t  height,
Ogre::uchar data 
)

Copy image data (RGBA) from a buffer to this object.

Parameters
widthWidth of the image in buffer
heightHeight of the image in buffer
dataImage buffer as source for copy

◆ setData() [2/2]

void Procedural::TextureBuffer::setData ( TextureBufferPtr  buffer)

Copy image data (RGBA) from an other TextureBuffer object.

Parameters
bufferImage buffer as source for copy

◆ setGreen() [1/2]

void Procedural::TextureBuffer::setGreen ( size_t  x,
size_t  y,
Ogre::Real  green 
)

Set green colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
greenNew green value of pixel colour [0.0, 1.0]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setGreen() [2/2]

void Procedural::TextureBuffer::setGreen ( size_t  x,
size_t  y,
Ogre::uchar  green 
)

Set green colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
greenNew green value of pixel colour [0, 255]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setPixel() [1/3]

void Procedural::TextureBuffer::setPixel ( size_t  x,
size_t  y,
Ogre::ColourValue  colour 
)

Set colour of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
colourNew colour of pixel
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

References Ogre::ColourValue::a, Ogre::ColourValue::b, Ogre::ColourValue::g, and Ogre::ColourValue::r.

◆ setPixel() [2/3]

void Procedural::TextureBuffer::setPixel ( size_t  x,
size_t  y,
Ogre::Real  red,
Ogre::Real  green,
Ogre::Real  blue,
Ogre::Real  alpha = 1.0f 
)

Set colour of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
redNew red value of pixel colour
greenNew green value of pixel colour [0.0, 1.0]
blueNew blue value of pixel colour [0.0, 1.0]
alphaNew alpha value of pixel colour [0.0, 1.0]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!
Ogre::InvalidParametersExceptionColour value must be between 0 and 1!

◆ setPixel() [3/3]

void Procedural::TextureBuffer::setPixel ( size_t  x,
size_t  y,
Ogre::uchar  red,
Ogre::uchar  green,
Ogre::uchar  blue,
Ogre::uchar  alpha = 255 
)

Set colour of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
redNew red value of pixel colour [0, 255]
greenNew green value of pixel colour [0, 255]
blueNew blue value of pixel colour [0, 255]
alphaNew alpha value of pixel colour [0, 255]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

◆ setRed() [1/2]

void Procedural::TextureBuffer::setRed ( size_t  x,
size_t  y,
Ogre::Real  red 
)

Set red colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
redNew red value of pixel colour [0.0, 1.0]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!
Ogre::InvalidParametersExceptionColour value must be between 0 and 1!

◆ setRed() [2/2]

void Procedural::TextureBuffer::setRed ( size_t  x,
size_t  y,
Ogre::uchar  red 
)

Set red colour value of a specified pixel.

Parameters
xX position of pixel to paint on (0 <= x < width)
yY position of pixel to paint on (0 <= y < height)
redNew red value of pixel colour [0, 255]
Exceptions
Ogre::InvalidParametersExceptionPixel location is out of bounds!

The documentation for this class was generated from the following file: