@@ 307-343 (lines=37) @@ | ||
304 | /** |
|
305 | * Read BlipJPEG record. Holds raw JPEG image data |
|
306 | */ |
|
307 | private function readBlipJPEG() |
|
308 | { |
|
309 | // offset: 0; size: 2; recVer and recInstance |
|
310 | ||
311 | // bit: 4-15; mask: 0xFFF0; recInstance |
|
312 | $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; |
|
313 | ||
314 | $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); |
|
315 | $recordData = substr($this->data, $this->pos + 8, $length); |
|
316 | ||
317 | // move stream pointer to next record |
|
318 | $this->pos += 8 + $length; |
|
319 | ||
320 | $pos = 0; |
|
321 | ||
322 | // offset: 0; size: 16; rgbUid1 (MD4 digest of) |
|
323 | $rgbUid1 = substr($recordData, 0, 16); |
|
324 | $pos += 16; |
|
325 | ||
326 | // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3 |
|
327 | if (in_array($recInstance, [0x046B, 0x06E3])) { |
|
328 | $rgbUid2 = substr($recordData, 16, 16); |
|
329 | $pos += 16; |
|
330 | } |
|
331 | ||
332 | // offset: var; size: 1; tag |
|
333 | $tag = ord($recordData{$pos}); |
|
334 | $pos += 1; |
|
335 | ||
336 | // offset: var; size: var; the raw image data |
|
337 | $data = substr($recordData, $pos); |
|
338 | ||
339 | $blip = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip(); |
|
340 | $blip->setData($data); |
|
341 | ||
342 | $this->object->setBlip($blip); |
|
343 | } |
|
344 | ||
345 | /** |
|
346 | * Read BlipPNG record. Holds raw PNG image data |
|
@@ 348-384 (lines=37) @@ | ||
345 | /** |
|
346 | * Read BlipPNG record. Holds raw PNG image data |
|
347 | */ |
|
348 | private function readBlipPNG() |
|
349 | { |
|
350 | // offset: 0; size: 2; recVer and recInstance |
|
351 | ||
352 | // bit: 4-15; mask: 0xFFF0; recInstance |
|
353 | $recInstance = (0xFFF0 & \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt2d($this->data, $this->pos)) >> 4; |
|
354 | ||
355 | $length = \PhpOffice\PhpSpreadsheet\Reader\Xls::getInt4d($this->data, $this->pos + 4); |
|
356 | $recordData = substr($this->data, $this->pos + 8, $length); |
|
357 | ||
358 | // move stream pointer to next record |
|
359 | $this->pos += 8 + $length; |
|
360 | ||
361 | $pos = 0; |
|
362 | ||
363 | // offset: 0; size: 16; rgbUid1 (MD4 digest of) |
|
364 | $rgbUid1 = substr($recordData, 0, 16); |
|
365 | $pos += 16; |
|
366 | ||
367 | // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3 |
|
368 | if ($recInstance == 0x06E1) { |
|
369 | $rgbUid2 = substr($recordData, 16, 16); |
|
370 | $pos += 16; |
|
371 | } |
|
372 | ||
373 | // offset: var; size: 1; tag |
|
374 | $tag = ord($recordData{$pos}); |
|
375 | $pos += 1; |
|
376 | ||
377 | // offset: var; size: var; the raw image data |
|
378 | $data = substr($recordData, $pos); |
|
379 | ||
380 | $blip = new \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip(); |
|
381 | $blip->setData($data); |
|
382 | ||
383 | $this->object->setBlip($blip); |
|
384 | } |
|
385 | ||
386 | /** |
|
387 | * Read OPT record. This record may occur within DggContainer record or SpContainer |