Yin and yang: Difference between revisions
no edit summary
m (→{{header|Rust}}: syntaxhighlight lang="rust") |
No edit summary |
||
Line 2,258:
s" gyinyang.ppm" save_image \ save the image</syntaxhighlight>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">
_window = 1
begin enum output 1
_imageView1
_imageView2
end enum
local fn YinYangImage( size as float ) as ImageRef
CFDictionaryRef attributes = @{NSFontAttributeName:fn FontWithName( @"Menlo", size ), NSBackgroundColorAttributeName:fn ColorClear}
CFMutableAttributedStringRef aString = fn MutableAttributedStringWithAttributes( @"\u262F", attributes )
ImageRef image = fn ImageWithSize( fn AttributedStringSize( aString ) )
ImageLockFocus( image )
GraphicsContextSaveGraphicsState
AttributedStringDrawAtPoint( aString, fn CGPointMake( 0, 0 ) )
GraphicsContextRestoreGraphicsState
ImageUnlockFocus( image )
end fn = image
void local fn BuildWindow
CGRect r = fn CGRectMake( 0, 0, 300, 200 )
window _window, @"Rosetta Code Yin and Yang", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable + NSWindowStyleMaskMiniaturizable
WindowSetBackgroundColor( _window, fn ColorWhite )
ImageRef yinyang = fn YinYangImage( 250.0 )
r = fn CGRectMake( 20, 10, 170, 180 )
imageview _imageView1, YES, yinyang, r, NSImageScaleNone, NSImageAlignCenter, NSImageFrameNone, _window
r = fn CGRectMake( 190, 90, 100, 100 )
imageview _imageView2, YES, yinyang, r, NSImageScaleProportionallyDown, NSImageAlignCenter, NSImageFrameNone, _window
end fn
void local fn DoDialog( ev as long, tag as long, wnd as long )
select ( ev )
case _windowWillClose : end
end select
end fn
on dialog fn DoDialog
fn BuildWindow
HandleEvents
</syntaxhighlight>
{{output}}
[[File:FutureBasic Yin and Yang.png]]
=={{header|Go}}==
|