ImageCanvas Class Reference

Provides a Qt canvas for displaying 2D raster data. More...

#include <ImageCanvas.h>

Inheritance diagram for ImageCanvas:

Canvas NaiveRenderOutput RenderOutput PropertyMap

List of all members.

Public Slots

Main usage interface
void render ()
 Attempts to render the entire canvas.
void render (unsigned x0, unsigned y0, unsigned width, unsigned height)
 Attempts to render the specified rectangular subregion on the canvas.
virtual void redraw ()
 Updates the entire canvas (same as update).
virtual void update ()
 Updates the entire canvas.
virtual void update (int x, int y, int width, int height)
 Updates the specified rectangular subregion on the canvas.

Public Member Functions

virtual bool supportsOpenGL () const
virtual QWidget * getQWidget ()
Constructors
 ImageCanvas (Gui *gui, unsigned width=(480), unsigned height=(480))
 ImageCanvas (Gui *gui, const QImage &background)
virtual ~ImageCanvas ()
Saving/Loading
bool save (const char *fileName)
bool load (const char *fileName)
Pixel data accessors/mutators
void setPixel (unsigned x, unsigned y, const Rgba32 &val)
Rgba32 getPixel (unsigned x, unsigned y) const
void setData (const Rgba32 *data)
void setData (const Rgba32 *data, unsigned newWidth, unsigned newHeight)
Rgba32getData ()
Canvas dimensions
void setWidth (unsigned width)
void setHeight (unsigned height)
void setSize (unsigned width, unsigned height)

Protected Member Functions

Overridden from QWidget
virtual void mousePressEvent (QMouseEvent *)
virtual void mouseReleaseEvent (QMouseEvent *)
virtual void mouseMoveEvent (QMouseEvent *)
virtual void keyPressEvent (QKeyEvent *event)
virtual void keyReleaseEvent (QKeyEvent *event)
virtual QSize sizeHint () const
virtual QSize minimumSize () const
virtual QSize maximumSize () const
virtual void paintEvent (QPaintEvent *e)
Overridden from RenderOutput
virtual void _addSample (const PointSample &sample)

Protected Attributes

QImage * m_qimage
RgbaImagem_image
MainSyscallProxym_mainProxy
unsigned * m_renderCount

Friends

class MainSyscallProxy


Detailed Description

Provides a Qt canvas for displaying 2D raster data.

Author:
Travis Fischer (fisch0920@gmail.com)

Matthew Jacobs (jacobs.mh@gmail.com)

Date:
Fall 2008

Definition at line 26 of file ImageCanvas.h.


Constructor & Destructor Documentation

ImageCanvas::ImageCanvas ( Gui gui,
unsigned  width = (480),
unsigned  height = (480) 
)

Definition at line 15 of file ImageCanvas.cpp.

ImageCanvas::ImageCanvas ( Gui gui,
const QImage &  background 
)

Definition at line 26 of file ImageCanvas.cpp.

ImageCanvas::~ImageCanvas (  )  [virtual]

Definition at line 34 of file ImageCanvas.cpp.


Member Function Documentation

bool ImageCanvas::save ( const char *  fileName  )  [virtual]

Attempts to saver this canvas' image to the specified file

Returns:
whether or not the save was successful

Implements Canvas.

Definition at line 41 of file ImageCanvas.cpp.

bool ImageCanvas::load ( const char *  fileName  ) 

Attempts to load this canvas' image from the specified file

Returns:
whether or not the load was successful

Definition at line 48 of file ImageCanvas.cpp.

void ImageCanvas::setPixel ( unsigned  x,
unsigned  y,
const Rgba32 val 
)

Sets an individual pixel's data on this canvas

Definition at line 71 of file ImageCanvas.cpp.

Rgba32 ImageCanvas::getPixel ( unsigned  x,
unsigned  y 
) const

Returns:
an individual pixel's data

Definition at line 79 of file ImageCanvas.cpp.

void ImageCanvas::setData ( const Rgba32 data  ) 

Sets all of the pixel data on this canvas

Definition at line 94 of file ImageCanvas.cpp.

void ImageCanvas::setData ( const Rgba32 data,
unsigned  newWidth,
unsigned  newHeight 
)

Sets all of the pixel data and resizes this canvas, all without allocating any temporary memory inbetween

Definition at line 106 of file ImageCanvas.cpp.

Rgba32* ImageCanvas::getData (  )  [inline]

Returns:
the underlying image data

Definition at line 88 of file ImageCanvas.h.

void ImageCanvas::setWidth ( unsigned  width  ) 

Definition at line 128 of file ImageCanvas.cpp.

void ImageCanvas::setHeight ( unsigned  height  ) 

Definition at line 136 of file ImageCanvas.cpp.

void ImageCanvas::setSize ( unsigned  width,
unsigned  height 
)

Definition at line 144 of file ImageCanvas.cpp.

bool ImageCanvas::supportsOpenGL (  )  const [virtual]

Returns:
true iff this Canvas supports OpenGL
Note:
Gui assumes that if a Canvas supports OpenGL, it also derives from QGLWidget
See also:
also OpenGLCanvas

Implements Canvas.

Definition at line 154 of file ImageCanvas.cpp.

virtual QWidget* ImageCanvas::getQWidget (  )  [inline, virtual]

Returns:
the QWidget associated with this Canvas

Implements Canvas.

Definition at line 108 of file ImageCanvas.h.

void ImageCanvas::render (  )  [slot]

Attempts to render the entire canvas.

Definition at line 159 of file ImageCanvas.cpp.

void ImageCanvas::render ( unsigned  x0,
unsigned  y0,
unsigned  width,
unsigned  height 
) [slot]

Attempts to render the specified rectangular subregion on the canvas.

Definition at line 169 of file ImageCanvas.cpp.

void ImageCanvas::redraw (  )  [virtual, slot]

Updates the entire canvas (same as update).

Implements Canvas.

Definition at line 182 of file ImageCanvas.cpp.

void ImageCanvas::update (  )  [virtual, slot]

Updates the entire canvas.

Definition at line 186 of file ImageCanvas.cpp.

void ImageCanvas::update ( int  x,
int  y,
int  width,
int  height 
) [virtual, slot]

Updates the specified rectangular subregion on the canvas.

Definition at line 194 of file ImageCanvas.cpp.

void ImageCanvas::mousePressEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 226 of file ImageCanvas.cpp.

void ImageCanvas::mouseReleaseEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 230 of file ImageCanvas.cpp.

void ImageCanvas::mouseMoveEvent ( QMouseEvent *  e  )  [protected, virtual]

Definition at line 234 of file ImageCanvas.cpp.

void ImageCanvas::keyPressEvent ( QKeyEvent *  event  )  [protected, virtual]

Definition at line 238 of file ImageCanvas.cpp.

void ImageCanvas::keyReleaseEvent ( QKeyEvent *  event  )  [protected, virtual]

Definition at line 242 of file ImageCanvas.cpp.

QSize ImageCanvas::sizeHint (  )  const [protected, virtual]

Definition at line 247 of file ImageCanvas.cpp.

QSize ImageCanvas::minimumSize (  )  const [protected, virtual]

Definition at line 251 of file ImageCanvas.cpp.

QSize ImageCanvas::maximumSize (  )  const [protected, virtual]

Definition at line 255 of file ImageCanvas.cpp.

void ImageCanvas::paintEvent ( QPaintEvent *  e  )  [protected, virtual]

Definition at line 260 of file ImageCanvas.cpp.

void ImageCanvas::_addSample ( const PointSample sample  )  [protected, virtual]

Note:
default implementation does nothing

Reimplemented from NaiveRenderOutput.

Definition at line 203 of file ImageCanvas.cpp.


Friends And Related Function Documentation

friend class MainSyscallProxy [friend]

Definition at line 115 of file ImageCanvas.h.


Member Data Documentation

QImage* ImageCanvas::m_qimage [protected]

Definition at line 168 of file ImageCanvas.h.

Definition at line 169 of file ImageCanvas.h.

Definition at line 170 of file ImageCanvas.h.

unsigned* ImageCanvas::m_renderCount [protected]

Definition at line 171 of file ImageCanvas.h.


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

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6