Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

draw circle with fill java

double treshold = 0.8;
for (double y = 0, n = 2.0 * radius; y < n; y++)
{
    for (double x = 0; x < n; x++)
    {
        double deltaX = radius - x;
        double deltaY = radius - y;
      	double distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
      	double color = Math.max(0, Math.min(1, radius - distance));
      
        if(color>treshold){
          	//draw pixel (e.g.: openGL: glVertex2i(x, y))
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Java :: java how to know if there is something on arguments 
Java :: queue.isempty java 
Java :: java bfs 
Java :: how to change toolbar name in android studio 
Java :: how to create hashmap 
Java :: Simple While Loop Java Example 
Java :: java set classpath 
Java :: Infinite While Loop Java Example 
Java :: float to int in java 
Java :: call function after specific time java android 
Java :: java.lang.NoClassDefFoundError: 
Java :: change text size java 
Java :: build libgdx jar 
Java :: java generics 
Java :: change short video to byte array android 
Java :: variable is multiple of 3 
Java :: how to covert array into a char 
Java :: setimageuri crash 
Java :: give ram to java 
Java :: how to convert string hashcode to color in java android 
Java :: get host from request object java 
Java :: flutter webview plugin background transparent 
Java :: java set file folder permissions 
Java :: how to make jenkins pipeline choose specific java version 
Java :: area of rectangle in java 
Java :: android alert change color 
Java :: my maven project give error when adding javax.xml.bind dependency 
Java :: find out duplicate number between 1 to n numbers in java 
Java :: arrays methods in java 
Java :: java map key set 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =