<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 05/10/2012 04:48 PM, Petr Kitashov wrote:
    <blockquote
cite="mid:CAP9804+gk2dtwnTLpMoTVy1E45Ta8PDc4-EraczmCqz_P6JGDQ@mail.gmail.com"
      type="cite"><span style="">Hi,</span><br style="">
      <br style="">
      <span style="">I need just to display some region(any) from raster
        file.&nbsp;</span><span style="">Seems like I understand everything
        until rasterIO.</span><br style="">
      <span style="">RasterIO fills(in my case) void* pData with raster
        info -&nbsp;</span><span style="">that's great, but how to display
        it?</span><br style="">
    </blockquote>
    <br>
    I do it like this:<br>
    <br>
    1) Call GDALRasterIO to get the part of interest into a 2D table of
    floats or integers (ral_grid).<br>
    <br>
    This happens in ral_grid_create_using_GDAL in
<a class="moz-txt-link-freetext" href="https://github.com/ajolma/geoinformatica/blob/master/libral/ral_grid_rw.c">https://github.com/ajolma/geoinformatica/blob/master/libral/ral_grid_rw.c</a><br>
    <br>
    2) Create a ral_pixbuf (each pixel has RGBA values) of the same size
    as ral_grid.<br>
    <br>
    3) Render the ral_grid onto the ral_pixbuf using current palette etc.<br>
    <br>
    4) Convert the ral_pixbuf into GdkPixBuf.<br>
    <br>
    5) Use the GdkPixBuf in a GTK+ image widget for display.<br>
    <br>
    This happens in ral_pixbuf_create_from_grid,
    ral_render_integer_grid, and ral_gdk_pixbuf in
    <a class="moz-txt-link-freetext" href="https://github.com/ajolma/geoinformatica/blob/master/libral/ral_pixbuf.c">https://github.com/ajolma/geoinformatica/blob/master/libral/ral_pixbuf.c</a><br>
    <br>
    This is GTK+ specific. There are other Graphics toolkits.<br>
    <br>
    <blockquote
cite="mid:CAP9804+gk2dtwnTLpMoTVy1E45Ta8PDc4-EraczmCqz_P6JGDQ@mail.gmail.com"
      type="cite">
      <br style="">
      <span style="">Which data is stored there when I use
        GDALDataset::rasterIO,&nbsp;</span><span style="">and which in case
        of GDALRasterBand::RasterIO?</span><br style="">
      <br style="">
      <span style="">I.e. how to determine pixel values from pData?</span><br
        style="">
      <br style="">
      <span style="">I'm sorry if this question is stupid, but i spent a
        lot of time in google and&nbsp;</span><span style="">didn't find any
        solution.</span> <br clear="all">
    </blockquote>
    <br>
    I hope the above helps.<br>
    <br>
    Ari<br>
    <br>
    <blockquote
cite="mid:CAP9804+gk2dtwnTLpMoTVy1E45Ta8PDc4-EraczmCqz_P6JGDQ@mail.gmail.com"
      type="cite">
      <div><br>
      </div>
      --&nbsp;<br>
      Best Regards,&nbsp;<br>
      Petr Kitashov
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
gdal-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gdal-dev@lists.osgeo.org">gdal-dev@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/gdal-dev">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></pre>
    </blockquote>
    <br>
  </body>
</html>