Class: X11Image

Inherits:
Object
  • Object
show all
Defined in:
lib/rex/proto/x11/window.rb

Overview

for future use def create_overlay_map(screen_width, screen_height, windows)

# Initialize a 2D array to represent the screen
screen = Array.new(screen_height) { Array.new(screen_width, nil) }
windows.each_with_index do |window, i|
  puts window.inspect
  x, y, width, height = window
  # Mark the visible region occupied by the window
  (y...y + height).each do |row|
    (x...x + width).each do |col|
      screen[row][col] = i
    end
  end
end
screen.each do |row|
  puts row.join('')
end

end

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height, image_data, color_data) ⇒ X11Image

Returns a new instance of X11Image.



214
215
216
217
218
219
# File 'lib/rex/proto/x11/window.rb', line 214

def initialize(width, height, image_data, color_data)
  @width = width # integer, 1024 in 1024×768
  @height = height # integer, 768 in 1024×768
  @image_data = image_data # from X11GetImageResponse
  @color_data = color_data # from X11GetColorsResponse
end

Class Method Details

.from_replies(width, height, image_reply, color_reply) ⇒ Object



221
222
223
# File 'lib/rex/proto/x11/window.rb', line 221

def self.from_replies(width, height, image_reply, color_reply)
  new(width, height, image_reply.image_data, color_reply.colors)
end