|
hello
without using any MFC classes ,
I want to convert a 24 bit color bitmap image to grayscale image.
How to do that ?
Can anybody give me simple code snippets to implement the logic?
|
|
|
|
|
Have you checked this
CP article[^]?
It uses MFC, but you should be able to rewrite it without problems.
Igor Green
http://www.grigsoft.com/ - files and folders comparison tools
|
|
|
|
|
// From www.OpenGL.org - 'Avoiding 16 Common OpenGL Pitfalls' by Mark J. Kilgard
// 'A standard linear weighting for combining red, green, and blue into luminance
// was defined by the National Television Standard Committee (NTSC) when the US
// color television format was standardized. These weightings are based on the
// human eye's sensitivity to different wavelengths of visible light and are
// based on extensive research. To set up OpenGL to convert RGB to luminance
// according to the NTSC standard, you would change OpenGL's default pixel
// transfer state like this:
// glPixelTransferf(GL_RED_SCALE, 0.299);
// glPixelTransferf(GL_GREEN_SCALE, 0.587);
// glPixelTransferf(GL_BLUE_SCALE, 0.114);
//
// From : Postscript Language Ref. Man. 2nd Ed. 6.2.1 pg.304
// '... NTSC viseo standard. This standard determines how a color
// television signal is rendered on a black and white television.'
//
byte b = (byte)(
(R * 0.299) +
(G * 0.587) +
(B * 0.114)
);
e.g.
Given : R = 120, G = 100, B = 200
Grey value = 120*.299 + 100*.587 + 200*.114 = 117.38 (117)
Grey color : R = 117, G = 117, B = 117
...cmk
Save the whales - collect the whole set
|
|
|
|
|
hi , How to access controls of a CFormview class from another CFormview class?
Aparna
|
|
|
|
|
You just don't. You trigger an UpdateAllViews from the document managing both views. If they don't have the same document, you should rethink your architecture both one and two times.
|
|
|
|
|
Aparna,
Have you managed to find a solution for this? I am stuck with this also...
thanks
|
|
|
|
|
Hi there,
I created a checklist which is itself a child view. The items on the checklist have corresponding buttons that allow the user to click on to perform the functions needed to complete the list. Once the user clicks on the button, a dialog box or form view appears. After the user clicks on the OK button to close the function view, how can I reference the checklist image in the checklist view to make it visible? Or should I say how do I refresh the checklist to see that the item has been completed? This is what I have so far:
void CCCheckList::OnSelFruits()
{
//opens up the Select Fruits dialog box
}
void CFruits::OnOk()
{
//do some things
PostMessage(WM_COMMAND, ID_FILE_CLOSE)
}
Where and how do I make the IDC_CHECKMARK image from the Checklist class visible?
Thanks!
|
|
|
|
|
Are any of the following ways of allocating memory faster or more efficient than the others:
malloc, calloc, free
c++ new, delete
LocalAlloc, LocalFree
GlobalAlloc, GlobalFree
CoTaskMemAlloc, CoTaskMemFree
-thanks
|
|
|
|
|
Stick with 'new' and 'delete', unless you have any specific requirements to use the other methods.
|
|
|
|
|
malloc and free are probably the fastest, given that in most heap managers, they are obtaining memory from a pool managed by the C runtime. calloc is inherently slower than malloc, since it calls malloc and then initializes the allocated memory to all zero's.
new and delete are slower than malloc and free, since they allocate/deallocate memory and then call the constructor/destructor for the object.
The remaining functions I would think would be slower than malloc/free/new/delete, since they involve Win32 API or COM calls.
That said, I agree with the other poster. If you are using C++, you should use new and delete wherever possible. Most of the time, the first thing you do with allocated memory is initialize it. The C++ new operator couples the allocation and initialization together, making it more difficult to fail to initialize what your allocating.
Software Zen: delete this;
|
|
|
|
|
With the MS C/C++ library running on W2K etc then I think you'll find that all those end up at the API 'HeapAlloc'. So if you're really after most efficiency then consider going direct.
In general though 'new'/'delete' for C++. And create your own allocators for special cases. For instance if you're allocating large numbers of small constant sized objects then a specialised allocator based on a number of larger allocations from the system is worth looking at.
As in all optimisation the big win is to get the high level aspects of the program efficient before micro optimising. Say you make all your allocations run in 95% of the time, and I tweak my app to do half the number of allocations. Who's won? Who's kept their app maintainable and simple? Etc etc.
Paul
|
|
|
|
|
HI,
Plz tell me How can i get ITem ( item no. or its attribute) by selecting it with mouse..
i means any method for getting seletec item Number
or any thing else like attributes
thanx
|
|
|
|
|
int nIndex = myListCtrl.GetNextItem (-1, LVNI_ALL | LVNI_SELECTED);
while (nIndex != -1) {
TRACE ("Item %d is selected\n", nIndex);
nIndex = myListCtrl.GetNextItem (nIndex, LVNI_ALL | LVNI_SELECTED);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
hi all,
I am want to get embedded objects from a powerpoint slide. Then I want to handle the actions of each of those objects from each buttons of my application.
If anyone can please help me ASAP.
Best regards,
Faisal
(al.faisal@vmclbd.com)
Faisal
|
|
|
|
|
can someone point me to an example of using the Tab control which changes content when the tab changes
i really dont want to go through 20 controls and hide them just to change the content
|
|
|
|
|
Put your controls in one or more modeless dialogs - then just show the appropriate dialog (and hide the others) when the tab selection changes. Alternatively, you could use a modeless property sheet (and property pages).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
ok, i found this artical -> http://www.codeproject.com/dialog/embedded_dialog.asp
its exactly what i needed, bit i dont want the dialog to have a border when its embedded in the main dialog, so how do i take away the border?
|
|
|
|
|
The border is a property of the dialog, just turn it off.
--
Joel Lucsy
|
|
|
|
|
Set the dialog's border style to "None" in the resource editor.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
HI Dear,
How r u ?
Actully I got same problem as you may faced(Multithread control) in VC++.
I want to place Items in list box. but all placing of items in List must be done in thread. so that all other work can be done side-wise.
Can you get me idea..as you may have solved this type of problem.;)
PLZ PLZ..Thanks..Sumit Kapoor
---Sumit Kapoor---
|
|
|
|
|
One solution is messages. Send a message to main thread and have it update the control.
Kuphryn
|
|
|
|
|
Hi Sumeet,
Nice to see you again....
I find the solution of my problem by calling the SendMessage(IDC_xxx_xxx) to call the ON_BN_CLICKED message directly from your thread function.I also works even in case of User-Interface Thread.
Like that you may place ur item directly from your thread program. It will work eeven if you are using User-Interface thread. This may help you.
Wish you all the best..
Bye
|
|
|
|
|
how can I change the color of status bar with vc6? I mean the bottom of the window.Thanks a lot.
hi all
|
|
|
|
|
How can I make a property in an ActiveX control (ATL) have the choices enumerated so that they appear as a drop-down list in VB?
Thanks,
Jory
|
|
|
|
|
Okay, just to maybe save someone else some time in the future, I get a RPC_X_BAD_STUB_DATA (1783) windows error code if I pass a buffer that is too LARGE into this function. When I reduced it to 4096 bytes, the call works fine.
|
|
|
|