ElementPtr scAbstractArray::GetTop( ElementPtr elemptr, long elements ) { long index = fNumItems - 1; elemptr = GetDataAt( index, elemptr, elements ); return elemptr; }
/* ==================================================================== */ BOOL scRubiArray::GetNthRubi( int& index, scRubiData& rubiData, int nth, long start, long end ) { index = (int)NthSuccess( is_rubi_at, nth, start, end ); if ( index < 0 ) return false; GetDataAt( index, (ElementPtr)&rubiData ); return true; }
/* ==================================================================== */ BOOL scRubiArray::GetRubiAt( scRubiData& rd, long offset ) { long index; int nth; for ( nth = 1; ( index = NthSuccess( is_rubi_at, nth, offset, offset ) ) >= 0; nth++ ) { GetDataAt( (int)index, (ElementPtr)&rd ); if ( offset > rd.fStartOffset && offset < rd.fEndOffset ) return true; } return false; }
// apply the style to the rubidata found within the bounds void scRubiArray::ApplyStyle( long start, long end, TypeSpec ts ) { scRubiData rd; long index; int nth; for ( nth = 1; ( index = NthSuccess( is_rubi_at, nth, start, end ) ) >= 0; nth++ ) { GetDataAt( (int)index, (ElementPtr)&rd ); if ( rd.fStartOffset >= start && rd.fStartOffset < end ) { rd.fRubiSpec = ts; AlterDataAt( (int)index, (ElementPtr)&rd ); } } }
short RasterBuffer::GetInterpolated(unsigned lx, unsigned ly, unsigned ix, unsigned iy) const { assert(IsDefined()); assert(lx < GetWidth()); assert(ly < GetHeight()); assert(ix < 0x100); assert(iy < 0x100); // perform piecewise linear interpolation const unsigned int dx = (lx == GetWidth() - 1) ? 0 : 1; const unsigned int dy = (ly == GetHeight() - 1) ? 0 : GetWidth(); const short *tm = GetDataAt(lx, ly); if (IsSpecial(*tm) || IsSpecial(tm[dx]) || IsSpecial(tm[dy]) || IsSpecial(tm[dx + dy])) return *tm; unsigned kx = 0x100 - ix; unsigned ky = 0x100 - iy; return (*tm * kx * ky + tm[dx] * ix * ky + tm[dy] * kx * iy + tm[dx + dy] * ix * iy) >> 16; }
gcc_pure short Get(unsigned x, unsigned y) const { return *GetDataAt(x, y); }