「画像処理2」の編集履歴(バックアップ)一覧はこちら
「画像処理2」(2010/09/01 (水) 14:04:13) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
#asciiart(blockquote){
Const KOUDO = &h1
Const MEIDO = &h2
'a,b,cの最大値を戻す
Function max(a,b,c)
If a > b Then max = a Else max = b
If max < c Then max = c
End Function
'a,b,cの最小値を戻す
Function min(a,b,c)
If a < b Then min = a Else min = b
If min > c Then min = c
End Function
'RGBをモノクロにしてRGB値で返す(c=1,明度、c=2,光度 c=3のとき、平均)
Function RGB24ToMonochro(rgb As DWord, c As Long) As DWord
Dim R As Byte, G As Byte, B As Byte
R = rgb And &hFF
G = (rgb >> 8) And &hFF
B = (rgb >> 16) And &hFF
Select Case c
Case MEIDO
rgb = 0.5 * (max(R,G,B) + min(R,G,B))
Case KOUDO
rgb = 0.21 * R + 0.72 * G + 0.07 * B
Case Else
rgb = (R + G + B) / 3
End Select
RGB24ToMonochro = RGB(rgb, rgb, rgb)
End Function
'RGB階調反転してRGB値で返す
Function RGB24NegaPosi(rgb As DWord) As DWord
Dim R As Byte, G As Byte, B As Byte
R = rgb And &hFF
G = (rgb >> 8) And &hFF
B = (rgb >> 16) And &hFF
RGB24NegaPosi = RGB(255-R, 255-G, 255-B)
End Function
}
#asciiart(blockquote){
Const KOUDO = &h1
Const MEIDO = &h2
'a,b,cの最大値を戻す
Function max(a,b,c)
If a > b Then max = a Else max = b
If max < c Then max = c
End Function
'a,b,cの最小値を戻す
Function min(a,b,c)
If a < b Then min = a Else min = b
If min > c Then min = c
End Function
'RGBをモノクロにしてRGB値で返す(c=1,明度、c=2,光度 c=3のとき、平均)
Function RGB24ToMonochro(rgb As DWord, c As Long) As DWord
Dim R As Byte, G As Byte, B As Byte
R = rgb And &hFF
G = (rgb >> 8) And &hFF
B = (rgb >> 16) And &hFF
Select Case c
Case MEIDO
rgb = 0.5 * (max(R,G,B) + min(R,G,B))
Case KOUDO
rgb = 0.21 * R + 0.72 * G + 0.07 * B
Case Else
rgb = (R + G + B) / 3
End Select
RGB24ToMonochro = RGB(rgb, rgb, rgb)
End Function
'RGB階調反転してRGB値で返す
Function RGB24NegaPosi(rgb As DWord) As DWord
Dim R As Byte, G As Byte, B As Byte
R = rgb And &hFF
G = (rgb >> 8) And &hFF
B = (rgb >> 16) And &hFF
RGB24NegaPosi = RGB(255-R, 255-G, 255-B)
End Function
}
[[サンプル>http://www31.atwiki.jp/abwiki?cmd=upload&act=open&pageid=427&file=image2.zip]]