public class ImageTester extends Image
Here's a sample:
public class GraphicsTest extends TestCase { private Graphics g; private boolean learning = false; // change this to true to generate the strings // generated string during learning stage private String drawLine = "58C3AD94510EC2300CC5DEFD0FEA73C0186C0335892791DF7956DB240F6485CCB571027CCAC80C6E2E32822F1599C0DD4406F02D223DF8F190163C34A4034F0B69C08B84D4E0D5414AF04BD17C4ACDA5BA16D5997EFFA778FF4C5C9613B4E0B21A5DDA2EFCC527CFD7DE17F77EDCED87ECAF9C17397FF33C73633FE4BEC9FD957920F345E695CC3F99A7329F0DB683AA1EE9F8D157"; private ImageTester testDrawLine() { int w = 40, h = 40; ImageTester it = new ImageTester(w,h); Graphics g = it.g; g.backColor = Color.WHITE; g.fillRect(0,0,w,h); g.drawLine(0,0,w,h); g.drawLine(0,0,w,0); g.drawLine(0,0,0,h); g.drawLine(w-1,0,w-1,h); g.drawLine(0,h-1,w,h-1); g.drawLine(w,0,0,h); g.drawLine(5,10,5,10); // a single pixel g.drawLine(5,15,6,16); // two pixels return it; } public void testRun() { g = MainWindow.getMainWindow().getGraphics(); test(testDrawLine(), drawLine, "drawLine"); } private void test(ImageTester it, String compressedResults, String title) { if (learning) { g.drawImage(it,0,0); Vm.debug("private String "+title+" = \""+it.toString()+"\";"); } else assertEquals(it, compressedResults); } }
Modifier and Type | Field and Description |
---|---|
Graphics |
g |
java.lang.String |
name |
java.lang.String |
title |
alphaMask, comment, FADE_VALUE, height, hwScaleH, hwScaleW, NO_TRANSPARENT_COLOR, surfaceType, transparentColor, useAlpha, width
Constructor and Description |
---|
ImageTester(int width,
int height) |
ImageTester(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object originalObj)
This testthod is the reason for the creation of this class.
|
static void |
hex2bytes(java.lang.String str,
ByteArrayStream bas) |
java.lang.String |
toString()
Converts this image to String, as a string of hexadecimal numbers.
|
applyChanges, applyColor, applyColor2, applyFade, changeColors, createJpg, createJpg4B, createPng, getAlphaInstance, getClippedInstance, getCopy, getCurrentFrame, getFadedInstance, getFadedInstance, getFrameCount, getFrameInstance, getGraphics, getHeight, getHwScaledInstance, getJpegBestFit, getJpegScaled, getPath, getPixelRow, getPixels, getRotatedScaledInstance, getScaledInstance, getSmoothScaledInstance, getSmoothScaledInstance, getTouchedUpInstance, getWidth, getX, getY, hwScaledBy, hwScaledFixedAspectRatio, isSupported, loadFrom, lockChanges, nextFrame, prevFrame, resizeJpeg, saveTo, scaledBy, setCurrentFrame, setFrameCount, setHwScaleFixedAspectRatio, setTransparentColor, smoothScaledBy, smoothScaledBy, smoothScaledFixedAspectRatio, smoothScaledFixedAspectRatio, smoothScaledFromResolution, smoothScaledFromResolution, writeFrameCount
public Graphics g
public java.lang.String title
public java.lang.String name
public ImageTester(int width, int height) throws ImageException
ImageException
public ImageTester(java.lang.String name) throws ImageException, IOException
ImageException
IOException
public boolean equals(java.lang.Object originalObj)
public static void hex2bytes(java.lang.String str, ByteArrayStream bas)
public java.lang.String toString()
toString
in class java.lang.Object