Jump to content

Search the Community

Showing results for tags 'parseint'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

There are no results to display.

Forums

  • Welcome to Smart Mobile Studio
    • News and Information
    • Pre-Sales Questions
    • Smart In the Media
    • Smart Contests
    • Meta
  • Smart Mobile Studio Discussion
    • General
    • IDE
    • RTL
    • Code
    • Client Server
    • Platform
    • Graphics
    • Deployment
    • Suggestion box
  • Smart Mobile Studio support
    • Support
    • Bug report
  • General Discussion
    • Pascal
    • Delphi
    • Javascript
    • HTML/HTML5
    • CSS
  • Resources
    • Website
    • Download Smart Mobile Studio

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests


Company name


Position

Found 1 result

  1. lynkfs

    parseInt question

    the function below calculates the relative brightness of a colour (specified in hex : #008080 = 'teal') //funtion to find the relative brightness of a colour (hex-code) function Brightness(colour: string): integer; begin asm function coloro(color) { if(color.length==7){color=color.substring(1);} var R = parseInt(color.substring(0,2),16); var G = parseInt(color.substring(2,4),16); var B = parseInt(color.substring(4,6),16); return Math.sqrt(R * R * .241 + G * G * .691 + B * B * .068); } @result = coloro(colour); end; end; and is used to determine the best text colour on specific backgrounds (brightness < 130 = white else black); Not unlike the ColorListBox project in featured demo's. The above algorithm is a bit different than that demo and supposedly more accurate. Function works well but I don't like the asm block. Does anyone know if there is a Delphi/Pascal routine available somewhere which does the same as the javascript parseInt function ?
×