CS 248 Assignment 1 Paint Program CS 248
- Slides: 25
CS 248 Assignment 1 Paint Program CS 248 Help Session #1 Original slides by Georg Petschnigg Modified by: Sean Walker, Rene Patnode Stanford University October 6, 2004 1
Session Overview l l Getting Started Assignment Discussion l l l Overpainting Brush Tinting Brush Visualization Grading Details Extra Credit Questions 2
Getting Started 1. 2. 3. Read assignment carefully and pay attention to the details. Go to help session Familiarize yourself with Raptor/Firebird Lab Located in the Basement of Sweet Hall 3
Development Environment l Ways to work with TA Support l l l Go to Sweet Hall (Best Way – 5 Minutes) Work Remotely (Good Way – 5 Minutes) Ways to work without TA support l l Reproduce Sweet Hall Lab development environment on you own Machine (1 Hour) Your code still has to work on the Sweet Hall machines (more risk for you) 4
Sweet Hall 1. 2. Pick a free computer, Log on Copy assignment from /usr/class/cs 248/assignments/assignment 1/ 3. 4. to local directory Run ‘make’ Run ‘. /paint. i 386 -linux’ 5
Working Remotely 1. 2. 3. ssh to firebird, raptor or leland (make sure X-tunneling is enabled) Export the display (using e. g. Exceed 3 D) Follow instructions on previous slide >ssh raptor. stanford. edu >setenv DISPLAY your. IP: 0. 0 >xterm & 6
Assignment Discussion l You are going to write a paint program l l Teaches you 2 D Raster Graphics Visualize concepts learned in Class (Brushes, HSV) Be creative with extra credit The next slides follow the Assignment (Handout #3) step by step l Reminder: Read the assignment 7
Paint Program 1973 Source: Dick Shoup “Super. Paint: An Early Frame Buffer Graphics System” IEEE Annals of the History of Computing, Vol 23, No 2, Apr-Jun 2001 8
Part 1: Over Painting Brush l Rectangular Overpainting Brush l l Like Microsoft Paint or “Pencil Tool” in Photo. Shop Color Picker for RGB, HSV l See http: //java. sun. com/docs/books/tutorial/uiswing/ components/colorchooser. html or any commercial paint program l l l Value (1. 0 bright, 0. 0 black) Saturation (1. 0 strong hue, 0. 0 faded hue) Size Control for Brush Demo: Painting, Picking Colors in Paint. Shop Pro 7 9
Part 1: Basic Painting Loop Brush region 10
Part 1: Over Painting Brush l Once you are done with Part 1 you should be able to draw some basic images l Notice the hard edges and jaggies around the stroke… this is what Part 2 will fix 11
Part 2: Tinting Brush l Implement Weighted Mask Driven Brush as described in Handout #4 l l Checkboxes for interpolating along H, S, V axis l l Instead of a rectangular brush, have it gently “blend” to its surroundings. Use HSV interpolation Allow all permutations HSV, HS, HV, SV, H, S, V Choose a mask function and give user control over it l Make sure it gradually falls off to zero at edges! 12
Part 2: Weighted Blending Like painting with partially transparent paint. Commonly referred to as “alpha” blending. Compositing equation Cnew = (1 - ) Cold + Cpaint 13
Part 2: Mask driven painting Lookup array determines how each pixel in the brush is affected. Paint every pixel in the brush region Paint only some of the pixels 14
Part 2: Weighted mask driven painting Mask contains alpha/weight for each pixel in brush 15
Part 2: RGB vs. HSV interpolation RGB interpolation New. R = (1 - ) Canvas. R + Paint. R New. G = (1 - ) Canvas. G + Paint. G New. B = (1 - ) Canvas. B + Paint. B HSV interpolation New. H = (1 - ) Canvas. H + Paint. H New. S = (1 - ) Canvas. S + Paint. S New. V = (1 - ) Canvas. V + Paint. V 16
Part 2: RGB vs. HSV Saturation Hue 17
Part 2: RGB vs. HSV interpolation Saturation Hue HSV RGB 18
Part 2: Math Example l l Interpolating half way between Red and Cyan ( = 0. 5) New. Color = 0. 5 Cyan + 0. 5 Red R G B H Cyan 0. 0 180 1. 0 Red 1. 0 0 1. 0 Interpolation 0. 5 90 1. 0 50% Gray S V Greenish 19
Part 2: HSV Checkboxes l l Choose which HSV components to affect. Allow for any combination. if (H_check) New. H = (1 - ) CH + Paint. H else New. H = CH; if (S_check) New. S = (1 - ) CS + Paint. S else New. S = CS; if (V_check) New. V = (1 - ) CV + Paint. V else New. V = CV; 20
Part 2: Sample Images Overpainting #1 vs. Weighted Mask driven painting #2 Image showing H, S, and V Tinting 21
Part 3: Brush Visualization l Brush Visualization should tell user what its color, falloff and size is l l Brush should always be visible regardless of color Draw 1 x (actual size) and 4 x (four times larger in x and y) versions of the brush Make the larger version discretized – that is it should be a choppy/chunky/pixel replicated version of the actual brush (think xmag, snoop) Make sure this visualization will help you explain to user, TAs, Professor and yourself how the brush weights affect drawing 22
Requirements l Correctness (40%) l l l Efficiency (20 %) l l l No noticeable lag while using your application User Interface (20%) Programming Style (20%) l l Don’t crash Implement all required features l (Read the directions like a lawyer) Copying code (Don’t do it) Submitting with ‘/usr/class/cs 248/bin/submit’ 23
Extra credit example Blurring: 24
Questions? l l Ask now Come to Office Hours Email: cs 248 -aut 0405 -tas@lists. stanford. edu Remember: Computer Graphics is fun - if you are not having fun ask TAs for help 25
- Simple past tense paint
- Ms paint assignment
- Ms paint assignment
- Paint assignment
- Paint program za crtanje
- Ms paint tools and functions
- Program do malowania paint
- Parecer imperfect tense
- Cs 248 stanford
- Bcbs 248
- Art 247 kpk
- Emt 248
- Tri state logic in microprocessor
- Emt 248
- Round to the nearest hundred thousand examples
- Emt 248
- Lxi assembly language
- Emt248
- Vp 248
- Pg 248
- Cs 248
- Emt 248
- H 248 rfc
- Comp 248 midterm
- Comp 248 midterm
- Engr 248