Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Color.BLACK is the integer representation of argb Hex value 0xff000000. So your statement is checking whether a center point in the circle is exactly the same transparency, red value, blue value and green value as Color.BLACK.</p> <p>A few options:</p> <p>You can try comparing just the rgb value by using </p> <pre><code>if(Color.rgb(Color.red(Color.BLACK), Color.green(Color.BLACK), Color.blue(Color.BLACK) == Color.rgb(Color.red(pixelColor), Color.green(pixelColor), Color.blue(pixelColor)) </code></pre> <p>Alternatively you could scan the entire circle for a black (0x000000) pixel.</p> <p>Alternatively you could use a Color difference algorithm and you can test different tolerances for what you need. This may help you <a href="https://stackoverflow.com/questions/9018016/how-to-compare-two-colors">How to compare two colors for similarity/difference</a>.</p> <p>The following hasn't been tested, but will give you an idea of which direction you could take also: </p> <pre><code>//mid points x1 and y1 int x1=(int) (myMidPoint.x) /2; int y1=(int)(myMidPoint.y)/2; int radius = 30; int topPoint = y1 - radius; int leftPoint = x1 - radius; int rightPoint = x1 + radius; int bottomPoint = y1 + radius; int scanWidth = 0; for(int i = topPoint; i &lt; bottomPoint; i++) { if(i &lt;= y1) { scanWidth++; } else { scanWidth--; } for(int j = x1 - scanWidth; j &lt; x1 + scanWidth; j++) { int pixelColor = myBitmap.getPixel(j,i); if(Color.rgb(Color.red(Color.BLACK), Color.green(Color.BLACK), Color.blue(Color.BLACK) == Color.rgb(Color.red(pixelColor), Color.green(pixelColor), Color.blue(pixelColor)) { System.out.println("pixel black"); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload