|
Hello folks!
I got an annoying anomaly with GDI+ i just can't understand. I created a 32 bit bitmap in memory, did some drawing on it and used it to display a layered window. This all works well except for one thing. I use Gdipluss::Graphics::DrawString to render some text onto this bitmap which seems to erase the alpha channel on the bitmap everywhere where letters of the text are drawn. Here's the simplified code i use:
...
Gdiplus::Graphics Gx(MemDC);
Gdiplus::SolidBrush GxTextBrush(Gdiplus::Color(0, 0, 0));
Gdiplus::Font GxFont(MemDC, &LFont);
Gdiplus::RectF TextRect;
Gdiplus::StringFormat GxFormat;
Gx.DrawString(text, textlength, &GxFont, TextRect, &GxFormat, &GxTextBrush);
...
Changing the GxTextBrush 's color by adding an alpha component of 254 "fixes" the problem, but adding 255 produces the holes again, also making the font bold (LFont.lfWeight = FW_BOLD ) seems to fix the problem also... so could someone please tell me what's the logic behind this? For now i set the alpha to 254 and go on with it...
Thanks for any light-sheding attempts in advance.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi,
I want to send a request to execute a http link which is running in another machine.how to do this using?Is there any function in MFC or SDK? anyone please help me?
thanks,
|
|
|
|
|
|
What do you mean by "execute"?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
I want to send a request to another system to run a URL.I tried with following code. Its showing error like URL is invalid. But im able to open that URL from my machine.But not able to open that URL using this code.
CInternetSession objInetSession;
CHttpConnection *objhttp ;
CHttpFile *objFile;
char szURL[100];
while(1)
{
objhttp = objInetSession.GetHttpConnection ("http:////101.16.0.42/test/prelogin.aspx", INTERNET_FLAG_MAKE_PERSISTENT, INTERNET_INVALID_PORT_NUMBER,
NULL, NULL);
try
{
wsprintf(szURL,"%s","http:////101.16.0.242/test/prelogin.aspx");
CStdioFile* objStdFile = objInetSession.OpenURL(szURL,1,INTERNET_FLAG_TRANSFER_ASCII,NULL,0);
}
catch(CInternetException* exp)
{
exp->ReportError(MB_OK,0);
}
}
modified on Thursday, April 8, 2010 1:29 AM
|
|
|
|
|
1. '/' is not an escape character so your url should be "http://101.16.0.42/..." not http:////...
2. Depending on what that the script at that url does, what you're trying to do might or might not work. Read about the HTTP protocolhere
in very simple terms, when using a http connection, you're making a request (that might contain some parameters - see GET/POST methods) and you receive a response - the html code that you see in your browser
I hope this helps 
|
|
|
|
|
|
Hello!
I tried to compile a library with VC++ 2008.
However I get a compiler error which I don't understand - which only occurs in .c-Files:
struct MV_Vector_
{
enum ref_type { ref = 1 };
};
The enum leads to the error C2208 ('ref_type' : no members defined using this type).
What is wrong with the code? Any ideas how to work that around?
Thank you in advance,
Alex
|
|
|
|
|
Try it :
struct MV_Vector_{
enum ref_type { ref = 1 } eref_member;
};
virtual void BeHappy() = 0;
|
|
|
|
|
|
that's not standard C.You have to also declare a variable
|
|
|
|
|
That's not C .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hai,
Is there any maximum limit for the char array
Thanks in Advance
|
|
|
|
|
jannathali wrote: Is there any maximum limit for the char array
What do you mean, exactly?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Is there any limit for the array size.
i.e char a[Max_Value];
Is there a limit for this value
Or i can give any big value like char a[40000]; etc
|
|
|
|
|
If you're declaring it local to a function, the size is limited by the available stack space.
If you're declaring it globally, the size is limited by the data section size.
|
|
|
|
|
You may have such big values (why don't you try?).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In most of the cases (but there are some few exceptions), when you have to ask yourself such a question, it probably means that you have taken a bad design decision.
|
|
|
|
|
|
Hello Friends
I am using namespace MSXML in my application to traverse and read XML file.But I have some confusion regarding MSXML is that this one is related to c++ DOM APIs na? And what its relation with COM?
And these both COM AND DOM are provoding different APIs?and then what is DCOM?
Please Suggest me something.I am too confused.
Thanks & Regards
Yogesh
modified on Wednesday, April 7, 2010 2:55 AM
|
|
|
|
|
Roughly speaking, DOM is just a way of representing (and accessing) the XML document (see [^] for a better definition).
There are many libraries dealing with XML documents and some of them, such as MSXML , implement DOM .
Incidentally MSXML is COM (see [^]) based, but that is a mere technological choice. When you use MSXML library, you deal with COM objects representing the corrensponding DOM ones (ADO library shows a similar approach, it exposes an object model for databases: every database object, such as, for instance, the recordset, is a COM one).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I have a bunch of DXT5 DDS files, but information on the format is so sparse I have no idea how to write something to convert them. I have the following code as part of a library and this converts it to a format I can use, but I can't understand what I need to change to make it read the files as big endian.
If anyone could at least explain how the the *src variable is being used so I could determine where I need to convert stuff that would help, I currently don't get how values are being derived from it.
vlBool CVTFFile::DecompressDXT5(vlByte *src, vlByte *dst, vlUInt uiWidth, vlUInt uiHeight)
{
vlUInt x, y, i, j, k, Select;
vlByte *Temp;
Colour565 *color_0, *color_1;
Colour8888 colours[4], *col;
vlUInt bitmask, Offset;
vlByte alphas[8], *alphamask;
vlUInt bits;
vlByte nBpp = 4;
vlByte nBpc = 1;
vlUInt iBps = nBpp * nBpc * uiWidth;
Temp = src;
for (y = 0; y < uiHeight; y += 4)
{
for (x = 0; x < uiWidth; x += 4)
{
alphas[0] = Temp[0];
alphas[1] = Temp[1];
alphamask = Temp + 2;
Temp += 8;
color_0 = ((Colour565*)Temp);
color_1 = ((Colour565*)(Temp+2));
bitmask = ((vlUInt*)Temp)[1];
Temp += 8;
colours[0].r = color_0->nRed << 3;
colours[0].g = color_0->nGreen << 2;
colours[0].b = color_0->nBlue << 3;
colours[0].a = 0xFF;
colours[1].r = color_1->nRed << 3;
colours[1].g = color_1->nGreen << 2;
colours[1].b = color_1->nBlue << 3;
colours[1].a = 0xFF;
colours[2].b = (2 * colours[0].b + colours[1].b + 1) / 3;
colours[2].g = (2 * colours[0].g + colours[1].g + 1) / 3;
colours[2].r = (2 * colours[0].r + colours[1].r + 1) / 3;
colours[2].a = 0xFF;
colours[3].b = (colours[0].b + 2 * colours[1].b + 1) / 3;
colours[3].g = (colours[0].g + 2 * colours[1].g + 1) / 3;
colours[3].r = (colours[0].r + 2 * colours[1].r + 1) / 3;
colours[3].a = 0xFF;
k = 0;
for (j = 0; j < 4; j++)
{
for (i = 0; i < 4; i++, k++)
{
Select = (bitmask & (0x03 << k*2)) >> k*2;
col = &colours[Select];
if (((x + i) < uiWidth) && ((y + j) < uiHeight)) {
Offset = (y + j) * iBps + (x + i) * nBpp;
dst[Offset + 0] = col->r;
dst[Offset + 1] = col->g;
dst[Offset + 2] = col->b;
}
}
}
if (alphas[0] > alphas[1])
{
alphas[2] = (6 * alphas[0] + 1 * alphas[1] + 3) / 7;
alphas[3] = (5 * alphas[0] + 2 * alphas[1] + 3) / 7;
alphas[4] = (4 * alphas[0] + 3 * alphas[1] + 3) / 7;
alphas[5] = (3 * alphas[0] + 4 * alphas[1] + 3) / 7;
alphas[6] = (2 * alphas[0] + 5 * alphas[1] + 3) / 7;
alphas[7] = (1 * alphas[0] + 6 * alphas[1] + 3) / 7;
}
else
{
alphas[2] = (4 * alphas[0] + 1 * alphas[1] + 2) / 5;
alphas[3] = (3 * alphas[0] + 2 * alphas[1] + 2) / 5;
alphas[4] = (2 * alphas[0] + 3 * alphas[1] + 2) / 5;
alphas[5] = (1 * alphas[0] + 4 * alphas[1] + 2) / 5;
alphas[6] = 0x00;
alphas[7] = 0xFF;
}
bits = *((int*)alphamask);
for (j = 0; j < 2; j++)
{
for (i = 0; i < 4; i++)
{
if (((x + i) < uiWidth) && ((y + j) < uiHeight)) {
Offset = (y + j) * iBps + (x + i) * nBpp + 3;
dst[Offset] = alphas[bits & 0x07];
}
bits >>= 3;
}
}
bits = *((int*)&alphamask[3]);
for (j = 2; j < 4; j++)
{
for (i = 0; i < 4; i++)
{
if (((x + i) < uiWidth) && ((y + j) < uiHeight)) {
Offset = (y + j) * iBps + (x + i) * nBpp + 3;
dst[Offset] = alphas[bits & 0x07];
}
bits >>= 3;
}
}
}
}
return vlTrue;
}
|
|
|
|
|
do you have a type definition for v1Byte ?
(assuming its just 'byte' could be dangerous)
I am formulating a longer response, I just want to be careful in how I frame it
'g'
|
|
|
|
|
|
Just convert your src sequence
(with the length in bytes = uiWidth * uiHeight )
into the Intel-format (by granularity of DWORD )
at the beginning of the function...
virtual void BeHappy() = 0;
|
|
|
|