1
Visual Basic 6 / Re:[Source]Cambiar las dimensiones de una imágen mediante su array de bits
« en: Noviembre 14, 2023, 08:21:22 am »
https://learn.microsoft.com/en-us/windows/win32/api/wingdi/ns-wingdi-coloradjustment
Citar
caReferenceBlack=The value must be in the range from 0 to 4000
Citar
caReferenceWhite=The value must be in the range from 6000 to 10,000
Código: [Seleccionar]
'----------------------------CONTRAST-------------------------------
Private Declare Function GetColorAdjustment Lib "gdi32" (ByVal hDC As Long, ByRef lpCA As ColorAdjustment) As Long
Private Declare Function SetColorAdjustment Lib "gdi32" (ByVal hDC As Long, lpCA As ColorAdjustment) As Long
Private Declare Function StretchBlt Lib "gdi32" (ByVal hDC As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long
Private Declare Function SetStretchBltMode Lib "gdi32" (ByVal hDC As Long, ByVal nStretchMode As Long) As Long
Private Type ColorAdjustment
caSize As Integer
caFlags As Integer
caIlluminantIndex As Integer
caRedGamma As Integer
caGreenGamma As Integer
caBlueGamma As Integer
caReferenceBlack As Integer
caReferenceWhite As Integer
caContrast As Integer
caBrightness As Integer
caColorfulness As Integer
caRedGreenTint As Integer
End Type
Private Const HALFTONE = 4
'-----------------------------------------------------------
Código: [Seleccionar]
Dim ColorInfo As ColorAdjustment
GetColorAdjustment PictureDestination.hDC, ColorInfo
ColorInfo.caReferenceBlack = referenceBlack
ColorInfo.caReferenceWhite = referenceWhite
SetColorAdjustment PictureDestination.hDC, ColorInfo
SetStretchBltMode PictureDestination.hDC, HALFTONE
StretchBlt PictureDestination.hDC, 0, 0, PictureDestination.Width, PictureDestination.Height, PictureSource.hDC, 0, 0, PictureSource.Width, PictureSource.Height, vbSrcCopy
PictureDestination.Refresh

