Lines Matching refs:this

175 		$this->MAX_LZW_BITS = 12;
176 unSet($this->Next);
177 unSet($this->Vals);
178 unSet($this->Stack);
179 unSet($this->Buf);
181 $this->Next = range(0, (1 << $this->MAX_LZW_BITS) - 1);
182 $this->Vals = range(0, (1 << $this->MAX_LZW_BITS) - 1);
183 $this->Stack = range(0, (1 << ($this->MAX_LZW_BITS + 1)) - 1);
184 $this->Buf = range(0, 279);
196 $this->LZWCommand($data, true);
198 while (($iIndex = $this->LZWCommand($data, false)) >= 0) {
216 $this->SetCodeSize = ord($data[0]);
219 $this->CodeSize = $this->SetCodeSize + 1;
220 $this->ClearCode = 1 << $this->SetCodeSize;
221 $this->EndCode = $this->ClearCode + 1;
222 $this->MaxCode = $this->ClearCode + 2;
223 $this->MaxCodeSize = $this->ClearCode << 1;
225 $this->GetCode($data, $bInit);
227 $this->Fresh = 1;
228 for ($i = 0; $i < $this->ClearCode; $i++) {
229 $this->Next[$i] = 0;
230 $this->Vals[$i] = $i;
233 for (; $i < (1 << $this->MAX_LZW_BITS); $i++) {
234 $this->Next[$i] = 0;
235 $this->Vals[$i] = 0;
238 $this->sp = 0;
242 if ($this->Fresh) {
243 $this->Fresh = 0;
245 $this->FirstCode = $this->GetCode($data, $bInit);
246 $this->OldCode = $this->FirstCode;
248 while ($this->FirstCode == $this->ClearCode);
250 return $this->FirstCode;
253 if ($this->sp > 0) {
254 $this->sp--;
255 return $this->Stack[$this->sp];
258 while (($Code = $this->GetCode($data, $bInit)) >= 0) {
259 if ($Code == $this->ClearCode) {
260 for ($i = 0; $i < $this->ClearCode; $i++) {
261 $this->Next[$i] = 0;
262 $this->Vals[$i] = $i;
265 for (; $i < (1 << $this->MAX_LZW_BITS); $i++) {
266 $this->Next[$i] = 0;
267 $this->Vals[$i] = 0;
270 $this->CodeSize = $this->SetCodeSize + 1;
271 $this->MaxCodeSize = $this->ClearCode << 1;
272 $this->MaxCode = $this->ClearCode + 2;
273 $this->sp = 0;
274 $this->FirstCode = $this->GetCode($data, $bInit);
275 $this->OldCode = $this->FirstCode;
277 return $this->FirstCode;
280 if ($Code == $this->EndCode) {
285 if ($Code >= $this->MaxCode) {
286 $this->Stack[$this->sp] = $this->FirstCode;
287 $this->sp++;
288 $Code = $this->OldCode;
291 while ($Code >= $this->ClearCode) {
292 $this->Stack[$this->sp] = $this->Vals[$Code];
293 $this->sp++;
295 if ($Code == $this->Next[$Code]) // Circular table entry, big GIF Error!
298 $Code = $this->Next[$Code];
301 $this->FirstCode = $this->Vals[$Code];
302 $this->Stack[$this->sp] = $this->FirstCode;
303 $this->sp++;
305 if (($Code = $this->MaxCode) < (1 << $this->MAX_LZW_BITS)) {
306 $this->Next[$Code] = $this->OldCode;
307 $this->Vals[$Code] = $this->FirstCode;
308 $this->MaxCode++;
310 … if (($this->MaxCode >= $this->MaxCodeSize) && ($this->MaxCodeSize < (1 << $this->MAX_LZW_BITS))) {
311 $this->MaxCodeSize *= 2;
312 $this->CodeSize++;
316 $this->OldCode = $InCode;
317 if ($this->sp > 0) {
318 $this->sp--;
319 return $this->Stack[$this->sp];
331 $this->CurBit = 0;
332 $this->LastBit = 0;
333 $this->Done = 0;
334 $this->LastByte = 2;
338 if (($this->CurBit + $this->CodeSize) >= $this->LastBit) {
339 if ($this->Done) {
340 if ($this->CurBit >= $this->LastBit) {
347 $this->Buf[0] = $this->Buf[$this->LastByte - 2];
348 $this->Buf[1] = $this->Buf[$this->LastByte - 1];
355 $this->Buf[2 + $i] = ord($data[$i]);
359 $this->Done = 1;
362 $this->LastByte = 2 + $Count;
363 $this->CurBit = ($this->CurBit - $this->LastBit) + 16;
364 $this->LastBit = (2 + $Count) << 3;
368 for ($i = $this->CurBit, $j = 0; $j < $this->CodeSize; $i++, $j++) {
369 $iRet |= (($this->Buf[ (int) ($i / 8) ] & (1 << ($i % 8))) != 0) << $j;
372 $this->CurBit += $this->CodeSize;
389 unSet($this->m_nColors);
390 unSet($this->m_arColors);
397 $this->m_nColors = 0;
398 $this->m_arColors = array();
406 $this->m_arColors[] = (ord($rgb[2]) << 16) + (ord($rgb[1]) << 8) + ord($rgb[0]);
407 $this->m_nColors++;
419 for ($i = 0; $i < $this->m_nColors; $i++) {
421 chr($this->m_arColors[ $i] & 0x000000FF) . // R
422 chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G
423 chr(($this->m_arColors[$i] & 0x00FF0000) >> 16); // B
435 for ($i = 0; $i < $this->m_nColors; $i++) {
437 chr(($this->m_arColors[$i] & 0x00FF0000) >> 16) . // B
438 chr(($this->m_arColors[$i] & 0x0000FF00) >> 8) . // G
439 chr($this->m_arColors[ $i] & 0x000000FF) . // R
457 for ($i = 0; $i < $this->m_nColors; $i++) {
458 $r2 = ($this->m_arColors[$i] & 0x000000FF);
459 $g2 = ($this->m_arColors[$i] & 0x0000FF00) >> 8;
460 $b2 = ($this->m_arColors[$i] & 0x00FF0000) >> 16;
493 unSet($this->m_lpVer);
494 unSet($this->m_nWidth);
495 unSet($this->m_nHeight);
496 unSet($this->m_bGlobalClr);
497 unSet($this->m_nColorRes);
498 unSet($this->m_bSorted);
499 unSet($this->m_nTableSize);
500 unSet($this->m_nBgColor);
501 unSet($this->m_nPixelRatio);
502 unSet($this->m_colorTable);
511 $this->m_lpVer = substr($lpData, 0, 6);
512 if (($this->m_lpVer <> 'GIF87a') && ($this->m_lpVer <> 'GIF89a')) {
516 $this->m_nWidth = $this->w2i(substr($lpData, 6, 2));
517 $this->m_nHeight = $this->w2i(substr($lpData, 8, 2));
518 if (!$this->m_nWidth || !$this->m_nHeight) {
523 $this->m_bGlobalClr = ($b & 0x80) ? true : false;
524 $this->m_nColorRes = ($b & 0x70) >> 4;
525 $this->m_bSorted = ($b & 0x08) ? true : false;
526 $this->m_nTableSize = 2 << ($b & 0x07);
527 $this->m_nBgColor = ord($lpData[ 11 ]);
528 $this->m_nPixelRatio = ord($lpData[ 12 ]);
531 if ($this->m_bGlobalClr) {
532 $this->m_colorTable = new CGIFCOLORTABLE();
533 if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
536 $hdrLen += 3 * $this->m_nTableSize;
569 unSet($this->m_nLeft);
570 unSet($this->m_nTop);
571 unSet($this->m_nWidth);
572 unSet($this->m_nHeight);
573 unSet($this->m_bLocalClr);
574 unSet($this->m_bInterlace);
575 unSet($this->m_bSorted);
576 unSet($this->m_nTableSize);
577 unSet($this->m_colorTable);
586 $this->m_nLeft = $this->w2i(substr($lpData, 0, 2));
587 $this->m_nTop = $this->w2i(substr($lpData, 2, 2));
588 $this->m_nWidth = $this->w2i(substr($lpData, 4, 2));
589 $this->m_nHeight = $this->w2i(substr($lpData, 6, 2));
591 if (!$this->m_nWidth || !$this->m_nHeight) {
596 $this->m_bLocalClr = ($b & 0x80) ? true : false;
597 $this->m_bInterlace = ($b & 0x40) ? true : false;
598 $this->m_bSorted = ($b & 0x20) ? true : false;
599 $this->m_nTableSize = 2 << ($b & 0x07);
602 if ($this->m_bLocalClr) {
603 $this->m_colorTable = new CGIFCOLORTABLE();
604 if (!$this->m_colorTable->load(substr($lpData, $hdrLen), $this->m_nTableSize)) {
607 $hdrLen += 3 * $this->m_nTableSize;
639 unSet($this->m_disp);
640 unSet($this->m_bUser);
641 unSet($this->m_bTrans);
642 unSet($this->m_nDelay);
643 unSet($this->m_nTrans);
644 unSet($this->m_lpComm);
645 unSet($this->m_data);
646 $this->m_gih = new CGIFIMAGEHEADER();
647 $this->m_lzw = new CGIFLZW();
663 if (!$this->skipExt($data, $len = 0)) {
671 if (!$this->m_gih->load($data, $len = 0)) {
678 if (!($this->m_data = $this->m_lzw->deCompress($data, $len = 0))) {
684 if ($this->m_gih->m_bInterlace) {
685 $this->deInterlace();
710 $this->m_disp = ($b & 0x1C) >> 2;
711 $this->m_bUser = ($b & 0x02) ? true : false;
712 $this->m_bTrans = ($b & 0x01) ? true : false;
713 $this->m_nDelay = $this->w2i(substr($data, 2, 2));
714 $this->m_nTrans = ord($data[4]);
718 $this->m_lpComm = substr($data, 1, ord($data[0]));
753 $data = $this->m_data;
780 for (; $y < $this->m_gih->m_nHeight; $y += $s) {
781 $lne = substr($this->m_data, 0, $this->m_gih->m_nWidth);
782 $this->m_data = substr($this->m_data, $this->m_gih->m_nWidth);
785 substr($data, 0, $y * $this->m_gih->m_nWidth) .
787 substr($data, ($y + 1) * $this->m_gih->m_nWidth);
791 $this->m_data = $data;
809 $this->m_gfh = new CGIFFILEHEADER();
810 $this->m_img = new CGIFIMAGE();
811 $this->m_lpData = '';
812 $this->m_bLoaded = false;
827 $this->m_lpData = @fread($fh, @filesize($lpszFileName));
831 if (!$this->m_gfh->load($this->m_lpData, $len = 0)) {
834 $this->m_lpData = substr($this->m_lpData, $len);
837 if (!$this->m_img->load($this->m_lpData, $imgLen = 0)) {
840 $this->m_lpData = substr($this->m_lpData, $imgLen);
844 $this->m_bLoaded = true;
874 if (!$this->m_bLoaded) {
879 if ($this->m_img->m_gih->m_bLocalClr) {
880 $nColors = $this->m_img->m_gih->m_nTableSize;
881 $rgbq = $this->m_img->m_gih->m_colorTable->toRGBQuad();
883 $bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
885 } elseif ($this->m_gfh->m_bGlobalClr) {
886 $nColors = $this->m_gfh->m_nTableSize;
887 $rgbq = $this->m_gfh->m_colorTable->toRGBQuad();
889 $bgColor = $this->m_gfh->m_colorTable->colorIndex($bgColor);
898 $data = $this->m_img->m_data;
899 $nPxl = ($this->m_gfh->m_nHeight - 1) * $this->m_gfh->m_nWidth;
901 $nPad = ($this->m_gfh->m_nWidth % 4) ? 4 - ($this->m_gfh->m_nWidth % 4) : 0;
902 for ($y = 0; $y < $this->m_gfh->m_nHeight; $y++) {
903 for ($x = 0; $x < $this->m_gfh->m_nWidth; $x++, $nPxl++) {
905 ($x >= $this->m_img->m_gih->m_nLeft) &&
906 ($y >= $this->m_img->m_gih->m_nTop) &&
907 ($x < ($this->m_img->m_gih->m_nLeft + $this->m_img->m_gih->m_nWidth)) &&
908 ($y < ($this->m_img->m_gih->m_nTop + $this->m_img->m_gih->m_nHeight))) {
910 if (@$this->m_img->m_bTrans && (ord($data[$nPxl]) == $this->m_img->m_nTrans)) {
913 $bmp .= chr($this->m_gfh->m_nBgColor);
923 $bmp .= chr($this->m_gfh->m_nBgColor);
929 $nPxl -= $this->m_gfh->m_nWidth << 1;
939 $out .= $this->dword(14 + 40 + ($nColors << 2) + strlen($bmp));
942 $out .= $this->dword(14 + 40 + ($nColors << 2));
945 $out .= $this->dword(40);
946 $out .= $this->dword($this->m_gfh->m_nWidth);
947 $out .= $this->dword($this->m_gfh->m_nHeight);
954 $out .= $this->dword($nColors % 256);
974 if (!$this->m_bLoaded) {
979 if ($this->m_img->m_gih->m_bLocalClr) {
980 $nColors = $this->m_img->m_gih->m_nTableSize;
981 $pal = $this->m_img->m_gih->m_colorTable->toString();
983 $bgColor = $this->m_img->m_gih->m_colorTable->colorIndex($bgColor);
985 } elseif ($this->m_gfh->m_bGlobalClr) {
986 $nColors = $this->m_gfh->m_nTableSize;
987 $pal = $this->m_gfh->m_colorTable->toString();
989 $bgColor = $this->m_gfh->m_colorTable->colorIndex($bgColor);
998 $data = $this->m_img->m_data;
1001 for ($y = 0; $y < $this->m_gfh->m_nHeight; $y++) {
1003 for ($x = 0; $x < $this->m_gfh->m_nWidth; $x++, $nPxl++) {
1005 ($x >= $this->m_img->m_gih->m_nLeft) &&
1006 ($y >= $this->m_img->m_gih->m_nTop) &&
1007 ($x < ($this->m_img->m_gih->m_nLeft + $this->m_img->m_gih->m_nWidth)) &&
1008 ($y < ($this->m_img->m_gih->m_nTop + $this->m_img->m_gih->m_nHeight))) {
1014 $bmp .= chr($this->m_gfh->m_nBgColor);
1030 $tmp .= $this->ndword($this->m_gfh->m_nWidth);
1031 $tmp .= $this->ndword($this->m_gfh->m_nHeight);
1034 $out .= $this->ndword(crc32($tmp));
1038 $out .= $this->ndword($nColors * 3);
1042 $out .= $this->ndword(crc32($tmp));
1046 if (@$this->m_img->m_bTrans && ($nColors > 0)) {
1047 $out .= $this->ndword($nColors);
1050 $tmp .= ($i == $this->m_img->m_nTrans) ? "\x00" : "\xFF";
1053 $out .= $this->ndword(crc32($tmp));
1057 $out .= $this->ndword(strlen($bmp));
1061 $out .= $this->ndword(crc32($tmp));
1077 if (!$this->m_bLoaded) {
1082 if ($this->m_img->m_gih->m_bLocalClr) {
1083 $pal = $this->m_img->m_gih->m_colorTable->toString();
1084 } elseif ($this->m_gfh->m_bGlobalClr) {
1085 $pal = $this->m_gfh->m_colorTable->toString();
1090 $PlottingIMG = imagecreate($this->m_gfh->m_nWidth, $this->m_gfh->m_nHeight);
1102 $data = $this->m_img->m_data;
1103 $nPxl = ($this->m_gfh->m_nHeight - 1) * $this->m_gfh->m_nWidth;
1104 for ($y = 0; $y < $this->m_gfh->m_nHeight; $y++) {
1108 for ($x = 0; $x < $this->m_gfh->m_nWidth; $x++, $nPxl++) {
1110 ($x >= $this->m_img->m_gih->m_nLeft) &&
1111 ($y >= $this->m_img->m_gih->m_nTop) &&
1112 ($x < ($this->m_img->m_gih->m_nLeft + $this->m_img->m_gih->m_nWidth)) &&
1113 ($y < ($this->m_img->m_gih->m_nTop + $this->m_img->m_gih->m_nHeight))) {
1115 if (@$this->m_img->m_bTrans && (ord($data[$nPxl]) == $this->m_img->m_nTrans)) {
1116 …imagesetpixel($PlottingIMG, $x, $this->m_gfh->m_nHeight - $y - 1, $ThisImageColor[$this->m_gfh->m_…
1118 …imagesetpixel($PlottingIMG, $x, $this->m_gfh->m_nHeight - $y - 1, $ThisImageColor[ord($data[$nPxl]…
1122 …imagesetpixel($PlottingIMG, $x, $this->m_gfh->m_nHeight - $y - 1, $ThisImageColor[$this->m_gfh->m_…
1125 $nPxl -= $this->m_gfh->m_nWidth << 1;
1152 return $this->m_gfh->m_nWidth;
1159 return $this->m_gfh->m_nHeight;
1166 return $this->m_img->m_lpComm;
1173 return $this->m_bLoaded;