PDA

View Full Version : editable rectangles



parmar ranjit
19th February 2008, 08:17
Dear friends,
Good Morning...
I am using LINUX with Qt 4.
DETAILS: I have black & white scanned copy of text document. Further I have filtered and even binarized that image ( jpg or tiff) Now I am to draw editable rectangle on words. I have been able to draw RED rectangle using SETPIXEL( ) on an IMAGE as shown in attachment 1. For that purpose i tried a lot with function like DRAWRECT but I could not.
So I have regenerated the whole image keeping black pixel as black & white as white in new image AND then draw RED rectangle (given coordinate) with two FOR loops using setpixel().(here in attachment i have shown non filterd image to feel background image)


PROBLEM: How to edit that rectangle which has been drawn on image ? I mean to say how will I be able to change the dimensions of rectangle using mouse event? It is some thing like we do adjust the hor. & vertical lines in table in MS WORD with mouse.
In short how to change rectangle in attch1 to look like in attch2?

Thanx
Ranjit Parmar
INDIA

jpn
19th February 2008, 11:14
As long as the rectangle should remain editable you might not want to add that rectangle to the image itself but just render it over the image on screen.

yosefm
19th February 2008, 12:12
I would load the base image in a QGraphicsScene, then I can create rectangles without changing the underlying image. Then you display the scene using a QGraphicsView widget. Selecting and drag-and-drop are built into these two classes.

parmar ranjit
20th February 2008, 09:59
Thnx for reply,
ya
You are right. Even when I have been able to draw perfectly rectangles on image using setPixel( ) at specifed coordinates of image, but yet it will not be possible to DRAG or EDIT those rectangles because they are the part of the image at pixel level.

Since I am new to Qt, will you please elaborate in little more detail using some simple code :
How to form editable rectangle at given coordinates on image?
I think then only it will be possible to DRAG it using MOUSE.

Waiting eagerly 4 reply
Ranjit Parmar: