SetDeviceGammaRamp 调整的是桌面的亮度,如何调整视频亮度?

sunliangchao 2007-03-07 08:45:34
我试验了传入me.hdc和传入 getdc(getforgrundwindow)都不能控制视频亮度,只能调整屏幕亮度,视频亮度不变。
...全文
2618 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
东方之珠 2009-01-22
  • 打赏
  • 举报
回复
在播放的视频中调整视频亮度是比较难的。我所知道的MCI中有这样的命令。
strongpan 2009-01-20
  • 打赏
  • 举报
回复
关注!
嗷嗷叫的老马 2007-08-28
  • 打赏
  • 举报
回复
我也来顶一下.....
sunliangchao 2007-08-23
  • 打赏
  • 举报
回复
d
VBAdvisor 2007-07-03
  • 打赏
  • 举报
回复
up
luoxinxin1988 2007-07-02
  • 打赏
  • 举报
回复
过来帮顶下.
panyulirong 2007-07-01
  • 打赏
  • 举报
回复
Option Explicit
'Gamma Type
Private Type Gamma
Red As Integer
Green As Integer
Blue As Integer
End Type
Private GammaDay As Gamma 'Day Gamma
Private GammaNight As Gamma 'Night Gamma

'Gamma APIs
Private Ramp1(0 To 255, 0 To 2) As Integer
Private Ramp2(0 To 255, 0 To 2) As Integer
Private Declare Function GetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long, lpv As Any) As Long
Private Declare Function SetDeviceGammaRamp Lib "gdi32" (ByVal hdc As Long, lpv As Any) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetDesktopWindow Lib "user32" () As Long

'Set Gamma
Public Sub SetGamma(ByVal intRed As Integer, ByVal intGreen As Integer, ByVal intBlue As Integer)
Dim i As Integer
Dim ScrDC As Long

'Get Screen's DC
ScrDC = GetDC(GetDesktopWindow)
intRed = intRed / 2
intGreen = intGreen / 2
intBlue = intBlue / 2
'Change Ramp
For i = 0 To 255
If intRed < 0 Then Ramp2(i, 0) = ConvToSignedValue(ConvToUnSignedValue(Ramp1(i, 0)) * (100 - Abs(intRed)) / 100)
If intRed = 0 Then Ramp2(i, 0) = Ramp1(i, 0)
If intRed > 0 Then Ramp2(i, 0) = ConvToSignedValue(65535 - ((65535 - ConvToUnSignedValue(Ramp1(i, 0))) * (100 - intRed) / 100))
If intGreen < 0 Then Ramp2(i, 1) = ConvToSignedValue(ConvToUnSignedValue(Ramp1(i, 1)) * (100 - Abs(intGreen)) / 100)
If intGreen = 0 Then Ramp2(i, 1) = Ramp1(i, 1)
If intGreen > 0 Then Ramp2(i, 1) = ConvToSignedValue(65535 - ((65535 - ConvToUnSignedValue(Ramp1(i, 1))) * (100 - intGreen) / 100))
If intBlue < 0 Then Ramp2(i, 2) = ConvToSignedValue(ConvToUnSignedValue(Ramp1(i, 2)) * (100 - Abs(intBlue)) / 100)
If intBlue = 0 Then Ramp2(i, 2) = Ramp1(i, 2)
If intBlue > 0 Then Ramp2(i, 2) = ConvToSignedValue(65535 - ((65535 - ConvToUnSignedValue(Ramp1(i, 2))) * (100 - intBlue) / 100))
Next
'Set Gamma
SetDeviceGammaRamp ScrDC, Ramp2(0, 0)
End Sub
'Save Gamma
Public Sub SaveGamma()
Dim ScrDC As Long

'Get Screen's DC
ScrDC = GetDC(GetDesktopWindow)

'Reset it
GetDeviceGammaRamp ScrDC, Ramp1(0, 0)
End Sub
'RestoreGamma
Public Sub RestoreGamma()
Dim ScrDC As Long

'Get Screen's DC
ScrDC = GetDC(GetDesktopWindow)

'Reset it
SetDeviceGammaRamp ScrDC, Ramp1(0, 0)
End Sub
Private Function ConvToSignedValue(lngValue As Long) As Integer
'Cheezy method for converting to signed integer
If lngValue <= 32767 Then
ConvToSignedValue = CInt(lngValue)
Exit Function
End If

ConvToSignedValue = CInt(lngValue - 65535)
End Function
Private Function ConvToUnSignedValue(intValue As Integer) As Long
'Cheezy method for converting to unsigned integer
If intValue >= 0 Then
ConvToUnSignedValue = intValue
Exit Function
End If

ConvToUnSignedValue = intValue + 65535
End Function
Private Sub Command1_Click()
GammaDay.Red = 0
GammaDay.Green = 0
GammaDay.Blue = 0
SetGamma GammaDay.Red, GammaDay.Green, GammaDay.Blue
End Sub
Private Sub Command2_Click()
GammaNight.Red = -64
GammaNight.Green = -64
GammaNight.Blue = -64
SetGamma GammaNight.Red, GammaNight.Green, GammaNight.Blue
End Sub
Private Sub Form_Load()
SaveGamma
End Sub
Private Sub Form_Unload(Cancel As Integer)
RestoreGamma
End Sub
sunliangchao 2007-03-15
  • 打赏
  • 举报
回复
?
sunliangchao 2007-03-09
  • 打赏
  • 举报
回复
顶起来
sunliangchao 2007-03-07
  • 打赏
  • 举报
回复
显卡属性中 一般都有 颜色调整 ,其中有一项肯定是 把颜色应用于的下拉项,包含:桌面、覆盖、全部,其中这个覆盖 指的就是视频窗口,请问这个东西怎么实现哦。

是否是用 SetDeviceGammaRamp(某个特殊的dc,gamma值)?
VBAHZ 2007-03-07
  • 打赏
  • 举报
回复
关注+严重关注+非常严重的关注!

兄弟,帮你顶了:)

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧