Skip to content

Commit e34d13c

Browse files
committed
新增box2d
1 parent 7823693 commit e34d13c

280 files changed

Lines changed: 57646 additions & 21 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

agave/color/conversion.sls

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
;; Copyright 2016 Eduardo Cavazos
2+
;;
3+
;; Licensed under the Apache License, Version 2.0 (the "License");
4+
;; you may not use this file except in compliance with the License.
5+
;; You may obtain a copy of the License at
6+
;;
7+
;; http://www.apache.org/licenses/LICENSE-2.0
8+
;;
9+
;; Unless required by applicable law or agreed to in writing, software
10+
;; distributed under the License is distributed on an "AS IS" BASIS,
11+
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
;; See the License for the specific language governing permissions and
13+
;; limitations under the License.
14+
15+
(library
16+
17+
(agave color conversion)
18+
19+
(export hsva->rgba)
20+
21+
(import (rnrs)
22+
(agave color rgba)
23+
(agave color hsva))
24+
25+
(define (hsva->rgba color)
26+
27+
(let ((hue (inexact (hsva-hue color)))
28+
(saturation (inexact (hsva-saturation color)))
29+
(value (inexact (hsva-value color)))
30+
(alpha (inexact (hsva-alpha color))))
31+
32+
(let ((Hi (mod (floor (/ hue 60.0)) 6.0)))
33+
34+
(let ((f (- (/ hue 60.0) Hi))
35+
(p (* (- 1.0 saturation) value)))
36+
37+
(let ((q (* (- 1.0 (* f saturation)) value))
38+
(t (* (- 1.0 (* (- 1.0 f) saturation)) value)))
39+
40+
(case (exact Hi)
41+
((0) (rgba value t p alpha))
42+
((1) (rgba q value p alpha))
43+
((2) (rgba p value t alpha))
44+
((3) (rgba p q value alpha))
45+
((4) (rgba t p value alpha))
46+
((5) (rgba value p q alpha))))))))
47+
)

agave/color/hsva.sls

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
;; Copyright 2016 Eduardo Cavazos
2+
;;
3+
;; Licensed under the Apache License, Version 2.0 (the "License");
4+
;; you may not use this file except in compliance with the License.
5+
;; You may obtain a copy of the License at
6+
;;
7+
;; http://www.apache.org/licenses/LICENSE-2.0
8+
;;
9+
;; Unless required by applicable law or agreed to in writing, software
10+
;; distributed under the License is distributed on an "AS IS" BASIS,
11+
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
;; See the License for the specific language governing permissions and
13+
;; limitations under the License.
14+
15+
(library
16+
17+
(agave color hsva)
18+
19+
(export <hsva> hsva hsva? hsva-clone hsva-assign! apply-hsva
20+
21+
hsva-hue hsva-hue-set! hsva-hue-change!
22+
hsva-saturation hsva-saturation-set! hsva-saturation-change!
23+
hsva-value hsva-value-set! hsva-value-change!
24+
hsva-alpha hsva-alpha-set! hsva-alpha-change!)
25+
26+
(import (rnrs) (agave misc define-record-type))
27+
28+
(define-record-type++
29+
30+
(<hsva> hsva hsva? hsva-clone hsva-assign! apply-hsva)
31+
32+
(fields (mutable hue hsva-hue hsva-hue-set! hsva-hue-change!)
33+
(mutable saturation
34+
hsva-saturation
35+
hsva-saturation-set!
36+
hsva-saturation-change!)
37+
(mutable value hsva-value hsva-value-set! hsva-value-change!)
38+
(mutable alpha hsva-alpha hsva-alpha-set! hsva-alpha-change!)))
39+
40+
41+
)

agave/color/rgba.sls

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
;; Copyright 2016 Eduardo Cavazos
2+
;;
3+
;; Licensed under the Apache License, Version 2.0 (the "License");
4+
;; you may not use this file except in compliance with the License.
5+
;; You may obtain a copy of the License at
6+
;;
7+
;; http://www.apache.org/licenses/LICENSE-2.0
8+
;;
9+
;; Unless required by applicable law or agreed to in writing, software
10+
;; distributed under the License is distributed on an "AS IS" BASIS,
11+
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
;; See the License for the specific language governing permissions and
13+
;; limitations under the License.
14+
15+
(library
16+
17+
(agave color rgba)
18+
19+
(export <rgba> rgba rgba? rgba-clone rgba-assign! apply-rgba
20+
21+
rgba-red rgba-red-set! rgba-red-change!
22+
rgba-green rgba-green-set! rgba-green-change!
23+
rgba-blue rgba-blue-set! rgba-blue-change!
24+
rgba-alpha rgba-alpha-set! rgba-alpha-change!)
25+
26+
(import (rnrs) (agave misc define-record-type))
27+
28+
(define-record-type++
29+
30+
(<rgba> rgba rgba? rgba-clone rgba-assign! apply-rgba)
31+
32+
(fields (mutable red rgba-red rgba-red-set! rgba-red-change!)
33+
(mutable green rgba-green rgba-green-set! rgba-green-change!)
34+
(mutable blue rgba-blue rgba-blue-set! rgba-blue-change!)
35+
(mutable alpha rgba-alpha rgba-alpha-set! rgba-alpha-change!)))
36+
37+
)

0 commit comments

Comments
 (0)