provide the color structs using (provide (struct-out ...))
closes PR 9867
This commit is contained in:
parent
983afd5355
commit
d79db54a22
5
collects/htdp/color-structs.rkt
Normal file
5
collects/htdp/color-structs.rkt
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
#lang racket/base
|
||||||
|
(provide (struct-out color)
|
||||||
|
(struct-out alpha-color))
|
||||||
|
(define-struct color (red green blue) #:transparent)
|
||||||
|
(define-struct alpha-color (alpha red green blue) #:transparent)
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
@(require scribble/manual
|
@(require scribble/manual
|
||||||
(for-label [except-in racket require]
|
(for-label [except-in racket require]
|
||||||
|
htdp/color-structs
|
||||||
[only-in lang/htdp-beginner require]))
|
[only-in lang/htdp-beginner require]))
|
||||||
|
|
||||||
@title[#:style 'toc #:tag "htdp"]{Implementing HtDP Teachpacks, Libraries, and Customized Teaching Languages}
|
@title[#:style 'toc #:tag "htdp"]{Implementing HtDP Teachpacks, Libraries, and Customized Teaching Languages}
|
||||||
|
@ -58,3 +59,16 @@ of DrRacket's teaching languages.
|
||||||
@include-section["error-reporting.scrbl"]
|
@include-section["error-reporting.scrbl"]
|
||||||
@include-section["testing.scrbl"]
|
@include-section["testing.scrbl"]
|
||||||
@include-section["htdp-lib.scrbl"]
|
@include-section["htdp-lib.scrbl"]
|
||||||
|
|
||||||
|
@section{Color and Alpha Color Structs}
|
||||||
|
|
||||||
|
@defmodule[htdp/color-structs]
|
||||||
|
|
||||||
|
@defstruct[color ([red any/c] [green any/c] [blue any/c])]{
|
||||||
|
This is the color sturct that is also exported by @racketmodname[htdp/image],
|
||||||
|
but here it is exported via @racket[(provide (struct-out color))].
|
||||||
|
}
|
||||||
|
@defstruct[alpha-color ([alpha any/c] [red any/c] [green any/c] [blue any/c])]{
|
||||||
|
This is the color sturct that is also exported by @racketmodname[htdp/image],
|
||||||
|
but here it is exported via @racket[(provide (struct-out alpha-color))].
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ plt/collects/tests/mzscheme/htdp-image.rkt
|
||||||
lang/prim
|
lang/prim
|
||||||
lang/posn
|
lang/posn
|
||||||
lang/private/imageeq
|
lang/private/imageeq
|
||||||
|
"color-structs.rkt"
|
||||||
"error.rkt")
|
"error.rkt")
|
||||||
|
|
||||||
(provide-primitives
|
(provide-primitives
|
||||||
|
@ -77,9 +78,6 @@ plt/collects/tests/mzscheme/htdp-image.rkt
|
||||||
(define (alpha-color-list? l)
|
(define (alpha-color-list? l)
|
||||||
(and (list? l) (andmap alpha-color? l)))
|
(and (list? l) (andmap alpha-color? l)))
|
||||||
|
|
||||||
(define-struct color (red green blue) #:inspector (make-inspector))
|
|
||||||
(define-struct alpha-color (alpha red green blue) #:inspector (make-inspector))
|
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
(define (to-exact-int x) (floor0 (if (exact? x) x (inexact->exact x))))
|
(define (to-exact-int x) (floor0 (if (exact? x) x (inexact->exact x))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user