|
I want to ask could the point's size be set when I call SetPixel()?
|
|
|
|
|
Do you want to set color of pixels on the screen with SetPixel
|
|
|
|
|
Chen-XuNuo wrote: could the point's size be set when I call SetPixel()?
What point?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Even though CDC::SetPixel takes a logical coordinate, it does not behave like the other drawing primitives in mapping modes (like MM_ISOTROPIC, MM_ANISOTROPIC, MM_HIMETRIC, etc...) in the sense of having a metrically translated "size". CDC::SetPixel will adapt it's coordinates correctly based upon the viewport and window extents (i.e. it's position will scale correctly relative to other drawing primitives like lines, rectangles, circles, and even text) but it will always remain a tiny little "dot" no matter how far you zoom in while the other drawing primitives and text grow.
If you want a logical "dot" to scale, you will likely need to perform a MoveTo/LineTo with the appropriate start and end coordinates or maybe a filled rectangle with no border with the appropriate size or even some blit pattern all defined appropriately in the logical world. Then as you change the viewport and window extents, you will get the effect you are trying to achieve.
However, use this method sparingly since drawing a "dot" to a device context is horribly expensive if your attempting to draw thousands, tens of thousands, or even millions of them as would be the case if your goal is to manipulate a bitmap or something to that effect. If this happens to be the context your in, consider getting the "bits" from a bitmap and working on those strictly in logical coordinates and later "blit" these to a device context to get the effects of the mapping mode metric translations.
Look up MM_ANISOTROPIC and MM_ISOTROPIC in MSDN as these are the most versatile mapping modes available since they don't lock in the viewport and window extents like MM_HIMETRIC, MM_HIENGLISH, and all the rest do.
I may be reading too much into what you asked but my gut reaction to any question regarding SetPixel/GetPixel is to assume the programmer is trying to manipulate bitmap bits as opposed to rendering drawing primitives. Either way, I hope my response helps somehow.
|
|
|
|
|
Wow – overkill. If they ask a question like that I doubt they would understand your answer. I understand the answer, but I really do not understand the question.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
I kinda realized that I was reading way too much into one sentence after I had it all typed out.
But I figured why waste all that typing...
|
|
|
|
|
I understand – I have trouble keeping my answers short too!
But I am learning.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Haha~ ,so many people don't understand my question.What I want to ask is that when I call the SetPixel function,a dot appear in where I click the mouse,and I want to change the size of the dot.
In addition,I explain what function I want to perform.I open a bitmap which content is showing clothes in client area,and I want to get the border of the clothes through drawing manually.So I call the SetPixel in MouseMove to get each point I draw.
If I use MoveTo/LineTo I can't get the each point I draw.I can only get the begin and the end point.
I appreciate your suggestions.
|
|
|
|
|
Chen-XuNuo wrote: What I want to ask is that when I call the SetPixel function,a dot appear in where I click the mouse,and I want to change the size of the dot.
I had a feeling that's what you meant.
You can't change the size of a screen pixel. The size of one pixel on the screen is detemined by
the video resolution set for the monitor. All the pixels for a given resolution are the same
size.
That said, you can only go so small. For bigger "dots" you need to draw a cluster of pixels.
An easy way to do this is in Windows GDI is to use a pen with a thickness the desired size.
I'm not sure what's going wrong with your MoveTo/LineTo code. You'll need to post an example
of how you set up the DC and make the calls so we can better help you.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have developed an Windows socket application. It is being compiled successfully. But when I built it, it shows following errors which are related to winsock2.h file. I have included that file in the Include files path, and also the library file ws2_32.lib is there in the library path. The settings seem to be OK. Then also following error comes.
1>Linking...
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced in function "unsigned long __cdecl GetHostAddress(char const *)" (?GetHostAddress@@YAKPBD@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__send@16 referenced in function "void __cdecl SendString(unsigned int,char const *)" (?SendString@@YAXIPBD@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__closesocket@4 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__recv@16 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__connect@12 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__htons@4 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__socket@12 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>HTTPRequesttry.obj : error LNK2019: unresolved external symbol __imp__WSAStartup@8 referenced in function "int __cdecl SendHTTP(char const *,char const *,unsigned char *,unsigned long,struct HTTPRequest *)" (?SendHTTP@@YAHPBD0PAEKPAUHTTPRequest@@@Z)
1>.\Debug/HTTPRequesttry.exe : fatal error LNK1120: 8 unresolved externals
1>Build log was saved at "file://e:\ProgramFiles2\Microsoft Visual Studio\myprojects\HTTPRequesttry\Debug\BuildLog.htm"
1>HTTPRequesttry - 9 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
If anyone knows the solution please help me.
Thanks for the prompt reply.
Dhaval
|
|
|
|
|
Whats your IDE and your application type if you include Ws2_32.lib (you said included) I think it must works.
|
|
|
|
|
I have also got the same error of LNK2019 and I am using visual studio 2005. I have included ws2_32.lib as he has also done.
How should I proceed if you know.
Thanks for prompt reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
I checked again gethostbyname on the VS2003 and also on the Vs2005 it needs to Winsock2.h if you get this error error LNK2019: unresolved external symbol __imp__gethostbyname@4 referenced you must import ws2_32.lib to Additional Dependencies of your project but if you get gain this error see Michael answer I think it will be solve your problem.
|
|
|
|
|
We use to include ‘WinSock’, but you may want to try including ‘AfxSock’ (Microsoft specific).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
|
hi!
how do i define a callback function with assembly language in asm_ block? (in VC++ project)
Zo.Naderi-Iran
|
|
|
|
|
You will have to be more specific.
BOOL CALLBACK My_EnumWindowsProc(HWND hwnd, LPARAM lParam)
{
__asm
{
...
}
}
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
i add an section to my exe file, then my cods should be asm language.
in code of this section i call myFunc. one of parameters of this function is address of a callback function.
callback function is defined end of asm code (before end of asm block), and i calculate address of this function to send to myFunc function.(correctly)
but my exe encounter "Don't send" error.
how do i return of callback function to main address of code?
for example to call "ExitThread" i return of thread to main address of code
_asm<br />
{<br />
....<br />
push addressOfCallbackFunc<br />
call myFunc<br />
....<br />
jmp End<br />
<br />
CallbackFunc:<br />
....<br />
ret
<br />
End:<br />
}
Zo.Naderi-Iran
|
|
|
|
|
Can any one help me to implememt Client Login Module using X.25 Protocol.
I want to make comnnection between Client and server using X.25 protocol through VC++.
Thx.
-- modified at 12:35 Saturday 14th April, 2007
|
|
|
|
|
Friend me too need de same codings for this..
if u got the coding
pls pls mail me in my id nirmal.atr@gmail.com
|
|
|
|
|
hi
I am using CImage Class(ATL) to Load and Save PNG's.There are some memory leaks with the class.
Are there any alternative image libraries like CxImage etc which can perform the same functionality??
"Every morning I go through Forbes list of 40 richest people in the world. If my name is not in there, I go to work..!!!"
|
|
|
|
|
You was used of CImage class or CXImage calss however you can use of GDI+ for load,save and.. other operations on files
|
|
|
|
|
QuickDeveloper wrote: I am using CImage Class(ATL) to Load and Save PNG's.There are some memory leaks with the class.
Really? Do you have an example of code that leaks in the CImage class?
Alot of people use that class and I'm sure they'd like to know.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
GDI+
Kinda slow, and the interface is kinda clunky but it gets the job done
|
|
|
|