105 && __isSmallInteger(w) ) { |
105 && __isSmallInteger(w) ) { |
106 int _idx, _pix; |
106 int _idx, _pix; |
107 |
107 |
108 _idx = (__intVal(w) * __intVal(y)) + __intVal(x); |
108 _idx = (__intVal(w) * __intVal(y)) + __intVal(x); |
109 if ((unsigned)_idx < __byteArraySize(b)) { |
109 if ((unsigned)_idx < __byteArraySize(b)) { |
110 _pix = _ByteArrayInstPtr(b)->ba_element[_idx]; |
110 _pix = __ByteArrayInstPtr(b)->ba_element[_idx]; |
111 RETURN( __MKSMALLINT(_pix) ); |
111 RETURN( __MKSMALLINT(_pix) ); |
112 } |
112 } |
113 } |
113 } |
114 %}. |
114 %}. |
115 "/ should not be reached ... |
115 "/ should not be reached ... |
135 && __bothSmallInteger(w, aPixelValue) ) { |
135 && __bothSmallInteger(w, aPixelValue) ) { |
136 int _idx; |
136 int _idx; |
137 |
137 |
138 _idx = (__intVal(w) * __intVal(y)) + __intVal(x); |
138 _idx = (__intVal(w) * __intVal(y)) + __intVal(x); |
139 if ((unsigned)_idx < __byteArraySize(b)) { |
139 if ((unsigned)_idx < __byteArraySize(b)) { |
140 _ByteArrayInstPtr(b)->ba_element[_idx] = __intVal(aPixelValue); |
140 __ByteArrayInstPtr(b)->ba_element[_idx] = __intVal(aPixelValue); |
141 RETURN( self ); |
141 RETURN( self ); |
142 } |
142 } |
143 } |
143 } |
144 %}. |
144 %}. |
145 "/ should not be reached ... |
145 "/ should not be reached ... |
759 && __isByteArray(_INST(bytes)) |
759 && __isByteArray(_INST(bytes)) |
760 && __isByteArray(imageBits)) { |
760 && __isByteArray(imageBits)) { |
761 int r,p; |
761 int r,p; |
762 int x, y, w, h, nPix; |
762 int x, y, w, h, nPix; |
763 |
763 |
764 unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
764 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
765 unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
765 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
766 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
766 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
767 |
767 |
768 w = __intVal(_INST(width)); |
768 w = __intVal(_INST(width)); |
769 h = __intVal(_INST(height)); |
769 h = __intVal(_INST(height)); |
770 r = w; |
770 r = w; |
804 && __isArray(colorValues) |
804 && __isArray(colorValues) |
805 && __isByteArray(_INST(bytes)) |
805 && __isByteArray(_INST(bytes)) |
806 && __isByteArray(imageBits)) { |
806 && __isByteArray(imageBits)) { |
807 int x, y, w, h, nPix; |
807 int x, y, w, h, nPix; |
808 |
808 |
809 unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
809 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
810 unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
810 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
811 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
811 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
812 |
812 |
813 w = __intVal(_INST(width)); |
813 w = __intVal(_INST(width)); |
814 h = __intVal(_INST(height)); |
814 h = __intVal(_INST(height)); |
815 nPix = w * h; |
815 nPix = w * h; |
847 && __isByteArray(_INST(bytes)) |
847 && __isByteArray(_INST(bytes)) |
848 && __isByteArray(imageBits)) { |
848 && __isByteArray(imageBits)) { |
849 int x, y, w, h, nPix; |
849 int x, y, w, h, nPix; |
850 int r,p; |
850 int r,p; |
851 |
851 |
852 unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
852 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
853 unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
853 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
854 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
854 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
855 |
855 |
856 w = __intVal(_INST(width)); |
856 w = __intVal(_INST(width)); |
857 h = __intVal(_INST(height)); |
857 h = __intVal(_INST(height)); |
858 r = w; |
858 r = w; |
894 && __isByteArray(_INST(bytes)) |
894 && __isByteArray(_INST(bytes)) |
895 && __isByteArray(imageBits)) { |
895 && __isByteArray(imageBits)) { |
896 int x, y, w, h, nPix; |
896 int x, y, w, h, nPix; |
897 int r,p; |
897 int r,p; |
898 |
898 |
899 unsigned char *srcPtr = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
899 unsigned char *srcPtr = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
900 unsigned char *dstPtr = _ByteArrayInstPtr(imageBits)->ba_element; |
900 unsigned char *dstPtr = __ByteArrayInstPtr(imageBits)->ba_element; |
901 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
901 OBJ *ap = __ArrayInstPtr(colorValues)->a_element; |
902 |
902 |
903 w = __intVal(_INST(width)); |
903 w = __intVal(_INST(width)); |
904 h = __intVal(_INST(height)); |
904 h = __intVal(_INST(height)); |
905 r = w; |
905 r = w; |
1418 "walk over destination image fetching pixels from source image" |
1418 "walk over destination image fetching pixels from source image" |
1419 |
1419 |
1420 mY := mY asFloat. |
1420 mY := mY asFloat. |
1421 mX := mX asFloat. |
1421 mX := mX asFloat. |
1422 %{ |
1422 %{ |
1423 unsigned char *__dstP = _ByteArrayInstPtr(newBytes)->ba_element; |
1423 unsigned char *__dstP = __ByteArrayInstPtr(newBytes)->ba_element; |
1424 unsigned char *__srcP = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
1424 unsigned char *__srcP = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
1425 unsigned char *__srcRowP; |
1425 unsigned char *__srcRowP; |
1426 int __width = __intVal(_INST(width)); |
1426 int __width = __intVal(_INST(width)); |
1427 int __w = __intVal(newWidth) - 1; |
1427 int __w = __intVal(newWidth) - 1; |
1428 int __h = __intVal(newHeight) - 1; |
1428 int __h = __intVal(newHeight) - 1; |
1429 int __row, __col; |
1429 int __row, __col; |
1473 |
1473 |
1474 if (__bothSmallInteger(srcStart, dstStart) |
1474 if (__bothSmallInteger(srcStart, dstStart) |
1475 && __bothSmallInteger(w, mX) |
1475 && __bothSmallInteger(w, mX) |
1476 && __isByteArray(srcBytes) && __isByteArray(dstBytes)) { |
1476 && __isByteArray(srcBytes) && __isByteArray(dstBytes)) { |
1477 _mag = _intVal(mX); |
1477 _mag = _intVal(mX); |
1478 srcP = _ByteArrayInstPtr(srcBytes)->ba_element - 1 + _intVal(srcStart); |
1478 srcP = __ByteArrayInstPtr(srcBytes)->ba_element - 1 + _intVal(srcStart); |
1479 dstP = _ByteArrayInstPtr(dstBytes)->ba_element - 1 + _intVal(dstStart); |
1479 dstP = __ByteArrayInstPtr(dstBytes)->ba_element - 1 + _intVal(dstStart); |
1480 _pixels = _intVal(w); |
1480 _pixels = _intVal(w); |
1481 |
1481 |
1482 switch (_mag) { |
1482 switch (_mag) { |
1483 case 1: |
1483 case 1: |
1484 break; |
1484 break; |
1583 unsigned char _outBits = 0; |
1583 unsigned char _outBits = 0; |
1584 unsigned char _last, _v, _patternBits, _p0, _p1; |
1584 unsigned char _last, _v, _patternBits, _p0, _p1; |
1585 int _h, _w; |
1585 int _h, _w; |
1586 int _patternOffset = 0; |
1586 int _patternOffset = 0; |
1587 |
1587 |
1588 _srcP = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
1588 _srcP = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
1589 _dstP = _ByteArrayInstPtr(formBytes)->ba_element; |
1589 _dstP = __ByteArrayInstPtr(formBytes)->ba_element; |
1590 for (_h = _intVal(h); _h; _h--) { |
1590 for (_h = _intVal(h); _h; _h--) { |
1591 _last = -1; |
1591 _last = -1; |
1592 for (_w = _intVal(w); _w; _w--) { |
1592 for (_w = _intVal(w); _w; _w--) { |
1593 _v = *_srcP++; |
1593 _v = *_srcP++; |
1594 if (_v != _last) { |
1594 if (_v != _last) { |
1595 _patternBytes = _ArrayInstPtr(patterns)->a_element[_v]; |
1595 _patternBytes = __ArrayInstPtr(patterns)->a_element[_v]; |
1596 if (__isByteArray(_patternBytes)) { |
1596 if (__isByteArray(_patternBytes)) { |
1597 _patternBits = _ByteArrayInstPtr(_patternBytes)->ba_element[_patternOffset]; |
1597 _patternBits = __ByteArrayInstPtr(_patternBytes)->ba_element[_patternOffset]; |
1598 } else if (__isArray(_patternBytes)) { |
1598 } else if (__isArray(_patternBytes)) { |
1599 _patternBits = _intVal(_ArrayInstPtr(_patternBytes)->a_element[_patternOffset]); |
1599 _patternBits = _intVal(__ArrayInstPtr(_patternBytes)->a_element[_patternOffset]); |
1600 } |
1600 } |
1601 _p0 = _ByteArrayInstPtr(pixel0bytes)->ba_element[_v]; |
1601 _p0 = __ByteArrayInstPtr(pixel0bytes)->ba_element[_v]; |
1602 _p1 = _ByteArrayInstPtr(pixel1bytes)->ba_element[_v]; |
1602 _p1 = __ByteArrayInstPtr(pixel1bytes)->ba_element[_v]; |
1603 _last = _v; |
1603 _last = _v; |
1604 } |
1604 } |
1605 _outBits <<= 1; |
1605 _outBits <<= 1; |
1606 if (_patternBits & __mask) |
1606 if (_patternBits & __mask) |
1607 _outBits |= _p1; |
1607 _outBits |= _p1; |
1686 unsigned char _last, _v, _patternBits, _p0, _p1; |
1686 unsigned char _last, _v, _patternBits, _p0, _p1; |
1687 int _h, _w; |
1687 int _h, _w; |
1688 int _patternOffset = 0; |
1688 int _patternOffset = 0; |
1689 int _outCount; |
1689 int _outCount; |
1690 |
1690 |
1691 _srcP = _ByteArrayInstPtr(_INST(bytes))->ba_element; |
1691 _srcP = __ByteArrayInstPtr(_INST(bytes))->ba_element; |
1692 _dstP = _ByteArrayInstPtr(formBytes)->ba_element; |
1692 _dstP = __ByteArrayInstPtr(formBytes)->ba_element; |
1693 for (_h = _intVal(h); _h; _h--) { |
1693 for (_h = _intVal(h); _h; _h--) { |
1694 _last = -1; |
1694 _last = -1; |
1695 _outCount = 0; |
1695 _outCount = 0; |
1696 for (_w = _intVal(w); _w; _w--) { |
1696 for (_w = _intVal(w); _w; _w--) { |
1697 _v = *_srcP++; |
1697 _v = *_srcP++; |
1698 if (_v != _last) { |
1698 if (_v != _last) { |
1699 _patternBytes = _ArrayInstPtr(patterns)->a_element[_v]; |
1699 _patternBytes = __ArrayInstPtr(patterns)->a_element[_v]; |
1700 if (__isByteArray(_patternBytes)) { |
1700 if (__isByteArray(_patternBytes)) { |
1701 _patternBits = _ByteArrayInstPtr(_patternBytes)->ba_element[_patternOffset]; |
1701 _patternBits = __ByteArrayInstPtr(_patternBytes)->ba_element[_patternOffset]; |
1702 } else if (__isArray(_patternBytes)) { |
1702 } else if (__isArray(_patternBytes)) { |
1703 _patternBits = _intVal(_ArrayInstPtr(_patternBytes)->a_element[_patternOffset]); |
1703 _patternBits = _intVal(__ArrayInstPtr(_patternBytes)->a_element[_patternOffset]); |
1704 } |
1704 } |
1705 _p0 = _ByteArrayInstPtr(pixel0bytes)->ba_element[_v]; |
1705 _p0 = __ByteArrayInstPtr(pixel0bytes)->ba_element[_v]; |
1706 _p1 = _ByteArrayInstPtr(pixel1bytes)->ba_element[_v]; |
1706 _p1 = __ByteArrayInstPtr(pixel1bytes)->ba_element[_v]; |
1707 _last = _v; |
1707 _last = _v; |
1708 } |
1708 } |
1709 _outBits <<= 2; |
1709 _outBits <<= 2; |
1710 if (_patternBits & __mask) |
1710 if (_patternBits & __mask) |
1711 _outBits |= _p1; |
1711 _outBits |= _p1; |