### Home Classes Methods

### In Files

- lib/RMagick.rb

### Parent

Object

### Methods

- ::new
- #[]
- #[]=
- #update

### Included Modules

- Observable

### Files

- MANIFEST
- Makefile

### Class/Module Index

Quicksearch

- Magick
- Magick::DestroyedImageError
- Magick::Draw
- Magick::Enum
- Magick::FatalImageMagickError
- Magick::Geometry
- Magick::GeometryValue
- Magick::GradientFill
- Magick::HatchFill
- Magick::IPTC
- Magick::IPTC::Application
- Magick::IPTC::Envelope
- Magick::IPTC::ObjectData
- Magick::IPTC::Post_ObjectData_Descriptor
- Magick::IPTC::Pre_ObjectData_Descriptor
- Magick::Image
- Magick::Image::DrawOptions
- Magick::Image::Info
- Magick::Image::PolaroidOptions
- Magick::Image::View
- Magick::Image::View::Pixels
- Magick::Image::View::Rows
- Magick::ImageList
- Magick::ImageList::Montage
- Magick::ImageMagickError
- Magick::OptionalMethodArguments
- Magick::Pixel
- Magick::RVG
- Magick::RVG::Circle
- Magick::RVG::ClipPath
- Magick::RVG::Describable
- Magick::RVG::Duplicatable
- Magick::RVG::Ellipse
- Magick::RVG::Embellishable
- Magick::RVG::Group
- Magick::RVG::Image
- Magick::RVG::ImageConstructors
- Magick::RVG::Line
- Magick::RVG::Path
- Magick::RVG::PathData
- Magick::RVG::Pattern
- Magick::RVG::PolyShape
- Magick::RVG::Polygon
- Magick::RVG::Polyline
- Magick::RVG::PreserveAspectRatio
- Magick::RVG::Rect
- Magick::RVG::ShapeConstructors
- Magick::RVG::Stretchable
- Magick::RVG::StructureConstructors
- Magick::RVG::Stylable
- Magick::RVG::Text
- Magick::RVG::TextBase
- Magick::RVG::TextConstructors
- Magick::RVG::Transformable
- Magick::RVG::Use
- Magick::RVG::UseConstructors
- Magick::RVG::Utility
- Magick::RVG::Utility::DefaultTextStrategy
- Magick::RVG::Utility::GraphicContext
- Magick::RVG::Utility::LRTextStrategy
- Magick::RVG::Utility::RLTextStrategy
- Magick::RVG::Utility::TBTextStrategy
- Magick::RVG::Utility::TextAttributes
- Magick::RVG::Utility::TextStrategy
- Magick::TextureFill
- Object

No matching classes.

# Magick::Image::View::Rows

Magick::Image::View::Rows

### Public Class Methods

new(view, width, height, rows) click to toggle source

    # File lib/RMagick.rb, line 1124
    def initialize(view, width, height, rows)
        @view = view
        @width = width
        @height = height
        @rows = rows
    end

### Public Instance Methods

[](*args) click to toggle source

    # File lib/RMagick.rb, line 1131
    def [](*args)
        cols(args)

        # Both View::Pixels and Magick::Pixel implement Observable
        if @unique
            pixels = @view[@rows[0]*@width + @cols[0]]
            pixels.add_observer(self)
        else
            pixels = View::Pixels.new
            each do |x|
                p = @view[x]
                p.add_observer(self)
                pixels << p
            end
        end
        pixels
    end

[]=(*args) click to toggle source

    # File lib/RMagick.rb, line 1149
    def []=(*args)
        rv = args.delete_at(-1)     # get rvalue
        if ! rv.is_a?(Pixel)        # must be a Pixel or a color name
            begin
                rv = Pixel.from_color(rv)
            rescue TypeError
                Kernel.raise TypeError, "cannot convert #{rv.class} into Pixel"
            end
        end
        cols(args)
        each { |x| @view[x] = rv.dup }
        changed
        notify_observers(self)
        nil
    end

update(pixel) click to toggle source

A pixel has been modified. Tell the view.

    # File lib/RMagick.rb, line 1166
    def update(pixel)
        changed
        notify_observers(self)
        pixel.delete_observer(self) # Don't need to hear again.
        nil
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.