Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 52

Thread: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextItem

  1. #21
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    What mean you with?:
    The image the edit application gets is the same results as your scaling in the application?
    Have you compared screenshots in post #15 and #19?

  2. #22
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    I lost you completely.

    I suggested you try to scale the image with a graphics editing application the same way you do in your application to see if the result is the same.
    If it is, then there is little you can do, probably you will have to scale to not so small size.
    If the graphics editing application has a better visual result after scaling, then I don't know what the cause for the blur in the scaled image is.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #23
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    test1.png is obviously scaled up, it is not 30px in height. Show us the result of scaling the image to 30px.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #24
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    look at post #17's code.

    If I change the line
    textItem->setScale(3);
    to
    textItem->setScale(1);


    I get the following attached screenshot (test2.png). The images is now of good quality and should have 30 pix in height.

    @high_flyer
    scaled in a Graphics Editing Application (scaled image is tex.png - 3600 dpi - attached):
    unscaled: graphicseditingapplication1.png
    scaled smaller: graphicseditingapplication2.png
    scaled up: graphicseditingapplication3.png
    Attached Images Attached Images

  5. #25
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Quote Originally Posted by stefan-koch View Post
    look at post #17's code.

    If I change the line
    textItem->setScale(3);
    to
    textItem->setScale(1);


    I get the following attached screenshot (test2.png). The images is now of good quality and should have 30 pix in height.
    That's exactly what I would expect. And if you scale it 3 times up it will be distorted. Are you expecting anything different?

    You are aware that if you scale down an image 3 times and then scale it up three times you will not get the original image, right?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #26
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    That's exactly what I would expect. And if you scale it 3 times ...
    That's the problem. How to solve it?
    Look at OpenOffice if I insert a picture and zoom over 100 % in my example to 256% the picture looks good. (Note: I have maked the picture smaller in openoffice first - pick one edge with the mouse and move the mouse to make the image smaller)

    see openoffice1.png (100% scaled), and openoffice2.png(256% scaled) for details.

    My goal is to create a big image (example tex.png with 3600 dpi) and insert this scaled (smaller) into a QGraphicsTextItem, and scale the QGraphicsTextItem up and now QT should be intelligent, and knowledge about the big image (it should have the big image after scaling smaller) and now if I scale the QGraphicsTextItem up, I want that QT does automaticaly see that the QImage has a parent that is bigger and use the information of this, not use the information of the small scaled image.
    Attached Images Attached Images

  7. #27
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    That's the problem. How to solve it?
    'That' (again one needs to guess what you mean) is not the problem.
    The problem is the way you expect the scaling to work for you.

    What open office does (probably) is show you scaled version of the original image each time, not a scaled version of the scaled image.
    You need to do the same (that is how you solve it, what we are trying to explain to you in last 5-6 posts).
    You need to have a living copy of the original image at hand, and scale it only down (from big to small), and not up (from small to big).
    When you want to scale the small image up, you don't scale it really, you scale the original large image to the new scale factor you want the small image scaled up to.
    When you scale - you always should scale the original image, not a scaled copy.

    and scale the QGraphicsTextItem up and now QT should be intelligent, and knowledge about the big image
    Qt is not "intelligent".
    And its not Qt that has your image information, but a QImage object.
    YOU have to supply the intelligence in your code, to use it.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  8. #28
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Yes now I have understand the problem. Thanks.

    But how to forbid QT (QGraphicsTextItem) to automatically scale up the inserted (small) image?

    Thanks
    Last edited by stefan-koch; 19th November 2010 at 13:12.

  9. #29
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Quote Originally Posted by stefan-koch View Post
    But how to forbid QT (QGraphicsTextItem) to automatically scale up the inserted (small) image?
    Qt doesn't scale things up on its own. If it scales something up it is only because you tell it to. If you expect an image to be scaled up then put in a big image and scale down the item containing it. Then when the item is scaled up again, it will still use your original (non-scaled) image to calculate the result.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  10. #30
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Means that first scale up the QGraphicsTextItem and then insert the scaled image?

    Qt doesn't scale things up on its own. If it scales something up it is only because you tell it to.
    How did I this? Is it this line?: textItem->setScale(3);

  11. #31
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Quote Originally Posted by stefan-koch View Post
    Means that first scale up the QGraphicsTextItem and then insert the scaled image?
    No. Put the original image, don't scale it yourself.

    How did I this? Is it this line?: textItem->setScale(3);
    This scales up, not down.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  12. #32
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    This scales up, not down.
    You mean that?: textItem->setScale(0.2);

    What's with the text inside of the TextItem?
    Last edited by stefan-koch; 19th November 2010 at 14:33.

  13. #33
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Thank you high_flyer and wysota for your numerous present answers!

    Note: The text and image inside of the QGraphicsTextItem should be independend of each other when scaling.

    Is this possible with standard methods? Or is complex code needed? If yes, where to start?
    Thanks.

  14. #34
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    It depends what you really mean by "independant". If they are really to be independant then they should not be the same item.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  15. #35
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    independend should mean:
    - the text and image is in one QGraphicsTextItem (not the text in a QGraphicsTextItem and the image in a QGraphicsPixmapItem)
    - the image is sepaeratley scalable from the text, just both are in the same item

    See screenshots snapshot1.png and snapshot2.png as example with openoffice

    snapshot1.png shows you the image in openoffice inserted into the text ("As Character")
    I think this is like a QGraphicsTextItem with a inserted QImage
    snapshot2.png shows you the image in openoffice fixed to the page ("To Page")
    I think this is like a QGraphicsPixmapItem fixed to the QGraphicsView and text in a QGraphicsTextItem (or anything outside of QGraphics... classes)

    In my case the image should be fixed to the text. And the image should be zoomable.
    Is this possible?
    Attached Images Attached Images

  16. #36
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Your examples from open office probably treat the picture and the text as two separate items that are groupped together within a third item. You can follow the same pattern here. To be honest I don't see your problem. Open Office doesn't scale down your image anywhere, it operates on the original image everywhere and that's what you should do too.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. #37
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Hmm, can I do that with one item or need I three, too?
    How would you proceed? Working again with QGraphicsTextItem or with QGraphicsItem, or with ...?

    Look into attached screenshot.
    Attached Images Attached Images
    Last edited by stefan-koch; 20th November 2010 at 16:41.

  18. #38
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    I don't even know what you are doing I probably wouldn't use Graphics View here at all, I don't see any benefits.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #39
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    But if I use QGraphicsView, there is a problem

    See last openoffice screenshot
    teIMAGEst
    What is if the user want edit the "te" before the IMAGE?
    Would GraphicsView automatically set a new position for the IMAGE?

  20. #40
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Why aren't you simply using QTextDocument with your own document layout (if needed)?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QGraphicsTextItem - setHTML()
    By Claymore in forum Qt Programming
    Replies: 7
    Last Post: 17th September 2009, 09:34
  2. QGraphicsRectItem and QGraphicsTextItem.
    By cydside in forum Qt Programming
    Replies: 13
    Last Post: 20th July 2009, 12:11
  3. QGraphicsTextItem in a Widget ,Is it Possible ??
    By salmanmanekia in forum Qt Programming
    Replies: 10
    Last Post: 28th July 2008, 13:45
  4. QValidator for QGraphicsTextItem
    By arjunasd in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 15:34
  5. QGraphicsTextItem - is it a bug there?
    By Tair in forum Qt Programming
    Replies: 5
    Last Post: 18th October 2006, 08:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.