Click here to Skip to main content
16,004,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Load Bitmap Pin
surfman1915-May-06 8:25
surfman1915-May-06 8:25 
GeneralRe: Load Bitmap Pin
Chris Losinger15-May-06 8:30
professionalChris Losinger15-May-06 8:30 
GeneralRe: Load Bitmap Pin
surfman1915-May-06 8:39
surfman1915-May-06 8:39 
GeneralRe: Load Bitmap Pin
Chris Losinger15-May-06 8:44
professionalChris Losinger15-May-06 8:44 
GeneralRe: Load Bitmap Pin
surfman1915-May-06 9:00
surfman1915-May-06 9:00 
GeneralRe: Load Bitmap Pin
surfman1915-May-06 9:07
surfman1915-May-06 9:07 
QuestionHELP Needed: MATLAB in MSVC environment Pin
UJ_Student15-May-06 6:35
UJ_Student15-May-06 6:35 
QuestionWorking with 8bpp Images Pin
1980soyo15-May-06 6:30
1980soyo15-May-06 6:30 
Hi. I am writing picture editor which will work with all file types, that are used by Bitmap class. The program will use filters and other functions that will be alterring image.

I wrote a function to check if everything is ok and I can go on with my work, but I came to a problem.

The function below is just inverting pixels in Image and it works well... but only with 24Bpp>= images. What do I have to do, so that it will work with 8 and 16 Bpp Images ?

Thank you for any help!


Bitmap * bitmap.

{
UINT* pixels;
BitmapData bitmapData;
Rect rect(0, 0, pImg->GetWidth(), pImg->GetHeight());

pImg->LockBits(
&rect,
ImageLockModeWrite | ImageLockModeRead,
PixelFormat24bppRGB ,
&bitmapData);

pixels = (UINT*)bitmapData.Scan0;

int stride = bitmapData.Stride;
byte * p = (byte *)(void *)pixels;
int nOffset = stride - pImg->GetWidth() *3;
int nWidth = pImg->GetWidth() * 3;
for(int y=0;y < pImg->GetHeight();++y)
{
for(int x=0; x < nWidth; ++x )
{
p[0] = (byte)(255-p[0]);
++p;
}
p += nOffset;
}
pImg->UnlockBits(&bitmapData);
}

Cheers!
AnswerRe: Working with 8bpp Images Pin
includeh1015-May-06 6:46
includeh1015-May-06 6:46 
GeneralRe: Working with 8bpp Images Pin
1980soyo15-May-06 8:13
1980soyo15-May-06 8:13 
Questionfopen_s problem Pin
big_denny_20015-May-06 6:12
big_denny_20015-May-06 6:12 
AnswerRe: fopen_s problem Pin
led mike15-May-06 6:19
led mike15-May-06 6:19 
AnswerRe: fopen_s problem Pin
Joe Woodbury15-May-06 7:38
professionalJoe Woodbury15-May-06 7:38 
GeneralRe: fopen_s problem Pin
big_denny_20015-May-06 7:59
big_denny_20015-May-06 7:59 
GeneralRe: fopen_s problem Pin
Joe Woodbury15-May-06 8:14
professionalJoe Woodbury15-May-06 8:14 
GeneralRe: fopen_s problem Pin
big_denny_20015-May-06 8:30
big_denny_20015-May-06 8:30 
GeneralRe: fopen_s problem Pin
David Crow15-May-06 8:35
David Crow15-May-06 8:35 
GeneralRe: fopen_s problem Pin
Joe Woodbury15-May-06 8:36
professionalJoe Woodbury15-May-06 8:36 
AnswerRe: fopen_s problem Pin
David Crow15-May-06 8:10
David Crow15-May-06 8:10 
GeneralRe: fopen_s problem Pin
big_denny_20015-May-06 8:13
big_denny_20015-May-06 8:13 
GeneralRe: fopen_s problem Pin
Joe Woodbury15-May-06 8:18
professionalJoe Woodbury15-May-06 8:18 
GeneralRe: fopen_s problem Pin
Joe Woodbury15-May-06 8:17
professionalJoe Woodbury15-May-06 8:17 
GeneralRe: fopen_s problem Pin
David Crow15-May-06 8:23
David Crow15-May-06 8:23 
AnswerRe: fopen_s problem Pin
Michael Dunn15-May-06 8:44
sitebuilderMichael Dunn15-May-06 8:44 
Questionnetwork programming! Pin
farshad.f15-May-06 5:22
farshad.f15-May-06 5:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.