golib
0.5
|
Image display widget. More...
#include <imageview.h>
Public Types | |
enum | { IMAGE_SET, IMAGE_REMOVED, CURRENT_IMAGE_CHANGED } |
Public Member Functions | |
void | draw () |
void | setImage (const goSignal3DBase< void > &image, goIndex_t index=-1) |
Sets the image to draw. More... | |
void | setImage (int w, int h, int format=goPlot::Object2DImage::RGB24, goIndex_t index=-1) |
Sets the image dimensions and format. A cairo image is created. More... | |
goAutoPtr< goPlot::Object2DImage > | getImageObject (goIndex_t index=-1) |
Get the image from this object. More... | |
goAutoPtr< goSignal3DBase< void > > | getImage (goIndex_t index=-1) |
Get the image from this object. More... | |
void | removeImage (goIndex_t index=-1) |
void | reorderImages (const std::vector< int > &order) |
goIndex_t | getImageCount () const |
goAutoPtr< goPlot::Graph > | graph () |
Get the Graph object used to draw the image. More... | |
void | setCurrentImage (goIndex_t i) |
goIndex_t | currentImageIndex () const |
goCaller1< void, int > & | changedCaller () |
Protected Member Functions | |
virtual bool | on_draw (Cairo::RefPtr< Cairo::Context > const &context) override |
Draws everything. More... | |
goAutoPtr< goSignal3DBase< void > > | imageRef (goAutoPtr< goPlot::Object2DImage > img) |
Creates an object that references the data in the Object2DImage directly. More... | |
Image display widget.
ImageView uses a goPlot::Graph to display objects with Cairo. For an image set with setImage()
, a buffer will be created, so the image data, if any, will be copied. A wrapping goSignal3DBase referencing that buffer can be retrieved with getImage()
. The goPlot::Object2DImage that represents the same image data can be retrieved with getImageObject()
.
The data type of the image data is unsigned char, or GO_UINT8 in golib notation. The number of channels is either 4 or 1, depending on whether the format is goPlot::Object2DImage::RGB24 , goPlot::Object2DImage::ARGB32 (both 4 channels) or goPlot::Object2DImage::A8. This widget can display images from goSignal3DBase<void>
objects.
anonymous enum |
goAutoPtr< goSignal3DBase< void > > goGUI::ImageView::getImage | ( | goIndex_t | index = -1 | ) |
Get the image from this object.
goAutoPtr< goPlot::Object2DImage > goGUI::ImageView::getImageObject | ( | goIndex_t | index = -1 | ) |
goAutoPtr< goPlot::Graph > goGUI::ImageView::graph | ( | ) |
Get the Graph object used to draw the image.
|
protected |
Creates an object that references the data in the Object2DImage directly.
The data in the object is organised linearly, rows first. If the internal image format is ARGB32 or RGB24, the number of channels is 4. Otherwise, the number of channels is 1. The data type is always GO_UINT8.
The returned object should be a goSignal3DRef and has border size (8,8,0) set.
|
overrideprotectedvirtual |
Draws everything.
event | The event. |
void goGUI::ImageView::setImage | ( | const goSignal3DBase< void > & | image, |
goIndex_t | index = -1 |
||
) |
Sets the image to draw.
The image gets deep copied into a cairo image object. getImage() can be used to get a reference goSignal3DBase object which references the cairo image data directly. getImageObject() can be used to retrieve the respective goPlot::Object2DImage, giving the same data.
image | Image to draw. The image gets copied, but gets copied into a uint8 type array. That means if the data range is out of the 8 bit range, it will get clamped. |
void goGUI::ImageView::setImage | ( | int | w, |
int | h, | ||
int | format = goPlot::Object2DImage::RGB24 , |
||
goIndex_t | index = -1 |
||
) |
Sets the image dimensions and format. A cairo image is created.
The formats can be found in goPlot::Object2DImage. getImage() can be used to get a reference goSignal3DBase object which references the cairo image data directly.
w | Width |
h | Height |
format | Format, such as goPlot::Object2DImage::RGB24. |
index | Index of the image (default -1). If index < 0, a new image is made. |