How to resolve the algorithm Yin and yang step by step in the FutureBasic programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Yin and yang step by step in the FutureBasic programming language

Table of Contents

Problem Statement

One well-known symbol of the philosophy of duality known as yin and yang is the taijitu.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Yin and yang step by step in the FutureBasic programming language

Source code in the futurebasic programming language

_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

  

You may also check:How to resolve the algorithm Holidays related to Easter step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Temperature conversion step by step in the 8th programming language
You may also check:How to resolve the algorithm Reverse a string step by step in the NS-HUBASIC programming language
You may also check:How to resolve the algorithm Averages/Root mean square step by step in the S-BASIC programming language
You may also check:How to resolve the algorithm Ackermann function step by step in the ReScript programming language