Re: [UFO-devel] building an image viewer
Status: Beta
Brought to you by:
schmidtjf
From: Johannes S. <sch...@us...> - 2006-06-10 13:13:20
|
Hi Ogla, On Saturday 10 June 2006 11:46, Veli Ogla Sungutay wrote: > I need to create GUI applications that shows images on the screen, and let > the user do simple manipulation stuff: resizing, cropping, renaming etc... > > I see there are several Graphics and Image classes in the API; What is the > path I should take? It is not that trivial but it is possible. If you do not care about performance too much (at least in the beginning), you can use the built-in image class (UImage) and assign this as icon of a label (or button). That means, you create your own image buffer and feed it as RGB(A) data to an UImageIO class, create an image and so on. I have attached a small example (image.cpp) which shows how to do that (based on the base.cpp example). Compile it via: g++ -o image image.cpp `pkg-config --cflags --libs ufo` Otherwise you can draw the image yourself using OpenGL methods. To do this, you have to subclass UWidget and override UWidget::paintWidget(UGraphics*) with your own code (set up matrices and OpenGL state, draw image, revert OpenGL matrices and states). Hope that helps, Johannes |