Lines Matching full:this

9   this.pos = 0;
10 this.buffer = buffer;
11 this.is_with_alpha = !!is_with_alpha;
13 if (this.buffer[0] != 66 && this.buffer[1] != 77) throw new Error("Invalid BMP File");
14 this.pos += 2;
15 this.parseHeader();
16 this.parseBGR();
20 var b = this.buffer;
21this.fileSize = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
22 this.pos += 4;
23this.reserved = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
24 this.pos += 4;
25 this.offset = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
26 this.pos += 4;
27this.headerSize = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.po…
28 this.pos += 4;
29 this.width = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
30 this.pos += 4;
31 this.height = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
32 this.pos += 4;
33 this.planes = (b[this.pos+1] << 8) | b[this.pos];
34 this.pos += 2;
35 this.bitPP = (b[this.pos+1] << 8) | b[this.pos];
36 this.pos += 2;
37this.compress = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos]…
38 this.pos += 4;
39this.rawSize = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
40 this.pos += 4;
41 this.hr = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
42 this.pos += 4;
43 this.vr = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
44 this.pos += 4;
45 this.colors = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[this.pos];
46 this.pos += 4;
47this.importantColors = (b[this.pos+3] << 24) | (b[this.pos+2] << 16) | (b[this.pos+1] << 8) | b[th…
48 this.pos += 4;
50 if(this.bitPP === 16 && this.is_with_alpha){
51 this.bitPP = 15
53 if (this.bitPP < 15) {
54 var len = this.colors === 0 ? 1 << this.bitPP : this.colors;
55 this.palette = new Array(len);
57 var blue = this.buffer[this.pos++];
58 var green = this.buffer[this.pos++];
59 var red = this.buffer[this.pos++];
60 var quad = this.buffer[this.pos++];
61 this.palette[i] = {
73 this.pos = this.offset;
75 var bitn = "bit" + this.bitPP;
79 var imageData = ctx.createImageData(this.width, this.height);
80 this.imageData = imageData;
81 this.data = imageData.data;
83 this[bitn]();
91 var xlen = Math.ceil(this.width / 8);
93 for (var y = this.height - 1; y >= 0; y--) {
95 var b = this.buffer[this.pos++];
96 var location = y * this.width * 4 + x*8*4;
98 if(x*8+i<this.width){
99 var rgb = this.palette[((b>>(7-i))&0x1)];
100 this.data[location+i*4] = rgb.red;
101 this.data[location+i*4 + 1] = rgb.green;
102 this.data[location+i*4 + 2] = rgb.blue;
103 this.data[location+i*4 + 3] = 0xFF;
111 this.pos+=(4 - mode);
117 var xlen = Math.ceil(this.width/2);
119 for (var y = this.height - 1; y >= 0; y--) {
121 var b = this.buffer[this.pos++];//this.buffer.readUInt8(this.pos++);
122 var location = y * this.width * 4 + x*2*4;
127 var rgb = this.palette[before];
128 this.data[location] = rgb.red;
129 this.data[location + 1] = rgb.green;
130 this.data[location + 2] = rgb.blue;
131 this.data[location + 3] = 0xFF;
133 if(x*2+1>=this.width)break;
135 rgb = this.palette[after];
136 this.data[location+4] = rgb.red;
137 this.data[location+4 + 1] = rgb.green;
138 this.data[location+4 + 2] = rgb.blue;
139 this.data[location+4 + 3] = 0xFF;
143 this.pos+=(4 - mode);
150 var mode = this.width%4;
151 for (var y = this.height - 1; y >= 0; y--) {
152 for (var x = 0; x < this.width; x++) {
153 var b = this.buffer[this.pos++];
154 var location = y * this.width * 4 + x*4;
155 if(b < this.palette.length) {
156 var rgb = this.palette[b];
157 this.data[location] = rgb.red;
158 this.data[location + 1] = rgb.green;
159 this.data[location + 2] = rgb.blue;
160 this.data[location + 3] = 0xFF;
162 this.data[location] = 0xFF;
163 this.data[location + 1] = 0xFF;
164 this.data[location + 2] = 0xFF;
165 this.data[location + 3] = 0xFF;
169 this.pos+=(4 - mode);
177 var dif_w = (this.width * 2) % 4;
182 for (var y = this.height - 1; y >= 0; y--) {
183 for (var x = 0; x < this.width; x++) {
185 var B = (this.buffer[this.pos+1] << 8) | this.buffer[this.pos];
186 this.pos+=2;
192 var location = y * this.width * 4 + x * 4;
193 this.data[location] = red;
194 this.data[location + 1] = green;
195 this.data[location + 2] = blue;
196 this.data[location + 3] = alpha;
199 this.pos += dif_w;
206 var dif_w = (this.width * 2) % 4;
212 for (var y = this.height - 1; y >= 0; y--) {
213 for (var x = 0; x < this.width; x++) {
215 var B = (this.buffer[this.pos+1] << 8) | this.buffer[this.pos];
216 this.pos+=2;
222 var location = y * this.width * 4 + x * 4;
223 this.data[location] = red;
224 this.data[location + 1] = green;
225 this.data[location + 2] = blue;
226 this.data[location + 3] = alpha;
229 this.pos += dif_w;
236 var dif_w = ((this.width * 3) % 4);
240 for (var y = this.height - 1; y >= 0; y--) {
241 for (var x = 0; x < this.width; x++) {
242 var blue = this.buffer[this.pos++];
243 var green = this.buffer[this.pos++];
244 var red = this.buffer[this.pos++];
245 var location = y * this.width * 4 + x * 4;
246 this.data[location] = red;
247 this.data[location + 1] = green;
248 this.data[location + 2] = blue;
249 this.data[location + 3] = 0xFF;
252 this.pos += dif_w;
263 for (var y = this.height - 1; y >= 0; y--) {
264 for (var x = 0; x < this.width; x++) {
265 var blue = this.buffer[this.pos++];
266 var green = this.buffer[this.pos++];
267 var red = this.buffer[this.pos++];
268 var alpha = this.buffer[this.pos++];
269 var location = y * this.width * 4 + x * 4;
271 this.data[location] = red;
272 this.data[location + 1] = green;
273 this.data[location + 2] = blue;
274 this.data[location + 3] = alpha;
282 return this.data;