I have written this little piece of code (see at end of message) which
drwas a piece of text as an image and then display the image. The
result on Linux is a grey text on a green background as expected but
on Windows it simply gives a grey rectangle (see 2 screenshots attached)
I have tried many variants to make it work on Win32 to no avail. Any
idea to help me fix this problem is really welcome.
Thanks
Laurent
------- Ruby script ----------
require ‘fox’
require ‘fox/colors’
include Fox
Part 1 - Create a new application
app = FXApp.new(“Browser”, “FoxTest”)
app.init(ARGV)
main = FXMainWindow.new(app, “Hello”, nil, nil, DECOR_ALL,0,0,200,100)
imageview = FXImageView.new(main, nil, nil, 0,
LAYOUT_FILL_X|LAYOUT_FILL_Y)
app.create
Part 2
Render a piece of text as an image
font = FXFont.new(app, “Arial”, 12, FONTWEIGHT_BOLD)
font.create
title = “Structure”
title_w = font.getTextWidth(title)
title_h = font.getTextHeight(title)
image = FXIcon.new(app,nil,0,0,title_w+2,title_h+2 )
image.create
dc = FXDCWindow.new(image)
dc.foreground = FXColor::Green
dc.fillRectangle(0,0,title_w+2,title_h+2)
dc.textFont = font
dc.foreground = FXColor::DarkGrey
dc.drawText(1,title_h-font.fontDescent(),title)
image.restore
image.rotate(180)
image.render
Part 3
Display the image and the main window
imageview.image = image
main.show(PLACEMENT_SCREEN)
app.run
exit
--------- end of Ruby script ------------