<html>
  <head>
    <meta http-equiv="content-type" content="text/html;
      charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    The current GDALRasterBand::RasterIO signature makes it easy to read
    or write a contiguous subregion of the band. However, if you want to
    read or write the entire band into/from  a contiguous sub-region of
    the buffer, it's not nearly as straightforward. You can do this by
    using the nLineSpace parameter, giving the size of the subregion for
    buffer size parameters,  and offsetting the address of the buffer.
    It works, but that makes the code a bit baroque and hard to read.<br>
    <br>
    How about a signature that indicates the entire band will be read,
    but moves the meaning of the offset to the buffer. Something like <br>
    <br>
    <table class="memname">
      <tbody>
        <tr>
          <td class="memname">CPLErr GDALRasterBand::RasterIO </td>
          <td>(</td>
          <td class="paramtype">GDALRWFlag <br>
          </td>
          <td class="paramname"> <em>eRWFlag</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nXSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nYSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">void * <br>
          </td>
          <td class="paramname"><em>pData</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nBufXOff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int<br>
          </td>
          <td class="paramname"> <em>nBufYOff</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nBufXSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nBufYSize</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">GDALDataType <br>
          </td>
          <td class="paramname"> <em>eBufType</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nPixelSpace</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"><br>
          </td>
          <td><br>
          </td>
          <td class="paramtype">int </td>
          <td class="paramname"> <em>nLineSpace</em></td>
          <td> </td>
        </tr>
        <tr>
          <td><br>
          </td>
          <td>)</td>
        </tr>
      </tbody>
    </table>
    <br>
    Obviously I can write a wrapper for this functionality that just
    calls RasterIO, setting the appropriate values for buffer size, etc,
    but I was thinking I might not be the only one who wants to crop a
    buffer while writing to the band, or reading a band into a
    sub-region of a buffer.  <br>
    <br>
    This cropping interpretation doesn't allow for
    decimation/replication. It requires the buffer size be large enough
    to copy the entire band into the sub-region of the buffer. Allowing
    for decimation/replication would require yet more parameters.<br>
    <br>
  </body>
</html>