?
Solved

How to SetPixel from GetBitmapBits ?

Posted on 1999-11-08
1
Medium Priority
?
442 Views
Last Modified: 2013-11-20
I have retrieved the bits of a bitmap into a byte array pBits...
Bits per pixel is 16 and there is only one plane.

Now how do I calculate the RGB value for pixel x,y so that
I may SetPixel (x, y, ???) and get the same color as in the original
bitmap?  I'm hoping this is a straight calculation from pBits rather
than using something like SelectPalette( ).  Please be explicit.
0
Comment
Question by:goldbr02
1 Comment
 
LVL 2

Accepted Solution

by:
Gandalf32 earned 150 total points
ID: 2191802
You normally can't do a straight calculation, because depending on the color depth, the colors may be relative or absolute. In the case of 16 bits per pixel, it is a direct mapping. So if you know for sure this is the color depth the bitmaps will come in, you can map it directly into the palette. You can find examples as CodeGuru (codeguru.developer.com) under bitmaps and palettes.
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Stellar Phoenix SQL Database Repair software easily fixes the suspect mode issue of SQL Server database. It is a simple process to bring the database from suspect mode to normal mode. Check out the video and fix the SQL database suspect mode problem.
Suggested Courses

599 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question