Sha256: 117b9e741d5e997d08928031ef378cc4748f10473443430f1a8278313e2473d3

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

# frozen_string_literal: true

require 'json'

module GDAL
  module ColorTableMixins
    module Extensions
      def color_entries_for(color_number)
        unless (1..4).to_a.include? color_number
          raise "Invalid ColorEntry number 'color#{color_number}'"
        end

        Array.new(color_entry_count) do |i|
          color_entry(i).send("color#{color_number}".to_sym)
        end
      end

      # @return [Array<GDAL::ColorEntry>]
      def color_entries
        Array.new(color_entry_count) do |i|
          color_entry(i)
        end
      end

      # Does the same as #color_entries, but calls #color_entry_as_rgb() instead
      # of #color_entry().
      #
      # @return [Array<GDAL::ColorEntry>]
      def color_entries_as_rgb
        Array.new(color_entry_count) do |i|
          color_entry_as_rgb(i)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta8 lib/gdal/color_table_mixins/extensions.rb