Home > Software engineering >  This is a to adjust the screen brightness, contrast, hue, how to adjust the picture?
This is a to adjust the screen brightness, contrast, hue, how to adjust the picture?

Time:09-23

This is a to adjust the screen brightness, contrast, hue, how to adjust the picture?

I want to adjust the hue of picture in picture,

 'Download by http://www.codefans.net 
Private Declare Function GetDesktopWindow Lib "user32 () As" Long
Private Declare Function GetDC Lib "user32" (ByVal HWND) As Long As Long
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 RGBRamp1 (255, 2) As an Integer
Private RGBRamp2 (255, 2) As an Integer
Dim ScrDC As Long

Private Sub Command1_Click ()
Dim Fn As Integer
Slider1. Value=https://bbs.csdn.net/topics/0
Slider2. Value=https://bbs.csdn.net/topics/100
Slider3 (0). The Value=https://bbs.csdn.net/topics/0
Slider3 (1). Value=https://bbs.csdn.net/topics/0
Slider3 (2). Value=https://bbs.csdn.net/topics/0
If Dir (App. Path & amp; "\ Default. Dat") & lt;> "" Then
Fn=FreeFile
Open the App. The Path & amp; "\ Default. Dat" For Input As # Fn
For I=0 To 255
For j=0 To 2
Input # Fn, RGBRamp1 (I, j)
Next j
Next I
Close # Fn
The Else
MsgBox "the default data file was not found, only to return to the state before the adjustable rear!" , vbOKOnly + vbExclamation, "prompted"
End the If
SetDeviceGammaRamp ScrDC RGBRamp1 (0, 0)
End Sub

Private Sub Command2_Click ()
End
End Sub

Private Sub Form_Load ()
ScrDC=GetDC (GetDesktopWindow) 'parameters of 0 handle to get the entire screen
GetDeviceGammaRamp ScrDC RGBRamp1 (0, 0) 'to save the current Gamma gradient value value entry points to the array
Slider1. Min=50
-Slider1. Max=50
Slider1. Value=https://bbs.csdn.net/topics/0
Slider2. Min=1
Slider2. Max=100
Slider2. Value=https://bbs.csdn.net/topics/100
For I=0 To 2
Slider3 (I). Min=50
-Slider3 (I). Max=50
Slider3 (I) Value=https://bbs.csdn.net/topics/0
Next I
Label2. Caption=Slider1. Value
Label3. Caption=Slider2. Value
End Sub

Private Sub Slider1_Change ()
Label2. Caption=Slider1. Value
Call SetLightness (Slider1 Value)
End Sub

Private Sub Slider2_Change () 'to adjust the contrast
Dim I As an Integer, j As Integer
Label3. Caption=Slider2. Value
For I=0 To 255
For j=0 To 2
RGBRamp2 (I, j)=RGBRamp1 (I, j) * Slider2 Value/100
Next j
Next I
SetDeviceGammaRamp ScrDC RGBRamp2 (0, 0)
End Sub

Private Sub Slider3_Change (Index As an Integer)
Call SetRGBColor (Slider3 (0). The Value, 0) 'Call is three times in order to achieve the melange
Call SetRGBColor (Slider3 (1). The Value, 1)
Call SetRGBColor (Slider3 (2). The Value, 2)
SetDeviceGammaRamp ScrDC RGBRamp2 (0, 0)
End Sub

Private Sub SetLightness (ByVal intRGB As Integer) 'adjust brightness
Dim I As an Integer, j As Integer
For I=0 To 255
For j=0 To 2
The Select Case intRGB
The Case Is & lt; 0
RGBRamp2 (I, j)=LngToInt (IntToLng (RGBRamp1 (I, 0)) * (100 - Abs (intRGB))/100)
The Case Is=0
RGBRamp2 (I, j)=RGBRamp1 (I, 0)
The Case Is & gt; 0
RGBRamp2 (I, j)=LngToInt (65535 - ((65535 - IntToLng (RGBRamp1 (I, 0))) * (100 - intRGB)/100))
End the Select
Next j
Next I
SetDeviceGammaRamp ScrDC RGBRamp2 (0, 0)
End Sub

Private Sub SetRGBColor (ByVal intRGB As an Integer, IdxRGB As Integer) 'adjust hue
Dim I As an Integer, r As Integer
For I=0 To 255
The Select Case intRGB
The Case Is & lt; 0
R=LngToInt (IntToLng (RGBRamp1 (I, IdxRGB)) * (100 - Abs (intRGB))/100)
The Case Is=0
R=RGBRamp1 (I, IdxRGB)
The Case Is & gt; 0
((r=LngToInt (65535-65535 - IntToLng (RGBRamp1 (I, IdxRGB))) * (100 - intRGB)/100))
End the Select
If IdxRGB=0 Then
RGBRamp2 (I, 0)=r
ElseIf IdxRGB=1 Then
RGBRamp2 (I, 1)=r
ElseIf IdxRGB=2 Then
RGBRamp2 (I, 2)=r
End the If
Next I
End Sub
Private Function LngToInt (lngValue As Long) As an Integer 'into a signed Integer data type
If lngValue & lt;=32767 Then LngToInt=CInt (lngValue) Else LngToInt=CInt (lngValue - 65535)
End the Function
Private Function IntToLng (intValue As Integer) As Long 'is converted to an unsigned Long Integer data
If intValue & gt;=0 Then IntToLng=intValue Else IntToLng=intValue + 65535
End the Function

CodePudding user response:

I know CSDN undiscovered talent, please advise,

CodePudding user response:

Adjust the display and adjust the picture, a display and pictures are not relevant,
Display is closed, the file or the file, let alone the display,

Operation will find pictures of operation

CodePudding user response:

Private SetRGBColor (int intRGB, int IdxRGB)//adjust hue
{
Int r;
for (int i=0; I & lt; 256; I++)
{
The switch (intRGB)
{
Case & lt; 0:
R=LngToInt (IntToLng (RGBRamp1 (I, IdxRGB)) * (100 - Abs (intRGB))/100);
break;
Case 0:
R=RGBRamp1 (I, IdxRGB);
break;
Case & gt; 0:
((r=LngToInt (65535-65535 - IntToLng (RGBRamp1 (I, IdxRGB))) * (100 - intRGB)/100));
break;
}
If (IdxRGB=0)
RGBRamp2=r (I, 0);
Else if (IdxRGB=1)
RGBRamp2 (I, 1)=r;
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • API