Announcement

Collapse
No announcement yet.

Recognize Loading BMP 16color/256color/24 bit etc.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Recognize Loading BMP 16color/256color/24 bit etc.

    I use the loadimagex control to load bitmaps, the bitmap is shown on the screen but the quality of the image is not the same if it is a 16 color, 256 color, 24 bit, etc. Nevertheless if I load all them using for instance MSPaint the quality is fine in all cases. What could be the reason I have a distorted image in some cases?
    Regards.

  • #2
    I guess, that there is no automatic SelectPalette hdc ...

    ------------------

    Comment


    • #3
      You will find that BitmapInfoHeader contains most of the information about a bitmap (BitmapInfo includes this plus the colour table). You could therefore look at biBitCount to see the bits per pixel (values= 1,4,8,24) and arrange your program to suit this value. I recommend 'Graphics File Formats' by Kay & Levine, published by McGraw (ISBN 0-07-034025-0) to anybody working with graphics files.
      You can protect your bitmaps from use outside your program by 'corrupting' the header - change the first two bytes of the file to anything, change the extension to another graphics format (I use IMG) and write to CD. No graphics software will be able to load your image. When you want to use it, copy the file the hard drive, change the first two bytes back to BM, then load this uncorrupted image into your program - don't forget to delete the uncorrupted file from the drive when have finished with it. You cannot protect against screen grabs!
      Iain Johnstone

      ------------------
      “None but those who have experienced them can conceive of the enticements of science” - Mary Shelley

      Comment


      • #4
        Thank you guys! But I would insist a little bit.
        In fact I can read the bitmapinfoheader and I now using GetDeviceCaps how is my video, nevertheless I cannot link both information in the control add imagex, it doesn't have configuration parameters.
        regards
        Agustin

        ------------------

        Comment


        • #5
          agustin --
          imagex simply executes loadimage. it's not enough.
          a work with palletes not bad described in petzold's book (v ed.)
          you can see one free translation from this book http://www.powerbasic.com/support/pb...ad.php?t=22632
          format of bmp is described in many places.
          it seems to me easy to register own control (similar http://www.powerbasic.com/support/pb...ad.php?t=17579
          ) and then follow petzold’s samples


          ------------------

          Comment


          • #6
            Thanks Semen. I shall try the code you've sent and modify according to my needs.
            Regards
            Agustin

            ------------------

            Comment

            Working...
            X