1
00:00:00,360 --> 00:00:05,150
So now it's time to create I'm fed inside this colorful class.

2
00:00:05,250 --> 00:00:12,310
So before the ending curly brace of these colorful class here I'm gonna say public so the access modifier

3
00:00:12,330 --> 00:00:13,530
of this method is public.

4
00:00:13,650 --> 00:00:16,530
Now I need to specify the return type of this method.

5
00:00:16,770 --> 00:00:19,750
The return type of this method is going to be bitmap.

6
00:00:19,820 --> 00:00:28,300
Write the name of this if it is going to be colorize colorize the beath map.

7
00:00:28,350 --> 00:00:38,180
OK so let's actually to change it to return return the colorize colorized bitmap because if it is you

8
00:00:38,180 --> 00:00:40,140
need to return a value of a bitmap.

9
00:00:40,150 --> 00:00:42,010
It's better to name it in this way.

10
00:00:42,040 --> 00:00:44,090
Return the colorized bitmap.

11
00:00:44,350 --> 00:00:45,700
So just put a pair of parenthesis.

12
00:00:45,760 --> 00:00:48,880
If it is going to it's not going to accept any parameters.

13
00:00:49,000 --> 00:00:51,780
So just open and close this method by using this curly braces.

14
00:00:52,000 --> 00:00:53,200
Let's say this.

15
00:00:53,240 --> 00:00:55,070
And let's see what you are going to do next.

16
00:00:56,700 --> 00:01:03,870
So first of all let me tell you that we actually created an instance variable inside our colorful class.

17
00:01:03,870 --> 00:01:10,110
Here it is in line number 13 you can see that we have an instance variable which is of type bitmap and

18
00:01:10,110 --> 00:01:10,910
this is private.

19
00:01:10,920 --> 00:01:12,490
The name is bitmap right.

20
00:01:12,510 --> 00:01:13,740
Let's scroll down here.

21
00:01:13,770 --> 00:01:19,460
Inside this method because this method is going to actually return a value of type bitmap.

22
00:01:19,470 --> 00:01:25,560
I am going to manipulate my instance variable which is of type bitmap so I'm going to actually first

23
00:01:25,560 --> 00:01:31,320
of all I'm going to get the width of the bitmap so I'm going to say eat wheat or bitmap.

24
00:01:31,410 --> 00:01:32,220
Actually bitmap

25
00:01:34,920 --> 00:01:38,120
assignment operator bitmap dots.

26
00:01:38,190 --> 00:01:41,420
Get with a semicolon right.

27
00:01:41,520 --> 00:01:50,970
Let's now actually get the height of that bitmap so it bitmap height bitmap height assignment operator

28
00:01:51,250 --> 00:01:54,810
base map that gets height.

29
00:01:54,900 --> 00:01:59,520
Let me introduce just they've been bitmap that gets height semi-colon.

30
00:01:59,670 --> 00:02:05,370
Right now I have the V and the height of my bitmap instance variable.

31
00:02:05,490 --> 00:02:07,770
So let's actually go in.

32
00:02:07,830 --> 00:02:10,700
Let's actually add some more logic here.

33
00:02:10,710 --> 00:02:15,000
Now it's time to get the formats of the bitmap.

34
00:02:15,000 --> 00:02:21,870
It is called conflict so I'm going to say bitmap data can't feek it is of type that can't be right.

35
00:02:21,870 --> 00:02:27,990
This is the type right the name is going to be bitmap config assignment operator.

36
00:02:27,990 --> 00:02:36,290
Now I'm going to refer to my instance variable which is called bitmap that gets conferee semicolon is

37
00:02:36,390 --> 00:02:42,130
going to get convicted if it is going it's going to ask to return the format of the bitmap.

38
00:02:42,150 --> 00:02:48,290
Now I'm going to create an order object of type bitmap and I'm going to assign it to another variable

39
00:02:48,300 --> 00:02:50,160
so let me show you how we can do that.

40
00:02:50,160 --> 00:02:54,870
So we're going to say bitmap that the data type up my body but that they are going to create the name

41
00:02:54,870 --> 00:03:01,030
of my value but is going to be my bitmap my bitmap assignment operator.

42
00:03:01,190 --> 00:03:08,050
Now because this is actually a local variable Let's actually change it to local bitmapped local bitmap

43
00:03:10,140 --> 00:03:15,620
because it is only alive inside the curly braces of this math right.

44
00:03:15,650 --> 00:03:15,910
Right.

45
00:03:15,920 --> 00:03:18,380
So it is called the local local bitmap.

46
00:03:18,390 --> 00:03:25,840
Now I'm going to say bitmapped that creates bitmap this it is going to actually create a bit map for

47
00:03:25,840 --> 00:03:26,410
us.

48
00:03:26,410 --> 00:03:29,050
First we need to specify the bitmap which.

49
00:03:29,290 --> 00:03:33,740
So if we have that bitmap it will come up bitmap height color.

50
00:03:33,850 --> 00:03:38,590
And finally we need to pass the bitmap config bitmap conflict in this way.

51
00:03:38,680 --> 00:03:45,460
We actually created an object of type bitmap we divied height and the conferee of the bitmap of the

52
00:03:45,460 --> 00:03:47,160
instance valuable here.

53
00:03:47,410 --> 00:03:52,130
And we as scientists created objects to this local bitmap valuable.

54
00:03:52,180 --> 00:03:55,510
Right now let's see what we are going to do next.

55
00:03:55,510 --> 00:04:00,370
So as you may already know and a picture consists of pixels.

56
00:04:00,370 --> 00:04:00,890
Right.

57
00:04:00,940 --> 00:04:08,410
So I'm going to actually get each pixel inside my image by using a for loop and an inner for loop.

58
00:04:08,410 --> 00:04:09,990
Let me show you how we can do that.

59
00:04:10,000 --> 00:04:15,990
Let me show you how we can actually iterate over the pixels of an image.

60
00:04:16,300 --> 00:04:21,240
So I'm going to say for so first we need to specify the initial value.

61
00:04:21,230 --> 00:04:26,880
So and row assignment operator 0 right semi-colon.

62
00:04:27,290 --> 00:04:32,630
Now I'm going to specify the condition that specifies how many times this for loop is going to be executed

63
00:04:33,110 --> 00:04:37,200
until the show is less than the value of this bitmap.

64
00:04:37,210 --> 00:04:41,300
With bitmap with semi-colon.

65
00:04:41,550 --> 00:04:46,470
And finally I'm going to say that after each execution of this for loop we're going to add one value

66
00:04:46,470 --> 00:04:49,720
to the value of this row valuable row plus plus.

67
00:04:49,920 --> 00:04:53,170
Let's open and closed this for a loop by using these curly braces.

68
00:04:53,220 --> 00:04:56,960
So here I am iterating over each pixel in one in one row.

69
00:04:57,180 --> 00:05:06,570
So I'm going to create another for loop and say this for a loop sign when I say for NKT column assignment

70
00:05:06,570 --> 00:05:08,880
operator zero semicolon.

71
00:05:08,880 --> 00:05:10,380
So this is the initial value.

72
00:05:10,650 --> 00:05:19,640
So what is the condition the condition is until Cullom is less than bitmapped height semi-colon column

73
00:05:19,660 --> 00:05:23,090
plus plus that's it.

74
00:05:23,300 --> 00:05:26,630
Let's open and closed this for loop by using these curly braces.

75
00:05:26,630 --> 00:05:28,920
Now inside this for loop I can't say.

76
00:05:28,940 --> 00:05:30,190
So what does this mean.

77
00:05:30,200 --> 00:05:30,820
This for a loop.

78
00:05:30,890 --> 00:05:35,420
This means that you're either reading over each column of each row.

79
00:05:35,690 --> 00:05:36,150
Right.

80
00:05:36,170 --> 00:05:42,160
In this way if you are iterating over each pixel of our image our piece not actually right.

81
00:05:42,170 --> 00:05:47,450
So let's go inside this for loop and here inside the curly braces of this inner loop I can say here

82
00:05:47,460 --> 00:05:51,580
we can get the color of each pixel how we can do that.

83
00:05:51,650 --> 00:05:58,790
So create and it is a variable and the name of this variable is going to be pixel color write assignment

84
00:05:58,790 --> 00:06:06,480
operator here I'm going to refer to my instance variable which is called bitmaps I'm going to say bitmap

85
00:06:08,440 --> 00:06:12,800
dot get pixel bitmap that get pixel.

86
00:06:13,110 --> 00:06:16,140
Now we need to pass the row and the color.

87
00:06:16,380 --> 00:06:23,440
So we have the ROW comma column semicolon in the way it's going to get each pixel.

88
00:06:24,480 --> 00:06:29,960
Of our image and it's going to assign that value which is going to be a colored value right.

89
00:06:29,970 --> 00:06:32,290
And it's going to assign it to this value of a pixel color.

90
00:06:32,460 --> 00:06:37,150
It's going to get the color of each pixel and it's going to assign to this variable pixel color right.

91
00:06:37,380 --> 00:06:44,040
So after this line of code let's be fair because we want to actually change the color of each pixel

92
00:06:44,070 --> 00:06:45,080
of our image.

93
00:06:45,360 --> 00:06:51,480
I'm going to again refer to this pixel color assignment operator and I'm going to use this MFL color

94
00:06:51,540 --> 00:06:55,260
with capital C. OK color dot R G B.

95
00:06:55,290 --> 00:06:57,070
Use this method.

96
00:06:57,180 --> 00:07:01,760
So let's look at this if it is if it needs four arguments the first one is going to be the alpha.

97
00:07:02,070 --> 00:07:04,450
The second argument is going to be the color red.

98
00:07:04,680 --> 00:07:10,110
The first argument is going to be the color green and the fourth argument is going to be the color blue.

99
00:07:10,110 --> 00:07:13,960
So first we need to specify the Alfar of the pixel color.

100
00:07:15,800 --> 00:07:24,490
So here I can say that again the first of these color class with capital C dot Alpha.

101
00:07:25,310 --> 00:07:29,170
And here we need to pass an argument which is going to be half integer.

102
00:07:29,180 --> 00:07:35,060
And as you can see its name is color so this color is referring to the pixel color right.

103
00:07:35,090 --> 00:07:41,370
I'm going to get the same Alfar of my pixel color that we have inside our bitmapped the same alpha.

104
00:07:41,390 --> 00:07:43,830
So peaks color or just pass the piece of color here.

105
00:07:43,850 --> 00:07:46,020
So now I need to specify the color red.

106
00:07:46,430 --> 00:07:49,950
So not is that inside this for loop inside this inner fall.

107
00:07:49,960 --> 00:07:52,860
Actually we are changing or we are.

108
00:07:52,940 --> 00:07:58,260
In other words we are colorizing each pixel inside our Peetz map right.

109
00:07:58,310 --> 00:08:04,250
So you may notice that if we have some instance variables that may show this instance variables for

110
00:08:04,250 --> 00:08:07,730
the red colored value green color value and blue color value.

111
00:08:07,730 --> 00:08:14,440
So these instance variables these values are going to impact the color of each pixel right.

112
00:08:14,450 --> 00:08:16,760
This is the goal of this class actually.

113
00:08:16,820 --> 00:08:24,880
So here for the red color I'm going to say red color value multiplied by.

114
00:08:25,340 --> 00:08:32,420
So I'm going to multiply this value by the value of the red color actually so color does red with actually

115
00:08:32,460 --> 00:08:39,170
lowercase are color that red and this it needs an argument of type integer which is going to be the

116
00:08:39,530 --> 00:08:46,570
pixel color because I want to change the color of each piece so I'm going to pass pixel color right.

117
00:08:46,620 --> 00:08:50,130
So now it's actually showing us an error if we hovered over this area.

118
00:08:50,130 --> 00:09:00,060
It says that it's going to actually give us a value of type float because the lead color value is actually

119
00:09:00,240 --> 00:09:07,620
a float and the result of this operation here is going to be a value of a flawed color that red here

120
00:09:07,650 --> 00:09:11,480
is actually of that integer and this value is a float.

121
00:09:11,490 --> 00:09:16,920
The result of this operation is going to be flawed so we need to cast this red colored value to an integer

122
00:09:16,920 --> 00:09:17,830
value.

123
00:09:18,150 --> 00:09:18,950
How we can't do that.

124
00:09:18,990 --> 00:09:24,930
So before this varicolored value after the comma I want to put a pair of practices and instead of parenthesis

125
00:09:24,930 --> 00:09:27,300
just type in it that's it.

126
00:09:27,300 --> 00:09:28,600
Now the error is gone.

127
00:09:28,860 --> 00:09:31,290
So let's specify the other arguments.

128
00:09:31,320 --> 00:09:36,400
So after this second argument which is going to be space which is going to specify the red color comma

129
00:09:37,130 --> 00:09:40,450
and now I need to specify the color green.

130
00:09:40,470 --> 00:09:45,760
So again I'm going to say green color green color value right.

131
00:09:45,780 --> 00:09:49,630
Which is of type float multiplied by colored dots.

132
00:09:49,670 --> 00:09:56,000
Green and when we need to pass the piece of color here because we want to actually to change the pixel

133
00:09:56,000 --> 00:09:59,460
color right the color of each pixel if you want to colorized it.

134
00:09:59,600 --> 00:10:06,620
So we are using this green color value in order to impact each pixel and we are multiplying these two

135
00:10:06,620 --> 00:10:07,250
values to get there.

136
00:10:07,250 --> 00:10:08,360
So again it is flawed.

137
00:10:08,410 --> 00:10:10,680
We need to actually cast it to an integer value.

138
00:10:10,730 --> 00:10:15,320
So just pull a pair of Prentice's instead Apprentice's just open here and that's it.

139
00:10:15,320 --> 00:10:19,810
Now it's time to specify the final argument which is going to be the blue color.

140
00:10:19,820 --> 00:10:28,580
So again blue color value multiplied by color that blue Apprentice's I can easily refer to this pixel

141
00:10:28,580 --> 00:10:29,200
color.

142
00:10:29,210 --> 00:10:30,760
So again it is of type float.

143
00:10:30,770 --> 00:10:33,900
This blue color values of the float indicated an integer value.

144
00:10:33,920 --> 00:10:36,270
So just put up for Apprentice's here before its name.

145
00:10:36,590 --> 00:10:37,570
And just like in here.

146
00:10:37,730 --> 00:10:42,290
Now it is tested to an integer value and the result of this operation is going to be half that integer

147
00:10:42,560 --> 00:10:46,730
so that we have no problems passing this argument at the end of your statement.

148
00:10:46,730 --> 00:10:48,260
We must put a semicolon.

149
00:10:48,410 --> 00:10:52,710
So let me try to create a new line here so that you can see these values better.

150
00:10:52,970 --> 00:10:54,550
So you can see all these values here.

151
00:10:54,560 --> 00:11:02,120
First we are specifying the color Alfar by using that piece of color alpha here then we are specifying

152
00:11:02,120 --> 00:11:03,430
the actual red color.

153
00:11:03,440 --> 00:11:09,650
So notice that here when I say color that Alpha we want to specify to actually take Alpher of the pixel

154
00:11:09,650 --> 00:11:16,030
color which is going to be the same Alpher of the bitmap image that is going to be taken by the user

155
00:11:16,050 --> 00:11:17,460
by using the camera.

156
00:11:17,510 --> 00:11:20,350
So and then we need to specify the red color value.

157
00:11:20,690 --> 00:11:26,690
So if you want to colorize each pixel here and then that green color value and that and in blue color

158
00:11:26,690 --> 00:11:31,470
value so that you can actually later see how we can colorize our image.

159
00:11:31,760 --> 00:11:37,100
Hopefully it does make sense and if it doesn't make sense don't worry you can actually push the discussion

160
00:11:37,100 --> 00:11:43,100
in the course and all you can always out this tutorial over and over again until it makes sense.

161
00:11:43,400 --> 00:11:45,580
And it's not that hard.

162
00:11:45,590 --> 00:11:46,480
It's so simple.

163
00:11:46,610 --> 00:11:49,630
But make sure to ask questions.

164
00:11:49,640 --> 00:11:53,550
If you if you've got any questions please post or discussion it of course.

165
00:11:53,570 --> 00:12:03,070
So now here now that we actually colorize each pixel now it's time to look at our local bitmap my valuable

166
00:12:03,240 --> 00:12:03,660
here.

167
00:12:03,680 --> 00:12:06,740
We created this valuable inline number 95.

168
00:12:07,190 --> 00:12:16,370
So after colorizing each pixel here I'm going to say look Quilpie is map dot said Peaks of local bitmap

169
00:12:16,370 --> 00:12:17,890
that said pixel.

170
00:12:18,150 --> 00:12:25,010
And now first of all we need to specify the actually read and then for the second argument we need to

171
00:12:25,010 --> 00:12:26,440
specify the height.

172
00:12:26,660 --> 00:12:30,820
And finally you need to specify that pixel color right.

173
00:12:30,890 --> 00:12:32,250
The color of each pixel.

174
00:12:32,270 --> 00:12:33,590
So we have that beat right.

175
00:12:33,590 --> 00:12:40,240
I can't say bitmap with comma bitmap height comma.

176
00:12:40,320 --> 00:12:48,240
Finally we have the pixel color that sits and because the return type of this method is actually bitmap.

177
00:12:48,330 --> 00:12:54,960
We must return a value of type bitmap so I'm going to return this local bitmap from this method.

178
00:12:54,960 --> 00:13:01,740
So after the end in curly brace of this for a loop here and before the end in curly brace of the Smurfette

179
00:13:02,400 --> 00:13:04,320
I'm going to just re type in here.

180
00:13:04,320 --> 00:13:07,980
Return local bitmap semicolon.

181
00:13:08,160 --> 00:13:08,700
So that's it.

182
00:13:08,700 --> 00:13:10,760
Now we have no errors here.

183
00:13:10,770 --> 00:13:12,220
This is our method.

184
00:13:12,300 --> 00:13:14,740
Now it's time to use this method.

185
00:13:14,760 --> 00:13:17,590
It's time to go to the main activity class and use this method.

186
00:13:17,760 --> 00:13:19,190
So it and I thought you we're going to do that.

