Results 1 to 6 of 6

Thread: Filling QPixmap from an unsigned short array? QPixmap size limitations?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2006
    Posts
    160
    Thanks
    33
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Filling QPixmap from an unsigned short array? QPixmap size limitations?

    Hello and thanks for replying ^^

    Jacek:
    i can't use the QPixmap::fromWinHBITMAP() method, since the application is not windows only (Photoshop runs on Mac too, and there will probably be a non-plugin version of the application in the nearby future).
    Now i see you suggest me to use OpenGL. I have a few questions about this:
    The application is aimed to be deployed on computers which have reasonable RAM and CPU... However, we can't be sure of the video card. So if i use OpenGL and the user has a "crappy" video card, what will happend?
    About using OpenGL, what do you suggest? Using two OpenGL viewports (2D), and drawing on a "texture" (My knowledge of OpenGL is very low... If you have any suggestions i will appreciate you go further in details ^^)?

    Marcel:
    Your suggestion sounds very nice, so here is a question relative to your answer:
    Let's suppose i have a 1600*1200 picture. i will split it onto 500x500 blocks as you say "to be sure". Then i'll draw those blocks on my graphic scene, but what will happend if the user zoom to the "glued" parts of the blocks? Did you try successfully this? Did some "white lines glitch" appear?

    Thanks again!
    Pierre.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Filling QPixmap from an unsigned short array? QPixmap size limitations?

    As I said, I was drawing on a widget( a QAbstractButton ), so no zooming occurred in my case.

    However, using a QGraphicsView, if the integer distance between the blocks is 0 or the floating point distance is as close as possible to 0 then I tend to believe no background will show through. All I am trying to say is to make the distance between the blocks
    as small as possible ( 0 if you can ).

    I used the (500, 500) size because I had no way of knowing exactly the limitation, so this size seemed reasonable enough. BTW, the effect of large pixmaps is that they are not painted or if you try to paint inside the pixmap something Qt will crash( somewhere in QPaintEngine ).

    Regards

  3. The following user says thank you to marcel for this useful post:

    hickscorp (14th April 2007)

  4. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Filling QPixmap from an unsigned short array? QPixmap size limitations?

    Quote Originally Posted by hickscorp View Post
    i can't use the QPixmap::fromWinHBITMAP() method, since the application is not windows only
    There's also QPixmap::fromMacCGImageRef(), so you could use both. Maybe the Trolls know how to create a QPixmap with arbitrary depth?

    Quote Originally Posted by hickscorp View Post
    So if i use OpenGL and the user has a "crappy" video card, what will happend?
    You are not going to use any 3D stuff, so the only problem might be the maximum texture size.

    Although OpenGL can store textures in RGB16 and RGBA16 formats, it seems that there is no direct way to feed it with such data. Take a look at glDrawPixels() and glTexImage2D(), you might be able to draw one 16bit component at a time and with help of blending you should get original image.

  5. The following user says thank you to jacek for this useful post:

    hickscorp (14th April 2007)

Similar Threads

  1. failing to achieve desired size of a BitField structure
    By nass in forum General Programming
    Replies: 8
    Last Post: 13th February 2007, 13:29
  2. unable to save QCStrings properly in a buffer
    By nass in forum Qt Programming
    Replies: 13
    Last Post: 15th November 2006, 20:49
  3. Tiff in unsigned short
    By spawnwj in forum Qt Programming
    Replies: 14
    Last Post: 26th July 2006, 07:41
  4. How to create QPixmap from unsigned character array?
    By rashidbutt in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 18:25

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.