- 博客(1)
- 资源 (9)
- 收藏
- 关注
原创 AVI文件格式
AVI(Audio Video Interleaved的缩写)是一种RIFF(Resource Interchange File Format的缩写)文件格式,多用于音视频捕捉、编辑、回放等应用程序中。通常情况下,一个AVI文件可以包含多个不同类型的媒体流(典型的情况下有一个音频流和一个视频流),不过含有单一音频流或单一视频流的AVI文件也是合法的。AVI可以算是Windows操作系统上最基本的、
2008-03-31 16:58:00 669 1
VC调节显示器亮度演示代码(VC6、VC7)
Gamma Manager is based on Gamma Slider control. This control allows to change gamma monitor on most graphic cards. The goal for this project is very simple and control is for VC6 & VC7.
The other day I downloaded a N64 emulator but the screen was so black that I did not see anything. I had thus to find this solution to lighten my screen. I know that the tools of my video chart make it possible to change gamma of my screen, but it is faster with this tool.
2009-02-26
用VC调节显示器亮度
Gamma Manager is based on Gamma Slider control. This control allows to change gamma monitor on most graphic cards. The goal for this project is very simple and control is for VC6 & VC7.
The other day I downloaded a N64 emulator but the screen was so black that I did not see anything. I had thus to find this solution to lighten my screen. I know that the tools of my video chart make it possible to change gamma of my screen, but it is faster with this tool.
Implementation
The implementation of this slider control is very easy.
Import GammaSlider.h and GammaSlider.cpp into your project.
Include reference to the class control.
Add slider control on a form.
Use ClassWizard to declare variable name derived from CGammaSlider control.
That's it, enjoy!
Under the hood
Windows provides two APIs GetDeviceGammaRamp/ SetDeviceGammaRamp to perform gamma correction. In fact we need to have a 3 dimensional buffer of 256 WORD to manipulate gamma correction. To change gamma, it is necessary to change the RGB value of each color contained in the buffer by a float factor between 0.0 and 2.0.
Example
We need to save current gamma for future restore. Collapse Copy CodeWORD m_RampSaved[256*3];
if (!GetDeviceGammaRamp(::GetDC(NULL), m_RampSaved))
{
TRACE("WARNING: Cannot initialize DeviceGammaRamp.\n");
}To change gamma, cycle into ramp buffer and change RGB color where Gamma is the float factor. Collapse Copy CodeWORD ramp[256*3];
for( int i=0; i<256; i++ ) {
ramp[i+0] = ramp[i+256] = ramp[i+512] =
(WORD)min(65535, max(0, pow((i+1) / 256.0, Gamma) * 65535 + 0.5));
}
SetDeviceGammaRamp(::GetDC(NULL), ramp);Now to trap slider control message, we need to use a special message ON_WM_HSCROLL_REFLECT() that can provide message to be dispatched into control class itself.
2009-02-26
DSound Dsound3d.dll
IDirectSound8::SetSpeakerConfig<br>The SetSpeakerConfig method specifies the speaker configuration of the device.<br><br>HRESULT SetSpeakerConfig(<br> DWORD dwSpeakerConfig<br>);<br>IDirectSound8::GetSpeakerConfig<br>The GetSpeakerConfig method retrieves the speaker configuration.<br><br>HRESULT GetSpeakerConfig(<br> LPDWORD pdwSpeakerConfig<br>);<br>Parameters<br>pdwSpeakerConfig <br>Address of the speaker configuration (see remarks in IDirectSound8::SetSpeakerConfig). <br>The value returned at pdwSpeakerConfig can be a packed DWORD containing both configuration and geometry information. Use the DSSPEAKER_CONFIG and DSSPEAKER_GEOMETRY macros to unpack the DWORD, as in the following example:<br><br> <br> if (DSSPEAKER_CONFIG(dwSpeakerConfig) == DSSPEAKER_STEREO)<br> {<br> if (DSSPEAKER_GEOMETRY(dwSpeakerConfig) ==<br> DSSPEAKER_GEOMETRY_WIDE)<br> {<br> // Configuration is wide stereo.<br> ...}<br> }<br> <br>To use #defines implemented in Windows Vista, set the DIRECTSOUND_VERSION to 0x1000 before including dsound.h.<br><br>
2008-04-07
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人