|
© Efflare Systems website : e-mail |
<cfx_imageflare source="
b = Bitmap()
t = 'Crystal^'s Store'
f = Font( 'Trebuchet MS', 9, 1 )
b.size( f.getdimensions(t) )
b.size( b.width+12, b.height+12 )
b.fill( Color('steelblue') )
b.text( t, 6, b.height-6, f, Color('white') )
b.save( '#expandpath('.\example06a.gif')#' )
">
<cfx_imageflare source="
include('#expandpath('.\doSomeDecorating.fs')#')
include('#expandpath('.\simpleButton.fs')#')
simpleButton(
'Crystal^'s Store',
Font( 'Trebuchet MS', 9, 1 ),
Color('steelblue'),
Color('white')
).save('#expandpath('.\example06b.gif')#')
simpleButton(
'Michael^'s Page',
Font( 'Assiduous', 14 ),
Color('seagreen'),
Color('Gold')
).save('#expandpath('.\example06c.gif')#')
simpleButton(
'Alex^'s Links',
Font( 'Mickey', 14 ),
Color('VioletRed'),
Color('white')
).save('#expandpath('.\example06d.gif')#')
">
// requires doSomeDecorating.fs function simpleButton( text, font, bgcolor, textcolor ) b = Bitmap() b.size( font.getdimensions(text) ) b.size( b.width+12, b.height+12 ) b.fill( bgcolor ) doSomeDecorating( b, bgcolor ) textenhance = Color( bgcolor.red, bgcolor.green, bgcolor.blue ) textenhance.brightness = textenhance.brightness - 0.2 b.text( text, 5, b.height-7, font, textenhance ) b.text( text, 6, b.height-6, font, textcolor ) // DEBUG :: b.resize(b.width*4,0,0) return b end
function doSomeDecorating( bitmap, basecolor ) // color setup light = Color( basecolor.red, basecolor.green, basecolor.blue ) light.brightness = light.brightness + 0.2 dark = Color( basecolor.red, basecolor.green, basecolor.blue ) dark.brightness = dark.brightness - 0.2 // border bitmap.line( 0, 0, bitmap.width, 0, light, 4) bitmap.line( 0, 0, 0, bitmap.height, light, 4) bitmap.line( bitmap.width-1, 0, bitmap.width-1, bitmap.height, dark, 4 ) bitmap.line( 0, bitmap.height-1, bitmap.width, bitmap.height-1, dark, 4 ) // upper right corner bitmap.setpixel( bitmap.width-1, 0, basecolor ) bitmap.setpixel( bitmap.width-2, 0, light ) bitmap.setpixel( bitmap.width-2, 1, basecolor ) // lower left corner bitmap.setpixel( 0, bitmap.height-1, basecolor ) bitmap.setpixel( 0, bitmap.height-2, light ) bitmap.setpixel( 1, bitmap.height-2, basecolor ) end