Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9218015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:45:54+00:00 2026-06-18T02:45:54+00:00

I would like to create something similar to this question Can I convert an

  • 0

I would like to create something similar to this question Can I convert an image into a grid of dots? but I cannot find any answer for my problem. The basic idea is to load a picture from the phone and apply this grid of dots. I would appreciate any suggestions to this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T02:45:55+00:00Added an answer on June 18, 2026 at 2:45 am

    As others may suggest, your problem can also be solved using a fragment shader in OpenGL Shading Language (GLSL). GLSL might require painful setup.

    Here is my solution using Android Renderscript (a lot like GLSL, but specifically designed for Android. It isn’t used much). First, setup the Renderscript > Hello Compute sample from inside the official Android SDK samples. Next, replace mono.rs with the following:

    #pragma version(1)
    #pragma rs java_package_name(com.android.example.hellocompute)
    
    rs_allocation gIn;
    rs_allocation gOut;
    rs_script gScript;
    
    static int mImageWidth;
    const uchar4 *gPixels;
    
    const float4 kBlack = {
        0.0f, 0.0f, 0.0f, 1.0f
    };
    
    // There are two radius's for each circle for anti-aliasing reasons. 
    const static uint32_t radius = 15; 
    const static uint32_t smallerRadius = 13;
    
    // Used so that we have smooth circle edges
    static float smooth_step(float start_threshold, float end_threshold, float value) {
        if (value < start_threshold) {
            return 0;
        }
        if (value > end_threshold) {
            return 1;
        }
        value = (value - start_threshold)/(end_threshold - start_threshold);
        // As defined at http://en.wikipedia.org/wiki/Smoothstep
        return value*value*(3 - 2*value);
    }
    
    void root(const uchar4 *v_in, uchar4 *v_out, uint32_t u_x, uint32_t u_y) {
        int32_t diameter = radius * 2;
    
        // Compute distance from center of the circle
        int32_t x = u_x % diameter - radius;
        int32_t y = u_y % diameter - radius;
        float dist = hypot((float)x, (float)y);
    
        // Compute center of the circle
        uint32_t center_x = u_x /diameter*diameter + radius;
        uint32_t center_y = u_y /diameter*diameter + radius;
    
        float4 centerColor = rsUnpackColor8888(gPixels[center_x + center_y*mImageWidth]);
        float amount = smooth_step(smallerRadius, radius, dist);
        *v_out = rsPackColorTo8888(mix(centerColor, kBlack, amount));
    }
    
    void filter() {
        mImageWidth = rsAllocationGetDimX(gIn);
        rsForEach(gScript, gIn, gOut); // You may need a forth parameter, depending on your target SDK.
    }
    

    Inside HelloCompute.java, replace createScript() with the following:

    private void createScript() {
          mRS = RenderScript.create(this);
    
            mInAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
                                                        Allocation.MipmapControl.MIPMAP_NONE,
                                                        Allocation.USAGE_SCRIPT);
            mOutAllocation = Allocation.createTyped(mRS, mInAllocation.getType());
    
            mScript = new ScriptC_mono(mRS, getResources(), R.raw.mono);
    
            mScript.bind_gPixels(mInAllocation);
    
            mScript.set_gIn(mInAllocation);
            mScript.set_gOut(mOutAllocation);
            mScript.set_gScript(mScript);
            mScript.invoke_filter();
            mOutAllocation.copyTo(mBitmapOut);
    }
    

    The end result will look like this
    enter image description here

    ALTERNATIVE

    If you don’t care about having each dot a solid color, you can do the following:

    There is a very easy way to do this. You need a BitmapDrawable for the picture and a BitmapDrawable for the overlay tile (lets call it overlayTile). On overlayTile, call

    overlayTile.setTileModeX(Shader.TileMode.REPEAT);
    overlayTile.setTileModeY(Shader.TileMode.REPEAT);
    

    Next, combine the two Drawable‘s into a single Drawable using LayerDrawable. You can use the resulting LayerDrawable as src for some ImageView, if you wish. Or, you can convert the Drawable to a Bitmap and save it to disk.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm looking to create something like in this image. Each block would have an
I would like to do something fundamentally similar to this question: Merge an untracked
In PHP, to create a new object you would do something like this, $dog
I would like to create a class that runs something (a runnable) at regular
I would like to create this shape using just css. I am pretty sure
I would like to create a virtual host in apache2, but I want it
Currently, I have URLs that look like this: http://www.example.com/user/create http://www.example.com/user/edit/1 But now, I have
Referring on this question , I have a similar -but not the same- problem..
Sorry I know similar question have been asked many times before but like most
In this question's answers someone can find many sites (like ideone ) allowing a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.