Update of /cvsroot/fxruby/FXRuby/examples
In directory usw-pr-cvs1:/tmp/cvs-serv31524
Modified Files:
Tag: release10
image.rb
Log Message:
Minor updates to the image.rb example to replace calls with shorter
aliases, e.g. replacing @canvas.getWidth() and @canvas.getHeight()
with @canvas.width and @canvas.height.
Index: image.rb
===================================================================
RCS file: /cvsroot/fxruby/FXRuby/examples/image.rb,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** image.rb 5 Nov 2001 23:12:22 -0000 1.11
--- image.rb 8 May 2002 16:32:41 -0000 1.11.2.1
***************
*** 176,182 ****
# Erase the canvas, color comes from well
! dc.setForeground(@backwell.getRGBA())
! dc.fillRectangle(0, 0, @picture.getWidth(), @picture.getHeight())
# Draw images
--- 176,182 ----
# Erase the canvas, color comes from well
! dc.foreground = @backwell.rgba
! dc.fillRectangle(0, 0, @picture.width, @picture.height)
# Draw images
***************
*** 191,205 ****
# Draw patterns
! dc.setFillStyle(FILL_OPAQUESTIPPLED)
! dc.setForeground(FXColor::Black)
! dc.setBackground(FXColor::White)
(STIPPLE_0..STIPPLE_16).each { |pat|
! dc.setStipple(pat)
dc.fillRectangle(10 + (512*pat)/17, 490, 31, 50)
}
! dc.setFillStyle(FILL_SOLID)
# Draw borders
! dc.setForeground(@borderwell.getRGBA())
dc.drawRectangle(10, 10, 512, 50)
dc.drawRectangle(10, 60, 512, 50)
--- 191,205 ----
# Draw patterns
! dc.fillStyle = FILL_OPAQUESTIPPLED
! dc.foreground = FXColor::Black
! dc.background = FXColor::White
(STIPPLE_0..STIPPLE_16).each { |pat|
! dc.stipple = pat
dc.fillRectangle(10 + (512*pat)/17, 490, 31, 50)
}
! dc.fillStyle = FILL_SOLID
# Draw borders
! dc.foreground = @borderwell.rgba
dc.drawRectangle(10, 10, 512, 50)
dc.drawRectangle(10, 60, 512, 50)
***************
*** 217,227 ****
# Draw text
! dc.setTextFont(@font)
! dc.setForeground(@textwell.getRGBA())
! dc.drawText(540, 60, "Grey", 4)
! dc.drawText(540, 180, "Red", 3)
! dc.drawText(540, 300, "Green", 5)
! dc.drawText(540, 420, "Blue", 4)
! dc.drawText(540, 540, "Patterns", 8)
# Don't wait for the GC to catch up, do it now!
--- 217,227 ----
# Draw text
! dc.textFont = @font
! dc.foreground = @textwell.rgba
! dc.drawText(540, 60, "Grey")
! dc.drawText(540, 180, "Red")
! dc.drawText(540, 300, "Green")
! dc.drawText(540, 420, "Blue")
! dc.drawText(540, 540, "Patterns")
# Don't wait for the GC to catch up, do it now!
***************
*** 234,239 ****
# Clear whole thing
! sdc.setForeground(@backwell.getRGBA())
! sdc.fillRectangle(0, 0, @canvas.getWidth(), @canvas.getHeight())
# Paint image
--- 234,239 ----
# Clear whole thing
! sdc.foreground = @backwell.rgba
! sdc.fillRectangle(0, 0, @canvas.width, @canvas.height)
# Paint image
***************
*** 254,261 ****
saveDialog = FXFileDialog.new(self, "Save as BMP")
if saveDialog.execute != 0
! FXFileStream.open(saveDialog.filename, FXStreamSave) { |outfile|
@picture.restore
@picture.savePixels(outfile)
! }
end
return 1
--- 254,261 ----
saveDialog = FXFileDialog.new(self, "Save as BMP")
if saveDialog.execute != 0
! FXFileStream.open(saveDialog.filename, FXStreamSave) do |outfile|
@picture.restore
@picture.savePixels(outfile)
! end
end
return 1
|