Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Brainstorm
  4. Transparency in Index8 QImage
Forum Updated to NodeBB v4.3 + New Features

Transparency in Index8 QImage

Scheduled Pinned Locked Moved Brainstorm
3 Posts 1 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    GusLott
    wrote on last edited by
    #1

    I've got grayscale image data coming from a streaming firewire camera for a scientific application. I'm trying to overlay images with one another in a widget. I've created a 256 gray level colormap for the indexed image, etc. I can draw them just fine in the paintEvent method of the widget.

    Is there an easy way to easily set the alpha blending for the whole image so that I can see through the image to whatever is behind?

    I'm trying to allow the user to stitch images from side-by-side cameras visually.

    Thoughts?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GusLott
      wrote on last edited by
      #2

      @QVector<QRgb> colorTable;
      for (int i = 0; i < 256; i++)
      colorTable.push_back(QColor(i, i, i,128).rgba());@

      That seems to create a 50% transparent grayscale index for the colormap of the image. Pretty easy, it seems. Does that track?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GusLott
        wrote on last edited by
        #3

        I have a follow on question about data sharing and a QImage.

        If I create the QImage from a pointer to a unsigned char in memory (and a width and height argument), is it possible to change the pointer withing deleting and re-creating the QImage? Data sharing seems to say that it doesn't copy the data until you try to write to it (which I won't do).

        I have a circular frame buffer of images that are being filled by the camera. In my paintevent method, i'm currently creating and destroying qimages.. Would it be faster to re-assign the memory location to the image data? Is that possible once the qimage has been created?

        I'm new to the use of this data structure and want to make sure I'm using it as intended.

        Thanks!

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved