 |
|
 |
There Is "ScanLine" in Delphi7...
I can use it to accelerate working with pixels up to 40 times...
How can I use Get/Set BitmapBits as ScanLine from Delphi7 in C++ ?
P.S. Sorry for bad English... :(
|
|
|
|
 |
|
 |
Sorry, it was just a silly question from a student...
ScanLine returns a pointer to the first element of line (to the bitmap bits in memory)...
I think I can do this with "struct tagBITMAP.bmBits" and GetObject...
P.S. Sorry for bad English... Again... :(
|
|
|
|
 |
|
 |
i want to send bitmap to another terminal throught socket can any bady help me??? i have alredy send bitmap by sending bitmap file but now i want to send bitmap whitihn in memory that bitmap i have created...
|
|
|
|
 |
|
 |
hiii...
Firstly i am also dont know how can i send bitmap from socket but after donig some aferts i have done it my company.
Firstly i am sorry for my English spelling mitchmatch..
U have to convert your Divece depadent bitmap to Device Indipadent Bitmap.
Then Fill the Struct BITMAPINFO and take a pointer to it.
When sending bitmap to socket specifie pointer and give size of BITMAPINFO plus pixel data size.
At Receiver Simply fill BITMAPINFO and use SetDIBitsToDevice Function in Paint Method or Erasebackground handler. Pass argument as bitmapdata pointer which is stored at end of BITMAPINFO struct Object.
|
|
|
|
 |
|
 |
In MDI application, I want to get pixel value of image under user's line. These pixel value will be used to make Histrogram. How should I do?
Please suggests me.
Thank you in advance.
|
|
|
|
 |
|
 |
For example I have a bitmap(.bmp) I want to read bitmap's 1st pixel or 72nd pixel or other. How I read pixels? How I find pixel's coordinate?
You should to visit this site. http://www.2ncielbilgisayar.com and http://www.crosscable.net
|
|
|
|
 |
|
 |
Some where in the MSDN library it state the the bits returned by GetBitmapBits() are driver dependent and that the driver may use any bit encoding that they wish. Therefore, there is no guarantee that the bits returned by GetBitmapBits() is in a known bitmap format or what format it is using. I have not seen GetBitmapBits() ever return an unkown format but why take the chance when you can use GetDIBits() and SetDIBits() to insure that you are retrieving the bits in a know format.
INTP
|
|
|
|
 |
|
 |
// INFO: General limitations under Win32s
// ID: Q131896
// "This means that an application cannot know the format of the bits
// returned by GetBitmapBits() and should not attempt to directly manipulate
// them."
INTP
|
|
|
|
 |
|
 |
This method might cause a problem with color bitmaps, but not with monochrome bitmaps. The format of the bits for monochrome bitmaps is always the same regardless of the driver. I've found this very useful for simple masking operations that don't use color. If you are already working with a CBitmap than this method is way easier and faster than trying to create a DIB. In other words, good work!
ColoradoKind
|
|
|
|
 |
|
 |
hy, i tryed to do this with the following code, but it does not work (the resulting bitmap is black!
can anybody tell me why? thanx a lot!
CBitmap* CMyToolBar::Convert32BitTo24Bit(CBitmap &bmpBitmap32)
{
BITMAP bit32;
bmpBitmap32.GetBitmap(&bit32);
int nPixels = bit32.bmWidth * bit32.bmHeight;
BYTE* pBits32 = new BYTE[4*nPixels];
BYTE* pBits24 = new BYTE[3*nPixels];
bmpBitmap32.GetBitmapBits(4*nPixels,pBits32);
for (int i = 0, nAlphaCounter = 0; i < 4*nPixels; i++)
{
if( (i+1)%4 == 0)
{
nAlphaCounter++;
}
else
{
pBits24[i-nAlphaCounter] = pBits32[i];
}
}
delete[] pBits32;
delete[] pBits24;
CBitmap* pBitmap24 = new CBitmap;
pBitmap24->CreateBitmap(bit32.bmWidth, bit32.bmHeight,1, 24, NULL);
pBitmap24->SetBitmapBits(3*nPixels, pBits24);
return pBitmap24; //dont forget to delete it!
}
|
|
|
|
 |
|
 |
Hi,
I guess this is about 2 years too late & you fixed this a long time ago, but I'm trying to do the same thing. Looks like your problem is that
delete [] pBits24;
before you create the bitmap.
Thanks for posting the code.
Cheers,
Alan
|
|
|
|
 |
|
 |
I have the same problem /b>
|
|
|
|
 |
|
 |
Hi,
I have a problem:I want to transfer a bitmap over network by useing CSocket Send and Receive function.Everything is fine with Send proces but Receving makes error.I send bitmap as array of bytes.On receiving end I use SetBitmapBits function to set byte from buffer to CBitmap object but something going wrong.Can you send a code for receving bitmap from socket and loading in CBitmap object.
Thank you!
Vedran Custovic
|
|
|
|
 |
|
 |
I have aslo same problem
|
|
|
|
 |
|
 |
hiii...
I am happy that some one has interest in this Que
Firstly i am also dont know how can i send bitmap from socket but after donig some aferts i have done it my company.I can not give U a code but i give U suggetion what U have to do.
Firstly i am sorry for my English spelling mitchmatch..
U have to convert your Divece depadent bitmap to Device Indipadent Bitmap.
Then Fill the Struct BITMAPINFO and take a pointer to it.
When sending bitmap to socket specifie pointer and give size of BITMAPINFO plus pixel data size.
At Receiver Simply fill BITMAPINFO and use SetDIBitsToDevice Function in Paint Method or Erasebackground handler. Pass argument as bitmapdata pointer which is stored at end of BITMAPINFO struct Object.
Hope it will useful for U.
|
|
|
|
 |
|
 |
i have same problem
|
|
|
|
 |
|
|
 |
|
 |
Hi!
I have image data in an unsigned char array, obtained from a binary PGM (Portable Graymap; P5 PGM). I can convert it to byte array and apply the same technique you have used. But the point where I fail is that, I have to load PGM file at runtime, then get its size and then read image from file into unsigned char array. I dont think I can make resource file in this case. How can I make a bitmap from that, and vice versa as well? I have to display it as a bitmap but use it as unsigned char array.
I have read the article about uing FreeImage at CodeProject, but that is not what I need.
|
|
|
|
 |
|
 |
Any reason you are not using GetDIBits and SetDIBits/SetDIBitsToDevice ?
These are the prefered API's to use in WIn 9.x and NT/Win2K/XP
AFAIK
|
|
|
|
 |
|
 |
Its just that i wanted to use the CBitmap class methods.
After going through the GetDIBits and SetDIBits API's , i think they are a better alternative.
Will try to incorporate them in a purely SDK version of the program.
If I am not at my workplace writing code , I am probably at Code Project.
|
|
|
|
 |