📄 barcode.java
字号:
public int getModuleCount()
{
return _symbol.getModuleNum();
}
public int getOrientation()
{
return _orientation;
}
int getOrientationDegrees()
{
char c = '\0';
switch(_orientation)
{
case 0: // '\0'
c = '\0';
break;
case 1: // '\001'
c = 'Z';
break;
case 2: // '\002'
c = '\264';
break;
case 3: // '\003'
c = '\u010E';
break;
}
return c;
}
public char[] getOriginalAddOnData(boolean flag)
{
if(_acOrigAddOnData != null)
return _acOrigAddOnData;
if(flag)
return _symbol.getAddOnText(1, 0L);
else
return null;
}
public char[] getOriginalData(boolean flag)
{
if(_acOrigData != null)
return _acOrigData;
if(flag)
return _symbol.getOriginalText();
else
return null;
}
public boolean getRetainAspectRatio()
{
return _retainAspectRatio;
}
public boolean getShowCode39StartStop()
{
return _showCode39StartStop;
}
public SimpleFont getSimpleFont()
{
return _font;
}
public int getSpaceTypeCount()
{
return _symbol.getNumSpaceTypes();
}
public int getSpaceTypeWidth(int i)
{
return _symbol.getSpaceExt(i);
}
public boolean getStretchText()
{
return _stretchText;
}
BarcodeSymbol getSymbol()
{
return _symbol;
}
public int getTextAlign()
{
return _textAlign;
}
public boolean getThrowDataError()
{
return _throwDataError;
}
public boolean getTrialExpired()
{
return _license.getLicenseType() == 3;
}
public boolean getUniBarHeight()
{
return _uniBarHeight;
}
public boolean getUpcSmallFont()
{
return _upcSmallFont;
}
public int getVertAlign()
{
return _vertAlign;
}
public boolean isAddOnDataInvalid()
{
return _bAddOnDataInvalid;
}
public boolean isDataInvalid()
{
return _bDataInvalid;
}
public void makeImage(int i, int j, int k, boolean flag, int l, String s, OutputStream outputstream)
throws Exception
{
Dimension dimension = new Dimension(0, 0);
makeImage(i, j, k, flag, l, s, outputstream, dimension);
}
public void makeImage(int i, int j, int k, boolean flag, int l, String s, OutputStream outputstream,
Dimension dimension)
throws Exception
{
Object obj;
if(i == 3)
obj = new JpgEncoder();
else
obj = new PngEncoder();
Frame frame = new Frame();
frame.addNotify();
Image image = prepareImage(frame, j, k, flag, l, ((ImageEncoder) (obj)).use2ColorSource(), s);
if(dimension != null)
{
dimension.width = image.getWidth(null);
dimension.height = image.getHeight(null);
}
((ImageEncoder) (obj)).encode(image, _clrFore.getColor(), _clrBack.getColor(), _figureTransparent, outputstream);
frame.dispose();
}
public void makeImage(int i, int j, int k, boolean flag, OutputStream outputstream)
throws Exception
{
Dimension dimension = new Dimension(0, 0);
makeImage(i, j, k, flag, 1, null, outputstream, dimension);
}
public Image makeImage(int i, int j, boolean flag, int k, String s)
throws Exception
{
Frame frame = new Frame();
frame.addNotify();
Image image = prepareImage(frame, i, j, flag, k, true, s);
frame.dispose();
return image;
}
public void makeSimpleImage(int i, int j, int k, boolean flag, int l, String s, OutputStream outputstream)
throws Exception
{
makeSimpleImage(i, j, k, flag, l, s, outputstream, null);
}
public void makeSimpleImage(int i, int j, int k, boolean flag, int l, String s, OutputStream outputstream,
SimpleDimension simpledimension)
throws Exception
{
Object obj;
if(i == 3)
obj = new JpgEncoder();
else
obj = new PngEncoder();
SimpleDimension simpledimension1 = new SimpleDimension(0, 0);
byte abyte0[] = prepareSimpleImage(j, k, flag, l, ((ImageEncoder) (obj)).use2ColorSource(), s, simpledimension1);
((ImageEncoder) (obj)).encode(abyte0, simpledimension1.width, simpledimension1.height, _clrFore, _clrBack, _figureTransparent, outputstream);
if(simpledimension != null)
{
simpledimension.width = simpledimension1.width;
simpledimension.height = simpledimension1.height;
}
}
public void makeSimpleImage(int i, int j, int k, boolean flag, OutputStream outputstream)
throws Exception
{
makeSimpleImage(i, j, k, flag, 1, null, outputstream, null);
}
public Image makeSimpleImage(int i, int j, boolean flag, int k, String s)
throws Exception
{
SimpleDimension simpledimension = new SimpleDimension(0, 0);
int ai[] = makeSimpleImagePixels(i, j, flag, k, s, simpledimension);
Image image = Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(simpledimension.width, simpledimension.height, ai, 0, simpledimension.width));
return image;
}
public int[] makeSimpleImagePixels(int i, int j, boolean flag, int k, String s, SimpleDimension simpledimension)
throws Exception
{
byte abyte0[] = prepareSimpleImage(i, j, flag, k, true, s, simpledimension);
int ai[] = simpleBitmapToPixelArray(abyte0, simpledimension.width, simpledimension.height, 0xff000000 | _clrFore.getRGB(), _clrBack.getRGB() | (_figureTransparent ? 0 : 0xff000000));
return ai;
}
Image prepareImage(Frame frame, int i, int j, boolean flag, int k, boolean flag1, String s)
{
SimpleColor simplecolor = flag1 ? SimpleColor.black : _clrFore;
SimpleColor simplecolor1 = flag1 ? SimpleColor.white : _clrBack;
i *= k;
j *= k;
int j1 = getModuleCount();
if(flag)
{
switch(_orientation)
{
case 1: // '\001'
case 3: // '\003'
int k1 = i;
i = j * j1;
j = k1;
break;
case 0: // '\0'
case 2: // '\002'
default:
i *= j1;
break;
}
} else
{
switch(_orientation)
{
case 1: // '\001'
case 3: // '\003'
int l1 = i;
i = j;
j = l1;
break;
}
if(i != 0 && j1 != 0)
{
i = (i + j1 / 2) / j1;
if(i == 0)
i = 1;
i *= j1;
}
}
long l2 = getDrawingAttributes();
l2 &= 0xfffffffffffdffffL;
SimpleFont simplefont = k != 1 ? _font.clone(k) : _font;
if(s != null && (i == 0 || j == 0))
{
Image image = frame.createImage(1, 1);
Graphics g = image.getGraphics();
SimpleDimension simpledimension = calcTextSize(g, s, simplefont);
g.dispose();
if(i == 0)
i = simpledimension.width;
if(j == 0)
j = simpledimension.height;
}
int l;
int i1;
if(_orientation == 0 || _orientation == 2)
{
l = i;
i1 = j;
} else
{
l = j;
i1 = i;
}
Image image1 = frame.createImage(l, i1);
Graphics g1 = image1.getGraphics();
SimpleGraphics simplegraphics = new SimpleGraphics(g1);
if(_orientation != 0)
simplegraphics.setTransform(AffineTransform.getRotateInstance((-3.1415926535897931D * (double)_orientation) / 2D, l / 2, i1 / 2));
SimpleRectangle simplerectangle;
if(_orientation == 0 || _orientation == 2)
simplerectangle = new SimpleRectangle(0, 0, i, j);
else
simplerectangle = new SimpleRectangle(-(i - j) / 2, (i - j) / 2, i, j);
simplegraphics.setFont(simplefont);
simplegraphics.setColor(simplecolor);
draw(simplegraphics, simplerectangle, l2, simplecolor1, s);
simplegraphics.dispose();
return image1;
}
private byte[] prepareSimpleImage(int i, int j, boolean flag, int k, boolean flag1, String s, SimpleDimension simpledimension)
{
flag1 = true;
i *= k;
j *= k;
SimpleColor simplecolor = flag1 ? SimpleColor.black : _clrFore;
SimpleColor simplecolor1 = flag1 ? SimpleColor.white : _clrBack;
int j1 = getModuleCount();
if(flag)
{
switch(_orientation)
{
case 1: // '\001'
case 3: // '\003'
int k1 = i;
i = j * j1;
j = k1;
break;
case 0: // '\0'
case 2: // '\002'
default:
i *= j1;
break;
}
} else
{
switch(_orientation)
{
case 1: // '\001'
case 3: // '\003'
int l1 = i;
i = j;
j = l1;
break;
}
if(i != 0 && j1 != 0)
{
i = (i + j1 / 2) / j1;
if(i == 0)
i = 1;
i *= j1;
}
}
long l2 = getDrawingAttributes();
l2 &= 0xfffffffffffdffffL;
SimpleFont simplefont = k != 1 ? _font.clone(k) : _font;
if(s != null && (i == 0 || j == 0))
{
SimpleGraphics simplegraphics = SimpleGraphics.createInMemoryGraphics(1, 1, true);
SimpleDimension simpledimension1 = calcSimpleTextSize(simplegraphics, s, simplefont);
simplegraphics.dispose();
if(i == 0)
i = simpledimension1.width;
if(j == 0)
j = simpledimension1.height;
}
SimpleGraphics simplegraphics1 = SimpleGraphics.createInMemoryGraphics(i, j, flag1);
simplegraphics1.setFont(simplefont);
simplegraphics1.setColor(simplecolor);
SimpleRectangle simplerectangle = new SimpleRectangle(0, 0, i, j);
draw(simplegraphics1, simplerectangle, l2, simplecolor1, s);
byte abyte0[] = simplegraphics1.detachBitmapBytes();
simplegraphics1.dispose();
if(_orientation != 0)
abyte0 = SimpleGraphics.createRotatedBitmap(abyte0, i, j, getOrientationDegrees());
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -