Download presentation
Presentation is loading. Please wait.
1
Chapter 15, Images …a few points
2
All about tinting Tint is essentially equivalent to fill(), setting the color and alpha transparency. Functions are tint() and noTint() Example: tint(0, 255, 0, 127) will give green tint with 50% opacity You can also use hexadecimal colors, e.g. tint(#FF0000, 50) will be a red tint, with near complete transparency.
3
Syntax of Tint and Alpha
Alpha is from 0-255, where: 0 is completely transparent 255 is completely opaque Alpha tint(rgb) tint(rgb, alpha) tint(gray) tint(gray, alpha) tint(v1, v2, v3) tint(v1, v2, v3, alpha) Tint
4
First Example: Original tint(255, 100); That is…
Shows rainbow row behind waterfront pineapple. That is… white for NO color change, and 100 for partial transparency
5
Another Example: tint(255, 0, 0); Or tint(#FF0000);
Shows a red tint with no transparency
6
Another Example: background(0); tint(0,200,255 ); background(0);
…blue/green with no transparency background(0); tint(0,200,255,50); …blue/green with high transparency against black background.
7
About Arrays An array is a special variable, which can hold a collection of elements of the same type. When to use? Anytime a program requires multiple instances of similar data, consider it… Examples?
8
More About Arrays Each element in an array has a unique position.
Arrays start with 0. Arrays have a fixed size.
9
Declaring and Initializing Arrays
Declaring: int [] myArray Initializing: There are several ways, e.g. int [] myArray = { 1, 3, 6, 9, 12, 15};
10
Accessing elements in Arrays
Many ways… See Example 9-5 which uses a loop to access items in the loop. (Pg 171)
11
2D vs 1D array This is how pixels on the screen looks for a tiny sketch 6 width X 5 height Etc. This is how processing stores the pixels. You can manipulate pixels directly on screen; not only through primitive shapes. You can do this through the pixels[] array.
12
Example page 311 Since each pixel in the 300X200 screen is a number, equate each with a random grayscale between ?? Suppose you want to lighten the grayscale up ?? Suppose you want RGB colors
13
Finding exact location of a pixel
Consider width and height The total pixels is width * height For any given point, the location is: theLocation = x + (y * width); Remember, that we’re seeing 2-D for the 13 location, but processing measures by 1-D.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.