我想知道是否可以找到有关此问题的帮助。我被要求使用图像(“corn.jpg”),并将其完全颠倒。我知道我需要编写一个程序来从左上角和左下角切换像素,等等,但我无法在时间用完之前让我的程序正常工作。谁能提供一些提示或建议来解决这个问题?我希望能够自己写出我的代码,所以请只提供建议。请注意,我对 APImage 和 Pixel 的了解非常有限。我正在用 Java 编程。这是我设法完成的工作。
import images.APImage;
import images.Pixel;
public class Test2
{
public static void main(String [] args)
{
APImage image = new APImage("corn.jpg");
int width = image.getImageWidth();
int height = image.getImageHeight();
int middle = height / 2;
//need to switch pixels in bottom half with the pixels in the top half
//top half of image
for(int y = 0; y < middle; y++)
{
for (int x = 0; x < width; x++)
{
//bottom half …Run Code Online (Sandbox Code Playgroud)