user2280872
user2280872

Reputation: 31

How do you print a horizontal line on an image and add "thickness"?

So I have the code to print a horizontal line on an image...

public void printH_line(int row, int thickness, int red, int green, int blue) {
    Pixel[] pixels = pic.getPixels();
    System.out.println("\nprintH_line");

    for (int c = 0; c < 200; c++) {
        Pixel pix = pic.getPixel(c, row);
        pix.setColor(new Color(limitVal(red), limitVal(green),
                limitVal(blue)));

Now I just don't know how to do the "thickness," meaning how thick the user wants the line to be. I will be asking the user to enter a number on how thick they want the line to be and that is "int thickness."

Upvotes: 1

Views: 886

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168845

Use Graphics2D.setStroke(Stroke) as seen in this answer.

Upvotes: 1

Related Questions