Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Using a bitmap created with ms paint

Using a bitmap created with ms paint

Scheduled Pinned Locked Moved C / C++ / MFC
questiongraphics
13 Posts 3 Posters 0 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.
  • B b_girl

    Hey... I have yet another bitmap question. I used MS Paint to create a bitmap, and I recorded the red, green and blue intensities for each colour I used. In my program, I take these intensities and turn it into COLORREF, using RGB(r,g,b). Later on, after the user clicks on part of the bitmap, I determine where the click occurred and what the colour is at that point using GetPixel(..). The COLORREF value returned by GetPixel never matches the original COLORREF value. I have tried re-doing the colours (once again, in ms paint) but it still doesn't work. Are the values that ms paint uses for r g b the same throughout everything?

    T Offline
    T Offline
    Terry ONolley
    wrote on last edited by
    #3

    Is your screen display running at 24-bit color? I think that if your monitor is set to a lower color depth then when your bitmap is BitBltted to the DC it gets dithered down to match your display settings.



    1 Reply Last reply
    0
    • J Jason Henderson

      Did you save the image as a 24 bit bitmap? IF yousaved it as 256 color bitmpa it may have messed some of them up.

      "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

      Jason Henderson
      blog | articles

      B Offline
      B Offline
      b_girl
      wrote on last edited by
      #4

      I didn't see that it could be saved as different types. If I save as 24 bit bitmap as opposed to 256 colour bitmap, will end users of this have problems with the colours like I did? Or should that avoid other people having problems with it as well?

      J 1 Reply Last reply
      0
      • B b_girl

        I didn't see that it could be saved as different types. If I save as 24 bit bitmap as opposed to 256 colour bitmap, will end users of this have problems with the colours like I did? Or should that avoid other people having problems with it as well?

        J Offline
        J Offline
        Jason Henderson
        wrote on last edited by
        #5

        See Terry's post. I would use windows standard colors if possible. You 256 to choose from.

        "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

        Jason Henderson
        blog | articles

        B 1 Reply Last reply
        0
        • J Jason Henderson

          See Terry's post. I would use windows standard colors if possible. You 256 to choose from.

          "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

          Jason Henderson
          blog | articles

          B Offline
          B Offline
          b_girl
          wrote on last edited by
          #6

          Yeah, I read his post. It was set at 16 before, but I've switched it to 24-bit. I have the colours on my bitmap all sorted out now, it all works just fine. But I'm scared that there will be problems with end users. Are the windows standard colours the 24-bit? Or is it 32-bit or 256? By using 24 bit, and having everything saved in 24 bit, there shouldn't be any problems with people using it who are using more colour right? (just the people using less colour would run into a problem I suppose)

          J 1 Reply Last reply
          0
          • B b_girl

            Yeah, I read his post. It was set at 16 before, but I've switched it to 24-bit. I have the colours on my bitmap all sorted out now, it all works just fine. But I'm scared that there will be problems with end users. Are the windows standard colours the 24-bit? Or is it 32-bit or 256? By using 24 bit, and having everything saved in 24 bit, there shouldn't be any problems with people using it who are using more colour right? (just the people using less colour would run into a problem I suppose)

            J Offline
            J Offline
            Jason Henderson
            wrote on last edited by
            #7

            I would guess that most users would have 16 bit color or higher selected. If you do use a 24bit color bitmap and use a color outside of the windows palete, then that color will not display correctly and your GetPixel will fail. If you confine you colors to the defaut windows palete, you shouldn't have any problem.

            "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

            Jason Henderson
            blog | articles

            B 1 Reply Last reply
            0
            • J Jason Henderson

              I would guess that most users would have 16 bit color or higher selected. If you do use a 24bit color bitmap and use a color outside of the windows palete, then that color will not display correctly and your GetPixel will fail. If you confine you colors to the defaut windows palete, you shouldn't have any problem.

              "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

              Jason Henderson
              blog | articles

              B Offline
              B Offline
              b_girl
              wrote on last edited by
              #8

              what is the default windows palete?

              J 1 Reply Last reply
              0
              • B b_girl

                what is the default windows palete?

                J Offline
                J Offline
                Jason Henderson
                wrote on last edited by
                #9

                Its a list of 256 different colors. You may be able to find them on the web. The colors I setup in that template bitmap I sent you should all be in that palete. Windows does some funky things to the colors in 256 color mode. I really wouldn't worry about it too much though.

                "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

                Jason Henderson
                blog | articles

                B 1 Reply Last reply
                0
                • J Jason Henderson

                  Its a list of 256 different colors. You may be able to find them on the web. The colors I setup in that template bitmap I sent you should all be in that palete. Windows does some funky things to the colors in 256 color mode. I really wouldn't worry about it too much though.

                  "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

                  Jason Henderson
                  blog | articles

                  B Offline
                  B Offline
                  b_girl
                  wrote on last edited by
                  #10

                  I could only get 3 of the elements to actually work properly from that template bitmap you sent me. I tried redoing it, and it works now (I'm reading in r,g,b instead of COLORREF) but it won't work if the display is set at 256 colours. I can't seem to find a list of the 256 colours online or anything, but if I have my settings set at 256 and I redo the template bitmap, it should only allow me to use the 256 colours right? I have grown to dislike different colour settings.

                  J 1 Reply Last reply
                  0
                  • B b_girl

                    I could only get 3 of the elements to actually work properly from that template bitmap you sent me. I tried redoing it, and it works now (I'm reading in r,g,b instead of COLORREF) but it won't work if the display is set at 256 colours. I can't seem to find a list of the 256 colours online or anything, but if I have my settings set at 256 and I redo the template bitmap, it should only allow me to use the 256 colours right? I have grown to dislike different colour settings.

                    J Offline
                    J Offline
                    Jason Henderson
                    wrote on last edited by
                    #11

                    In 256 color mode, Windows will only have 256 colors available fo rthe screen display at one time. If you use too many colors, it will convert them to the closest matching color in the current palete. The screen would look like a rainbow of sorts. Since the template bitmap is selected into a device context that is compatible with the screen, then it will be converted to the same color depth as the screen. There really is no way to control it, but you can make your app use the same color palete in all of its bitmaps and windows, etc. If you use this palette http://www.soc.hawaii.edu/com337/presentations/presentation_04/sld017.htm[^] you should be ok.

                    "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

                    Jason Henderson
                    blog | articles

                    B 1 Reply Last reply
                    0
                    • J Jason Henderson

                      In 256 color mode, Windows will only have 256 colors available fo rthe screen display at one time. If you use too many colors, it will convert them to the closest matching color in the current palete. The screen would look like a rainbow of sorts. Since the template bitmap is selected into a device context that is compatible with the screen, then it will be converted to the same color depth as the screen. There really is no way to control it, but you can make your app use the same color palete in all of its bitmaps and windows, etc. If you use this palette http://www.soc.hawaii.edu/com337/presentations/presentation_04/sld017.htm[^] you should be ok.

                      "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

                      Jason Henderson
                      blog | articles

                      B Offline
                      B Offline
                      b_girl
                      wrote on last edited by
                      #12

                      Is there anywhere to find the r,g,b values of the colours in that palette? Or do I have to just look at that and figure out the values by just trying to match it up as best as I can? I only need 92 distinct colours, and I tried setting my display to 256 thinking that only those 256 colours would be available to me, but it's still adjusting the colour values, so I have no idea what to use as colours anymore.

                      J 1 Reply Last reply
                      0
                      • B b_girl

                        Is there anywhere to find the r,g,b values of the colours in that palette? Or do I have to just look at that and figure out the values by just trying to match it up as best as I can? I only need 92 distinct colours, and I tried setting my display to 256 thinking that only those 256 colours would be available to me, but it's still adjusting the colour values, so I have no idea what to use as colours anymore.

                        J Offline
                        J Offline
                        Jason Henderson
                        wrote on last edited by
                        #13

                        Download a shareware paint program or invest in Paint Shop Pro (www.jasc.com). MS Paint just doesn't cut it. Like I said before, I wouldn't worry about making it compatible with 256 color modes. I don't know anybody that still uses that mode. If they do, they could easily move up to 16 bit.

                        "It is better to remain silent and be thought a fool than to open one's mouth and remove all doubt." - Abraham Lincoln

                        Jason Henderson
                        blog | articles

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups