Sha256: 503de5a86ebf40a8c496386dde25bff9b2680a0f52379872d6df08cb010043c5
Contents?: true
Size: 1.21 KB
Versions: 4
Compression:
Stored size: 1.21 KB
Contents
require_relative '../ffi/gdal' module GDAL class ColorTable include FFI::GDAL def initialize(gdal_raster_band, color_table_pointer: nil) @gdal_raster_band = if gdal_raster_band.is_a? GDAL::RasterBand gdal_raster_band.c_pointer else gdal_raster_band end @gdal_color_table = color_table_pointer end def c_pointer @gdal_color_table ||= GDALGetRasterColorTable(@gdal_raster_band) end def null? c_pointer.nil? || c_pointer.null? end # Usually :GPI_RGB. # # @return [Symbol] One of FFI::GDAL::GDALPaletteInterp. def palette_interpretation GDALGetPaletteInterpretation(c_pointer) end # @return [Fixnum] def color_entry_count return 0 if null? GDALGetColorEntryCount(c_pointer) end # @param index [Fixnum] # @return [FFI::GDAL::GDALColorEntry] def color_entry(index) return nil if null? GDALGetColorEntry(c_pointer, index) end # @param index [Fixnum] # @return [GGI::GDAL::GDALColorEntry] def color_entry_as_rgb(index) return nil if null? entry = GDALColorEntry.new GDALGetColorEntryAsRGB(c_pointer, index, entry) entry end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ffi-gdal-0.0.4 | lib/ffi-gdal/color_table.rb |
ffi-gdal-0.0.3 | lib/ffi-gdal/color_table.rb |
ffi-gdal-0.0.2 | lib/ffi-gdal/color_table.rb |
ffi-gdal-0.0.1 | lib/ffi-gdal/color_table.rb |