Skip to content

leviongit/dr-pixel-array-wrap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple pixel array wrapper for DragonRuby.

Setup:

args.state.pxa        = PXArray.new 512, 232, # x and y position
                                    64, 64,   # width and height
                                    4         # scale

Access pixels:

# Set a pixel :
args.state.pxa.set_pixel 32, 32, 0xFF0000FF

# Get a pixel :
pv = args.state.pxa.get_pixel 32, 32

Draw lines:

# Horizontal line :
args.state.pxa.draw_horizontal_line 1, 62, 31, 0xFF0000FF

# Vertical line :
args.state.pxa.draw_vertical_line 1, 62, 31, 0xFF00FF00

# Arbitrary line :
args.state.pxa.draw_line 1, 1, 62, 62, 0xFFFF0000

Draw polygons:

# Stroke rectangle :
args.state.pxa.stroke_rectangle 2, 3, 10, 20, 0xFF0000FF

# Fill rectangle :
args.state.pxa.fill_rectangle 4, 5, 7, 17, 0xFF00FF00

# Stroke arbitrary (up to 64 vertices) CONVEX polygon :
args.state.pa1.stroke_polygon [[4,5], [2,15], [17,18], [19,3]], 0xFFFFFF00

# Fill arbitrary (up to 64 vertices) CONVEX polygon :
args.state.pa1.fill_polygon [[4,5], [2,15], [17,18], [19,3]], 0xFFFF0000

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •