5
\$\begingroup\$

I'm not sure if this is intended or not, if it is, I'd like to know a way of preventing this: I've got this image (which is for testing purposes, the actual one has a texture, but I'm not using it right now): Zoomed in, it looks like this in the JFrame:

These small 'arrangements' are what bothers me, because the image itself should be plain green, just as it is when viewing the tile image with a separate viewer
(like that:)

OOO
--O--
O--O

In the end, drawn as a tilemap, it looks like this (I'm changing the rgb values, that's why it's coloured differently on the left):


My Code: (It draws 15 horizontal tiles and 10 vertical tiles, the orange ones are another piece of code which is irrelevant right now)

BufferedImage singleTile;
    try {
        singleTile = ImageIO.read(new File(filename));
    } catch (IOException e) {
        e.printStackTrace();
        return;
    }
    BufferedImage finalImg = new BufferedImage(tilesX*scaledTileSize, tilesY*scaledTileSize, singleTile.getType());
    for(int i = 0; i < tilesX; i++){
        for(int j = 0; j < tilesY; j++){
            finalImg.createGraphics().drawImage(singleTile, i*scaledTileSize, j*scaledTileSize, scaledTileSize, scaledTileSize, null);
        }
    }
\$\endgroup\$
  • \$\begingroup\$ I feel like this has something to do with filtering, can’t write a full answer right now, but play around with smooth vs fast filtering. \$\endgroup\$ – Evgeny Vasilyev Sep 8 '18 at 1:42
1
\$\begingroup\$

Firstly, It looks to me like whatever app you used to create your blank green texture put that pattern there. Try creating a texture using paint.net and see if the problem still persists. Also please show me the code to render the orange texture it could also be helpful. Also, you said that you are changing the RGB colors. Remove that code and it might solve your problem..

\$\endgroup\$
  • \$\begingroup\$ This feels more like a comment than a proper answer to the question. \$\endgroup\$ – Tyyppi_77 May 30 '18 at 12:26
  • \$\begingroup\$ @Tyyppi_77 I'm giving him a solution. That is an answer to the question \$\endgroup\$ – user116458 May 30 '18 at 13:47
  • \$\begingroup\$ Just feels like you're asking for clarification and provide a lot of "might"s. \$\endgroup\$ – Tyyppi_77 May 30 '18 at 13:52
  • \$\begingroup\$ @Tyyppi_77 he doesn't provide a quality question so I cant give him a quality answer. I'm just doing the best I can with the info he provides me \$\endgroup\$ – user116458 May 30 '18 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.