|
So, here is the famous solution, as I promised...
The case with my code was that I called myPath.AddLines(...) which caused an error!
The fact is that path wad drawing properly, i.e. its drawn shape is what I expected, though the path data was corrupted!
The solution was to create a 1x1 rectangle for each of the points (new Rectangle(points[i].X, points[i].Y, 1, 1) ) and then call myPath.AddRectangles(...)
After applying this method both, the drawn image and the hit testing worked just fine!
I hope this helps to someone.
By the way, after spending the entire day I got the solution of iterating through the monochrome (1 bit per pixel) bitmap data and checking if the pixel is black or white!
|
|
|
|
|
There are a lot of image libraries out there that handle converting image bit depths but is there any that solely focus on bit depth conversions?
I need something that can convert from 32bit with alpha to 8bit, 4bit, etc. and vice-versa preferably in C#.
I understand I should probably write these functions myself but it's extremely confusing working with the individual pixels etc. and I know that I could never make it as efficient as something that surely exists out there somewhere. I'm just having a hell of a time finding what I need. Even the image libraries I've found that include functions to convert bit depths convert to grayscale which is not what I need.
Thanks
|
|
|
|
|
hey all...
i've a question in the Photoshop application,
i've a small pic wz resolution 72 pixel/inch ... i wanna increase the resolution so that i can enlarge the pic but everytime i do that the pic gets blured & cant reach a tool 2 help me purify it .. does any1 has an answer 4 that or is it impossible 2 be done ??
thx ...
|
|
|
|
|
right click on the image frame.(i mean the frame at the top of the inserted image,which shows the image 's name.)there is option for image size.change it accordingly and save in appropriate format.
|
|
|
|
|
friendship wrote: i wanna increase the resolution so that i can enlarge the pic
You can't. It will only make the pixels bigger, which is why the picture is blurred. increasing the resolution would either make the picture smaller (to accomodate the higher resolution), or would require more image data if you were to make the picture larger.
Cheers,
Drew.
|
|
|
|
|
Hey frnds
Can any one tell me how to create 8 bit bitmap
thx in advance
Born To Code
|
|
|
|
|
You've asked this before....what part of the process is giving you trouble?
Do you want a device-dependent bitmap, a device-independent bitmap, ...??
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Can u plz explain how to draw 8 bit bitmap using palette.
The bitmap should be of 256 color,
thnaks
|
|
|
|
|
I still don't know what type of bitmap you're using.
You draw 8-bit bitmaps the same as any bitmaps. You can use GetDeviceCaps(RASTERCAPS) to check
if the destination DC is a palette device. If it is, select your palette into it, call
RealizePalette() (usually), and draw the bitmap.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
thank u Sir,
but tell me how to know whether the destination DC is a palette device or not?
if not then how to set.
|
|
|
|
|
rahul.shendurnikar wrote: how to know whether the destination DC is a palette device or not?
if (GetDeviceCaps(hdc, RASTERCAPS) & RC_PALETTE)
{
}
How to set it depends on the device. For a monitor, it's based on the video mode.
For a printer device it's based on the bitmap format selected into the dc. etc...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
hey
my destination DC is not a palette device.
destination DC is my Monitor.
Can u plz send me code snipet which create 8 bit bitmap usning palette.
the palette aaray should be.....
static int ARGB[256][3] =
{
{0,0,0}, //0
{48,0,0}, //1
{48,48,48}, //2
{0,16,16}, //3
{32,32,32}, //4
{16,16,16}, //5
{0,48,0}, //6
{48,48,0}, //7
{0,48,48}, //8
{0,16,16}, //9
{80,80,80}, //10
{96,96,96}, //11
{96,96,96}, //12
{112,112,112}, //13
{128,128,128}, //14
{144,144,144}, //15
{160,160,160}, //16
{160,160,160}, //17
{176,176,176}, //18
{192,192,192}, //19
{208,208,208}, //20
{208,208,208}, //21
{208,208,208}, //22
{224,224,224}, //23
{224,224,224}, //24
{224,224,224}, //25
{240,240,240}, //26
{96,48,48}, //27
{96,48,0}, //28
{96,0,0}, //29
{96,0,96}, //30
{96,48,96}, //31
{160,0,96}, //32
{160,48,96}, //33
{160,0,32}, //34
{160,48,48}, //35
{160,48,0}, //36
{160,0,0}, //37
{160,96,96}, //38
{160,96,48}, //39
{160,96,0}, //40
{208,0,96}, //41
{208,48,96}, //42
{208,96,96}, //43
{208,96,0}, //44
{208,96,48}, //45
{208,48,48}, //46
{208,48,0}, //47
{208,0,0}, //48
{240,96,96}, //49
{240,0,112}, //50
{240,48,96}, //51
{240,0,96}, //52
{240,96,48}, //53
{240,96,0}, //54
{240,16,32}, //55
{240,80,80}, //56
{240,0,0}, //57
{240,128,128}, //58
{240,160,160}, //59
{240,160,160}, //60
{240,160,208}, //61
{240,96,208}, //62
{240,96,240}, //63
{224,16,208}, //64
{224,16,208}, //65
{240,0,176}, //66
{240,0,160}, //67
{240,48,160}, //68
{240,96,160}, //69
{208,0,144}, //70
{208,0,160}, //71
{208,48,160}, //72
{208,96,160}, //73
{240,0,208}, //74
{208,96,208}, //75
{208,0,208}, //76
{208,96,208}, //77
{208,48,208}, //78
{240,0,240}, //79
{240,48,240}, //80
{240,160,240}, //81
{240,208,240}, //82
{208,160,96}, //83
{208,160,48}, //84
{208,160,0}, //85
{208,160,48}, //86
{208,160,160}, //87
{240,208,160}, //88
{240,208,160}, //89
{240,208,192}, //90
{240,208,208}, //91
{208,160,208}, //92
{176,160,144}, //93
{208,208,160}, //94
{208,208,160}, //95
{208,208,160}, //96
{240,240,208}, //97
{240,240,208}, //98
{96,96,0}, //99
{96,96,48}, //100
{0,96,0}, //101
{48,96,0}, //102
{0,96,48}, //103
{48,96,48}, //104
{0,128,0}, //105
{96,160,48}, //106
{96,160,96}, //107
{48,160,96}, //108
{0,160,96}, //109
{0,160,48}, //110
{48,160,48}, //111
{48,160,0}, //112
{0,160,0}, //113
{48,208,0}, //114
{0,208,0}, //115
{96,208,0}, //116
{96,208,96}, //117
{96,208,96}, //118
{0,208,48}, //119
{48,208,48}, //120
{96,208,48}, //121
{0,208,96}, //122
{48,208,96}, //123
{0,240,0}, //124
{96,240,96}, //125
{48,240,48}, //126
{48,240,96}, //127
{0,240,96}, //128
{96,240,48}, //129
{96,240,0}, //130
{160,240,0}, //131
{160,240,48}, //132
{160,240,96}, //133
{192,224,192}, //134
{176,224,192}, //135
{176,224,192}, //136
{208,240,208}, //137
{208,240,0}, //138
{208,240,48}, //139
{208,240,96}, //140
{240,208,96}, //141
{240,208,48}, //142
{240,208,0}, //143
{128,128,0}, //144
{160,160,48}, //145
{160,160,64}, //146
{160,160,96}, //147
{176,192,0}, //148
{208,208,48}, //149
{208,208,96}, //150
{160,208,48}, //151
{160,208,96}, //152
{160,208,96}, //153
{160,208,0}, //154
{160,208,96}, //155
{240,160,96}, //156
{240,160,48}, //157
{240,160,0}, //158
{160,240,160}, //159
{240,240,0}, //160
{240,240,96}, //161
{240,240,48}, //162
{224,224,0}, //163
{160,240,160}, //164
{0,240,160}, //165
{48,240,160}, //166
{96,240,160}, //167
{48,240,160}, //168
{0,240,160}, //169
{48,208,160}, //170
{0,208,160}, //171
{0,208,160}, //172
{48,208,160}, //173
{96,208,160}, //174
{176,176,144}, //175
{48,96,96}, //176
{0,96,96}, //177
{0,128,128}, //178
{0,160,160}, //179
{96,160,160}, //180
{48,240,208}, //181
{0,240,208}, //182
{160,240,208}, //183
{0,208,208}, //184
{48,208,208}, //185
{96,208,208}, //186
{0,192,208}, //187
{160,240,240}, //188
{96,240,240}, //189
{0,240,240}, //190
{48,240,240}, //191
{96,240,240}, //192
{208,240,240}, //193
{208,240,240}, //194
{160,208,240}, //195
{160,208,240}, //196
{208,208,240}, //197
{160,160,208}, //198
{208,0,240}, //199
{208,160,240}, //200
{160,48,208}, //201
{160,0,208}, //202
{160,96,208}, //203
{208,96,240}, //204
{208,48,240}, //205
{176,80,192}, //206
{160,96,160}, //207
{160,0,160}, //208
{160,48,160}, //209
{128,0,128}, //210
{160,48,240}, //211
{160,0,240}, //212
{160,96,240}, //213
{96,0,160}, //214
{96,48,160}, //215
{48,0,96}, //216
{0,0,96}, //217
{0,48,96}, //218
{48,48,96}, //219
{0,0,112}, //220
{0,0,112}, //221
{0,0,128}, //222
{160,160,240}, //223
{48,48,160}, //224
{0,0,160}, //225
{0,48,160}, //226
{48,0,160}, //227
{48,96,160}, //228
{96,96,160}, //229
{0,96,208}, //230
{48,96,208}, //231
{0,0,208}, //232
{96,48,208}, //233
{48,48,208}, //234
{0,48,208}, //235
{0,0,240}, //236
{96,0,240}, //237
{96,96,240}, //238
{0,96,240}, //239
{96,48,240}, //240
{48,48,240}, //241
{48,96,240}, //242
{96,96,208}, //243
{96,160,240}, //244
{48,160,240}, //245
{0,160,240}, //246
{96,160,224}, //247
{96,160,224}, //248
{0,160,208}, //249
{96,160,208}, //250
{48,160,208}, //251
{0,192,224}, //252
{0,208,240}, //253
{48,208,240}, //254
{96,208,240} //255
};
thanks in advance..
|
|
|
|
|
Given your palette, here's one way:
LONG lImageWidth = 320;
LONG lImageHeight = 240;
WORD wBitsPerPixel = 8;
LONG lBytesPerRow = (((lImageWidth * (long)wBitsPerPixel + 31L) & (~31L)) / 8L);
BITMAPINFO *pbmi = (BITMAPINFO *)new BYTE[sizeof(BITMAPINFO) + sizeof(RGBQUAD) * 255];
memset(pbmi, 0, sizeof(BITMAPINFO));
pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pbmi->bmiHeader.biWidth = lImageWidth;
pbmi->bmiHeader.biHeight = lImageHeight;
pbmi->bmiHeader.biPlanes = 1;
pbmi->bmiHeader.biBitCount = wBitsPerPixel;
pbmi->bmiHeader.biCompression = BI_RGB;
pbmi->bmiHeader.biSizeImage = lBytesPerRow * lImageHeight;
for (int i = 0; i < 256; i++)
{
pbmi->bmiColors[i].rgbBlue = (BYTE)ARGB[i][2];
pbmi->bmiColors[i].rgbGreen = (BYTE)ARGB[i][1];
pbmi->bmiColors[i].rgbRed = (BYTE)ARGB[i][0];
pbmi->bmiColors[i].rgbReserved = 0;
}
BYTE* pBitmapBits;
HDC hdc = ::GetDC(0);
HBITMAP hBitmap = ::CreateDIBSection(hdc, pbmi, DIB_RGB_COLORS, &pBitmapBits, NULL, 0);
::ReleaseDC(0, hdc);
if (hBitmap)
{
memset(pBitmapBits, 0, pbmi->bmiHeader.biSizeImage);
...
...
::DeleteObject(hBitmap);
delete[] (BYTE *)pbmi;
}
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thank u so much...
Born To Code
|
|
|
|
|
Hi All,
I am facing quite starnce problem.I am Capturing Audio Stream from TV Tuner Card and Play Back using DirectShow.First Time its work fine.But When i stop the filter graph or exit the application and again tried to restart it.The Audio is not captured.But After resttating my machine (PC) it again work fine.
Please let me know where i am wromg.
Thaks in Advance.
|
|
|
|
|
hey everybody...
I hope someone can help me caus I'm trying to implement this cube mapping thing for two days now...
I've been to all those websites...
There must be some small mistake in my code and I just can't find it...
<br />
...<br />
(InitGL)<br />
CubeMappingAvailable = CheckOpenGLExtension("GL_ARB_texture_cube_map");<br />
<br />
myTextureLoader.LoadCubeMap("right.jpg",<br />
"left.jpg",<br />
"bottom.jpg",<br />
"top.jpg",<br />
"front.jpg",<br />
"back.jpg",<br />
&myCubeMap);<br />
<br />
<br />
glGenTextures(1, &dest->TextureID);<br />
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, dest->TextureID);<br />
<br />
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);<br />
glTexParameteri(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);<br />
<br />
LoadFromFile(fileRight, &dest->right, 1);
LoadFromFile(fileLeft, &dest->left, 2);<br />
LoadFromFile(fileTop, &dest->top, 3);<br />
LoadFromFile(fileBottom, &dest->bottom, 4);<br />
LoadFromFile(fileFront, &dest->front, 5);<br />
LoadFromFile(fileBack, &dest->back, 6);<br />
<br />
<br />
(...)<br />
glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);<br />
glTexParameterf(GL_TEXTURE_CUBE_MAP_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR);<br />
<br />
glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB+(cube-1),<br />
0,<br />
components,<br />
pTexture->Width,<br />
pTexture->Height,<br />
0,<br />
pTexture->Type,<br />
GL_UNSIGNED_BYTE,<br />
pImgData);<br />
<br />
glDisable(GL_TEXTURE_2D);<br />
glEnable(GL_TEXTURE_CUBE_MAP_ARB);<br />
glEnable(GL_TEXTURE_GEN_S);<br />
glEnable(GL_TEXTURE_GEN_T);<br />
glEnable(GL_TEXTURE_GEN_R);<br />
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, desCube->TextureID);<br />
<br />
<br />
glDisable(GL_TEXTURE_GEN_S);<br />
glDisable(GL_TEXTURE_GEN_T);<br />
glDisable(GL_TEXTURE_GEN_R);<br />
glDisable(GL_TEXTURE_CUBE_MAP_ARB);<br />
Sorry for not posting more... but I think It's more a general mistake and I put everything in different classes and methods, so posting more might make everything more complicated...
thanx in advance
zqueezy
|
|
|
|
|
damn, I found it finally...
I had to add:
<br />
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);<br />
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);<br />
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP_EXT);<br />
after glTexImage2D
I cannot see really why, and many tuts left that out...
|
|
|
|
|
i want to work on PABX Exchange but i dont have any idea about this, is there any built in API or Serial Classes in VB.NET can any one tell me about this how should i work on it
syed imran azmat
|
|
|
|
|
So, what does this have to do with Graphics? You may want to Google for "PABX VB.NET" for examples and discussions.
|
|
|
|
|
Hey Friends,
I want to Convert 32 bit Bitmap tp 8 bit bitmap.
Here i have to used palette.
CAn any body tell me abt this conversion and about palete.
Thanks in advance.
Born To Code
|
|
|
|
|
See here[^]
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
please someone can let me know how i can capture data from FM tuner card.
either using windows wave APIs, directShow or directSound.
Thanks in Advance
|
|
|
|
|
Have you tried searching for "audio capture" articles here at CodeProject?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi. I have always wanted to create custom themes/skins for WindowsXP and i recently downloaded WindowBlinds to do just that. I decided to delete it but instead want to know how to actually apply a skin (theme) to a single application. WindowBlinds can do it but i'm not sure how and i don't like the idea of a program messing around with my system files. I thought that i could create a file (.theme or .msstyle ?) and apply it. Does anyone know how to or more importantly where i could find how to do it. Just to be clear, i only want to skin one application not the whole desktop.
thanx
Customer in computer shop: "Can you copy the Internet onto this disk for me?"
|
|
|
|
|
I'm looking for a technique to embed an avi movie and a jpg image in the same space upon an onclick command for one or the other. I have the script to do either but need to be able to do both.
thanks,
brucedw
|
|
|
|
|