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 7558799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:27:56+00:00 2026-05-30T12:27:56+00:00

In my application I have an image (world map) as background picture. Over this

  • 0

In my application I have an image (world map) as background picture. Over this background picture, there is a polygon with a color gradient and transparent filling effect.

Here you find a code snippet of the overlay:

public void paint(Graphics g) {

      //draw a polygon with a gradient filling effect
      Graphics2D g2 = (Graphics2D)g;
      GradientPaint gp = new GradientPaint(x1, y1, color1, x2, y2, color2, false);
      g2.setPaint(gp);
      g2.fill(polygon);

}

Does somebody know a method to get the color of one pixel of the overlay? I don’t need the color, which can be seen on the screen including the background picture – just the color of the overlay.

Best regards,

Michael

  • 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-05-30T12:27:58+00:00Added an answer on May 30, 2026 at 12:27 pm

    This is somewhat ugly, but works:

    GradientPaint gp = new GradientPaint(0, 0, new Color(255, 0, 0, 50), 
                                       10, 10, new Color(128, 255, 0, 150));
    
    ColorModel cm = ColorModel.getRGBdefault();
    Rectangle r = new Rectangle(0, 0, 10, 10);
    Raster raster = gp.createContext(cm, r, r, new AffineTransform(), null)
                      .getRaster(0, 0, 10, 10);
    
    int[] rgba = raster.getPixel(5, 5, (int[])null);
    

    Alternately, you could just paint the overlay into a BufferedImage (which you had first cleared to transparent).

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

Sidebar

Related Questions

I am developing wpf application. I have one static world map of 500 width
I have this camera application that I'm working on which uses openCV for image
I have a world map image (png image), now I am planning to add
I have an application where I can have an image moving towards the eye.
In my application,I have 4 ImageButtons and each ImageButton have different source image based
Currently in my iPhone application I have about 200 image views, and I will
I have an image editing application, and I have custom adorners which get added
I have an Image control in my Flex application: <mx:Image id=img source=@Embed('img.png') percentHeight=100 percentWidth=100
In an iPhone application I'm developing I have a Image View that displays eyes
I want my WPF application to have a ToggleButton that contains an image of

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.