Difference between revisions of "Render Part B Assignment"
(→Image) |
|||
Line 19: | Line 19: | ||
==Image== | ==Image== | ||
− | [[Render_Part_A_Assignment#Image|from Part A]] | + | You will evolve your code from [[Render_Part_A_Assignment#Image|from Part A]] |
superclass: Transform | superclass: Transform | ||
+ | |||
+ | be sure to not override render. implement the render_transformed method instead. | ||
==ColorTransform== | ==ColorTransform== |
Revision as of 07:29, 15 July 2019
In this studio we will evolve our code from Render_Part_A_Assignment to leverage class hierarchies.
File:Part b class hierarchy.png
Continue editing files in the render/assignment directory.
In this studio, we will have parameters for which explicitly passed arguments are not required (for convenience and backwards compatibility). We will prefer keyword arguments over optional arguments.
Contents
Code to Implement
Transform
superclass: Object
Transform's constructor should take x and y parameters and store them in instance variables.
It should define a render method which preserves the current model view transformation, translates in the z==0 plane, passes the render_transformed message to itself, and restores the model view transformation.
All subclasses must implement a private render_transformed method.
Image
You will evolve your code from from Part A
superclass: Transform
be sure to not override render. implement the render_transformed method instead.
ColorTransform
superclass: Transform
Text
superclass: ColorTransform
Ellipse
superclass: ColorTransform
EquilateralTriangle
superclass: ColorTransform
BezierCurve
superclass: ColorTransform
Chord
superclass: ColorTransform
Rectangle
superclass: ColorTransform
CompositeTransform
superclass: Transform
class Scene
superclass: Object
Testing Your Solution
Unit Testing
ruby/render/part_b_test/part_b_unit_test.rb
Visual Comparison
ruby/render/part_b_test/part_b_test_snapshots_web_page_generator.rb