Your friend is trying to write a program that draws a square 200 pixels by 200 pixels and that looks like this square with colors red (red value 255), green (green value 255), blue (blue value 255) and magenta (red value 255 and blue value 255). All other RGB values are set to 0. by javascript
Answers
Answered by
0
Your friend is trying to write a program that draws a square 200 pixels by 200 pixels and that looks like this square with colors red (red value 255), green (green value 255), blue (blue value 255) and magenta (red value 255 and blue value 255). All other RGB values are set to 0. by javascript
Explanation:
var img = new SampleImage(200,200);
for (var px of img.values()){
var a = px.getA();
var b = px.getB();
if (a < img.getWidth()/2){
px.setRed(255);
}
if (b>img.getHeight()/2){
px.setBlue(255);
}
elseif {
px.setGreen(255);
}
}
print (img);
Similar questions
India Languages,
4 months ago
English,
4 months ago
English,
4 months ago
Computer Science,
9 months ago
Hindi,
9 months ago
Math,
1 year ago
English,
1 year ago