Search found 9 matches: hsv2rgb

Searched query: +hsv2rgb

by mk-soft
Tue Oct 03, 2017 2:21 pm
Forum: Coding Questions
Topic: Convert rgb to hsv
Replies: 3
Views: 2091

Convert rgb to hsv

... r - *in\g ) / delta ; between magenta & cyan
EndIf
*out\h * 60.0 ; degrees
If( *out\h < 0.0 )
*out\h + 360.0;
EndIf
EndProcedure

Procedure hsv2rgb(*in.hsv, *out.rgb)

Protected.d hh, p, q, t, ff;
Protected.i i ;

If *in\s <= 0.0 ; // < is bogus, just shuts up warnings
*out\r = *in\v ...
by [blendman]
Wed Jul 01, 2015 1:12 pm
Forum: Coding Questions
Topic: [ok] Find RGB color from Hue
Replies: 0
Views: 1495

[ok] Find RGB color from Hue

... n2
EndProcedure
Procedure.f MaxF(n1.f, n2.f)
If n1>n2
ProcedureReturn n1
EndIf
ProcedureReturn n2
EndProcedure

Procedure.i HSV2RGB(H.f,S.f,V.f)

Define.COLOUR sat

While h < 0
h = h + 360
Wend

While h > 360
h = h - 360
Wend

If h < 120
sat\r = (120 - h ...
by Seymour Clufley
Sat Feb 07, 2009 9:01 pm
Forum: Coding Questions
Topic: Emulating Photoshop's blending modes
Replies: 15
Views: 7326

... c
Select *c\type
Case #COLOR_RGB : ProcedureReturn *c
;Case #COLOR_CMY : ProcedureReturn CMY2RGB(*c)
;Case #COLOR_HSV : ProcedureReturn HSV2RGB(*c)
Case #COLOR_HSL : ProcedureReturn HSL2RGB(*c)
EndSelect
EndProcedure

ProcedureDLL.l ColorRGB(*c.Color) ; converts an internal copy of ...
by Froggerprogger
Tue Sep 19, 2006 3:08 pm
Forum: Tricks 'n' Tips
Topic: Colormodels: RGB, CMY, HLS, HSL (HLS, HSI)
Replies: 6
Views: 6070

Colormodels: RGB, CMY, HLS, HSL (HLS, HSI)

... if CMY is made!
*c\r = 1.0 - *c\c
*c\g = 1.0 - *c\m
*c\b = 1.0 - *c\y
*c\type = #COLOR_RGB

ProcedureReturn *c
EndProcedure

ProcedureDLL.l HSV2RGB(*c.Color) ; converts HSV-color *c to RGB and returns *c. No check if HSV is made!
Protected h.f, s.f, v.f
Protected f.f, p.f, q.f, t.f, i.l

h ...
by zued
Thu Apr 28, 2005 12:54 pm
Forum: Coding Questions
Topic: routine for desaturate a picture/image?
Replies: 7
Views: 1655

... Procedure.f MaxF(n1.f, n2.f)
If n1>n2
ProcedureReturn n1
EndIf
ProcedureReturn n2
EndProcedure

CompilerEndIf



Procedure HSV2RGB(*c1.HSV, *rgb.COLOUR)
DefType.COLOUR sat

While *c1\h < 0
*c1\h = *c1\h + 360
Wend

While *c1\h > 360
*c1\h = *c1\h - 360
Wend ...
by El_Choni
Wed Apr 27, 2005 8:42 pm
Forum: Coding Questions
Topic: routine for desaturate a picture/image?
Replies: 7
Views: 1655

Hi,

I don't know how to do it with GDIPlus, but you can do it without. This code uses tinman's hsv2rgb procedures from this post:

http://forums.purebasic.com/english/viewtopic.php?t=8251


Structure COLORREF
FutureAlpha.b ;)
b.b
g.b
r.b
EndStructure

Procedure SetSaturation(ImageID ...
by tinman
Sat Nov 08, 2003 9:20 pm
Forum: Tricks 'n' Tips
Topic: RGB to HSV (and back again) converter
Replies: 1
Views: 2175

RGB to HSV (and back again) converter

... all values between 0 and 1 for intensity of colour
; Hue is in degrees
; Lightness is between 0 And 1
; Saturation is between 0 And 1
Procedure HSV2RGB(*c1.HSV, *rgb.COLOUR)
DefType.COLOUR sat

While *c1\h < 0
*c1\h = *c1\h + 360
Wend

While *c1\h > 360
*c1\h = *c1\h - 360
Wend

If *c1\h ...
by tinman
Sat Nov 08, 2003 6:43 pm
Forum: Tricks 'n' Tips
Topic: Max(), Min(), MaxF(), MinF()
Replies: 31
Views: 13791

... all values between 0 and 1 for intensity of colour
; Hue is in degrees
; Lightness is between 0 And 1
; Saturation is between 0 And 1
Procedure HSV2RGB(*c1.HSV, *rgb.COLOUR)
DefType.COLOUR sat

While *c1\h < 0
*c1\h = *c1\h + 360
Wend

While *c1\h > 360
*c1\h = *c1\h - 360
Wend

If *c1\h ...