(SSOL) Simple Shape Oriented Language

Similar documents
SSOL Language Reference Manual

EXAMINATIONS 2016 TRIMESTER 2

03 Vector Graphics. Multimedia Systems. 2D and 3D Graphics, Transformations

Solution Notes. COMP 151: Terms Test

BASIC ELEMENTS OF A COMPUTER PROGRAM

OBJECT ORIENTED PROGRAMMING

easel Manager Danielle Crosswell dac2182 Language Guru Tyrus Cukavac thc2125 System Architect Yuan-Chao Chou yc3211 Tester Xiaofei Chen xc2364

Chapter 3. Texture mapping. Learning Goals: Assignment Lab 3: Implement a single program, which fulfills the requirements:

1 Getting started with Processing

blur (.blr) Project Proposal Dexter Callender dec2148 Tim Goodwin tlg2132 Daniel Hong sh3266 Melissa Kaufman-Gomez mhk2149

Programming Fundamentals

Chapter-8 DATA TYPES. Introduction. Variable:

CISC 1600 Lecture 3.1 Introduction to Processing

Ai Adobe. Illustrator. Creative Cloud Beginner

Midterm I - CSE11 Fall 2013 CLOSED BOOK, CLOSED NOTES 50 minutes, 100 points Total.

Scalable Vector Graphics (SVG) vector image World Wide Web Consortium (W3C) defined with XML searched indexed scripted compressed Mozilla Firefox

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

A foundation for programming. Classes and objects. Overview. Java primitive types. Primitive types Creating your own data types

Generating Vectors Overview

Lexical Considerations

How to create shapes. Drawing basic shapes. Adobe Photoshop Elements 8 guide

EXAMINATIONS 2017 TRIMESTER 2

CMPT-166: Sample Midterm

Problem 1. Multiple Choice (choose only one answer)

Simple Java Reference

Inkscape Tutorial. v2.0. Simon Andrews.

PROGRAMMING FUNDAMENTALS

Vectorization Using Stochastic Local Search

CLASSES AND OBJECTS. Fundamentals of Computer Science I

Java: Classes. An instance of a class is an object based on the class. Creation of an instance from a class is called instantiation.

Question 1 (10 points) Write the correct answer in each of the following: a) Write a Processing command to create a canvas of 400x300 pixels:

CLASSES AND OBJECTS. Fundamentals of Computer Science I

Introduction to Programming Using Java (98-388)

Selected Questions from by Nageshwara Rao

Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Adobe Photoshop Sh S.K. Sublania and Sh. Naresh Chand

Class #1. introduction, functions, variables, conditionals

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

5 Drawing Stuff in 2D

1st Point. 2nd Point. hold shift & drag along Y. Splines

INKSCAPE INTRODUCTION COMPONENTS OF INKSCAPE MENU BAR

Lexical Considerations

Getting Started in Java CIS 110

OUTLINE. Learn the basic design of a graphics system Introduce pipeline architecture Examine software components for a graphics system

CONCISE SLIDES LANGUAGE (CSL) PROJECT PROPOSAL

Exercise: Using Numbers

Computational Expression

Java Class Design. Eugeny Berkunsky, Computer Science dept., National University of Shipbuilding

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

WARM UP LESSONS BARE BASICS

DC2 File Format. 1. Header line 2. Entity line 3. Point line 4. String line

1. Complete these exercises to practice creating user functions in small sketches.

SFPL Reference Manual

Exam 1 - (20 points)

PieNum Language Reference Manual

To specify the dimensions of the drawing canvas use the size statement: ! size( 300, 400 );

COMP Summer 2015 (A01) Jim (James) Young jimyoung.ca

CONTENTS IN DETAIL. What s in This Book?... xx Who Is This Book For?... xx

Conversion SDK v11 32-bit and 64-bit

1 Epic Test Review 2 Epic Test Review 3 Epic Test Review 4. Epic Test Review 5 Epic Test Review 6 Epic Test Review 7 Epic Test Review 8

Programming in C++ Prof. Partha Pratim Das Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

Pick a number. Conditionals. Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary. CS Conditionals 1

INKSCAPE BASICS. 125 S. Prospect Avenue, Elmhurst, IL (630) elmhurstpubliclibrary.org. Create, Make, and Build

Class API. Class API. Constructors. CS200: Computer Science I. Module 19 More Objects

University of Cincinnati. P5.JS: Getting Started. p5.js

CISC 1600, Lab 3.1: Processing

Java Simple Data Types

Photoshop Introduction to The Shape Tool nigelbuckner This handout is an introduction to get you started using the Shape tool.

Recall that creating or declaring a variable can be done as follows:

An Introduction to 2D OpenGL

Designing effective scientific figures Introduction to Inkscape to finalise figures

Basic Computer Programming (Processing)

CS110 Introduction to Computing Fall 2016 Practice Exam 1 -- Solutions

CS 251 Intermediate Programming Methods and Classes

CS 251 Intermediate Programming Methods and More

1- Write a single C++ statement that: A. Calculates the sum of the two integrates 11 and 12 and outputs the sum to the consol.

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

How to draw and create shapes

The pixelman Language Reference Manual. Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau

CSC324 Principles of Programming Languages

1.3b Type Conversion

A First Program - Greeting.cpp

Use the template below and fill in the areas in Red to complete it.

CS242 COMPUTER PROGRAMMING

CISC 1600, Lab 2.1: Processing

Question 2. [5 points] Given the following symbolic constant definition

CS3621 Midterm Solution (Fall 2005) 150 points

Objectives. Introduce static keyword examine syntax describe common uses

GIMP WEB 2.0 ICONS. GIMP is all about IT (Images and Text) OPEN GIMP

c.def (pronounced SEE-def) Language Reference Manual

Computer Science II (20082) Week 1: Review and Inheritance

CSC Java Programming, Fall Java Data Types and Control Constructs

Using Methods. Writing your own methods. Dr. Siobhán Drohan Mairead Meagher. Produced by: Department of Computing and Mathematics

Object-Oriented Programming Concepts

Assignment 3: Inheritance

creating files and saving for web

Arithmetic Expressions in C

This is the vector graphics "drawing" technology with its technical and creative beauty. SVG Inkscape vectors

S206E Lecture 13, 5/22/2016, Grasshopper Math and Logic Rules

Custom Shapes As Text Frames In Photoshop

Transcription:

(SSOL) Simple Shape Oriented Language Madeleine Tipp Jeevan Farias Daniel Mesko mrt2148 jtf2126 dpm2153 Description: SSOL is a programming language that simplifies the process of drawing shapes to SVG files. It will feature built-in types to represent geometric shapes and standard library operations to render them in SVG files. To output to an SVG file, the programmer must instantiate a Canvas object, and add at least one element object to it. The Canvas object can then be passed to the draw() library function with a String filename to create an SVG file. Elements are added to a Canvas object programmatically-- the Canvas is essentially a queue. When a Canvas is drawn, the last element to be added to the canvas gets the highest z-index. There are four types that represent elements: Ellipses, Polygons, Lines, and Bezier curves. Ellipses and Polygons are defined by point (a 2D pixel location) and a radius and/or sidelength. Lines are defined by two points. A Bezier curve is a parametrically defined curve with a beginning and ending anchor point and a control point for each. Our language encodes the data for each shape that the user creates. Upon running of the executable created by compilation, this data is rendered in SVG format. Types of programs to be written in the language: The intended use of SSOL is creating images. The user defines the size of their canvas along with the size, location, and orientation of the various shapes that they would like to put on it using the draw() function. Without calling draw(), SSOL functions as a minimal, general purpose programming language similar to C. Types: Primitives: Type Definition Example int Signed integers 5, -5 float Floating point decimals 3.2, -4.7

bool Boolean values True, False char ASCII characters Z, 7 String Array of chars abcd, hello Array Sequential block of a variables of a particular type int nums[5]; nums[3] = 100; Complex Types: The following built-in types are represented as objects. Each has its own constructor, that modify certain public fields of the object. For the types Line, Bezier, Ellipse, and Poly, there are private fields for fill and stroke colors (in RGB and Alpha values), that can only be modified by the fill() and stroke() functions. The Canvas object contains a private pointer to the first element (either a Line, Bezier, Ellipse, or Poly), and each element contains a private pointer to the next element in the Canvas. The last element has 0 for this value. Object Description Constructor Parameters Functions Canvas Represents the window in which the elements are drawn. length (float) - pixel length width (float) - pixel width Line Straight line between 2 points. x1 (float) - x coordinate of first point y1 (float) - y coordinate of first point x2 (float) - x coordinate of second point y2 (float) - y coordinate of second point Bezier A bezier curve with 2 anchor points and 2 control points. x1 (float) - x coordinate of first anchor point (origin) y1 (float) - y coordinate of first anchor point (origin) x2 (float) - x coordinate of first control point

y2 (float) - y coordinate of first control point x3 (float) - x coordinate of second control point y3 (float) - y coordinate of second control point x4 (float) - x coordinate of second anchor point y4 (float) - y coordinate of second anchor point Ellipse Elliptical shape with a point, x axis, and y axis. Center point is origin. x (float) - x coordinate of y (float) - y coordinate of xaxis (float) - length along x axis yaxis (float) - length along y axis fill(float, float, float, float) - takes R,G,B, and Alpha values, respectively, for fill colors. Poly Regular polygon shapes defined by number of sides and side length. Center point is origin. x (float) - x coordinate of y (float) - y coordinate of sidelen (float) - length of each side numsides (float) - number of sides fill(float, float, float, float) - takes R,G,B, and Alpha values, respectively, for fill colors.

Keywords: // this is a comment (multi-line comments not supported) Keyword if while for return Usage Control flow Looping structure Looping structure Designates end of function, followed by value to be returned (if non-void function) Operators: Operator Usage Example +, -, *, /, % Addition, subtraction, multiplication, division, mod 5 + 4 7-2 6 * 3 = Assignment x = 5 ==,!= Equality 5!= 10 <, >, <=, >= Comparison 6 > 3 &&,,! Logical AND, OR, NOT operators 5 Sequentially group elements to add to Canvas object = Add elements to existing Canvas object Canvas x = e1 e2; x = e3 e4; Library Functions: Function Description

draw(canvas, String) rotate([line, Bezier, Ellipse, Poly], float) translate([line, Bezier, Ellipse, Poly], float, float) random(int, int) Void. This function outputs an SVG image with all the information stored in the Canvas object. The second parameter is the filename. When the executable is run, it will make as many output files as there are draw() calls. [Line, Bezier, Ellipse, Poly]. Can rotate any element around its origin point by a value specified in degrees. Returns a copy of element. [Line, Bezier, Ellipse, Poly]. Reposition element with respect to its origin. Returns a copy of element. Int. Takes a range of integers between the values of 0 and 255 and picks a random integer value within that range as the RGB value. This will be linked to the C random function. Sample Program: Triangles and Squares This program makes a simple design. A square canvas of 100x100px default size. 4 squares make up a frame, each with a random stroke color. In the is a star made up of 10 triangles each with a random stroke and fill color that are rotated 36 degrees more than the previous and are layered on top of each other. Triangles have 50% opacity. int main(){ //create a canvas with default size of 100x100px Canvas mycanvas = Canvas(100,100); for(int i = 0; i < 10; i++){ //create triangle and rotate Poly tri = Poly(50,50,20,3); tri = rotate(tri, i/10 * 360); tri.stroke(random(0,255),random(0,255),radom(0,255)); tri.fill(random(0,255),random(0,255),random(0,255),0.5); mycanvas = tri; }

} for (int i=0; i<4; i++){ Poly square = Poly(50,50,100-i*3,4); square.fill(random(0,255),random(0,255), random(0,255),0.5); } draw(mycanvas, myfile ); return 0;