Difference between revisions of "Vector Graphics Structs Assignment"

From CSE425S Wiki
Jump to navigation Jump to search
(Created page with "=Vector Graphics= {{RacketToImplement|vector_graphics|to-image|vector_graphics}}")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
=CodeToInvestigate=
 +
==structs==
 +
<nowiki>(struct point (x y) #:transparent)
 +
(struct rectangle (a b fill outline) #:transparent)
 +
(struct circle (center radius fill outline) #:transparent)
 +
(struct group (offset children) #:transparent)</nowiki>
 +
 +
==Racket Image Library Utilities==
 +
<nowiki>(define (translate pt image)
 +
  (image:overlay/xy image:empty-image (point-x pt) (point-y pt) image))
 +
 +
(define (to-image-circle radius outline-color fill-color)
 +
  (image:overlay
 +
  (image:circle radius "outline" outline-color)
 +
  (image:circle radius "solid" fill-color)))
 +
 +
(define (to-image-rectangle width height outline-color fill-color)
 +
  (image:overlay
 +
  (image:rectangle width height "outline" outline-color)
 +
  (image:rectangle width height "solid" fill-color)))</nowiki>
 +
 
=Vector Graphics=
 
=Vector Graphics=
{{RacketToImplement|vector_graphics|to-image|vector_graphics}}
+
{{RacketToImplement|vector_graphics|rectangle-min-x<br/>rectangle-min-y<br/>rectangle-width<br/>rectangle-height<br/>to-image|vector_graphics}}
 +
==rectangle-min-x==
 +
(define (rectangle-min-x rect)
 +
        (error 'not-yet-implemented))
 +
 
 +
==rectangle-min-y==
 +
(define (rectangle-min-y rect)
 +
        (error 'not-yet-implemented))
 +
 
 +
==rectangle-width==
 +
(define (rectangle-width rect)
 +
        (error 'not-yet-implemented))
 +
==rectangle-height==
 +
(define (rectangle-height rect)
 +
        (error 'not-yet-implemented))
 +
==to-image==
 +
(define (to-image graphic)
 +
    (error 'not-yet-implemented))

Latest revision as of 14:28, 21 March 2022

CodeToInvestigate

structs

(struct point (x y) #:transparent)
(struct rectangle (a b fill outline) #:transparent)
(struct circle (center radius fill outline) #:transparent)
(struct group (offset children) #:transparent)

Racket Image Library Utilities

(define (translate pt image)
  (image:overlay/xy image:empty-image (point-x pt) (point-y pt) image))

(define (to-image-circle radius outline-color fill-color)
  (image:overlay
   (image:circle radius "outline" outline-color)
   (image:circle radius "solid" fill-color)))

(define (to-image-rectangle width height outline-color fill-color)
  (image:overlay
   (image:rectangle width height "outline" outline-color)
   (image:rectangle width height "solid" fill-color)))

Vector Graphics

file: src/main/racket/vector_graphics/vector_graphics.rkt Racket-logo.svg
functions: rectangle-min-x
rectangle-min-y
rectangle-width
rectangle-height
to-image

rectangle-min-x

(define (rectangle-min-x rect)
       (error 'not-yet-implemented)) 

rectangle-min-y

(define (rectangle-min-y rect)
       (error 'not-yet-implemented)) 

rectangle-width

(define (rectangle-width rect)
       (error 'not-yet-implemented)) 

rectangle-height

(define (rectangle-height rect)
       (error 'not-yet-implemented)) 

to-image

(define (to-image graphic)
   (error 'not-yet-implemented))