📄 displaylist.java
字号:
firstRun = runPool; runPool = firstRun.next; firstRun.next = null; firstRun.nColors = 0; firstRun.isComplex = false; firstRun.isPure = true; } else { firstRun = new RRun(); } firstRun.xmin = edgeClip.xmin; firstRun.xmax = edgeClip.xmax; } curRun = firstRun; } else { bitY = y; } int l = 0; int i1 = y + 1; for(int j1 = 0; j1 < nActive; j1++) { REdge redge2 = activeEdges[j1]; switch(redge2.fillRule) { case 0: // '\0' RColor rcolor = redge2.color1; if(rcolor.visible != 0) { rcolor.visible = 0; int k1 = redge2.x; if(rcolor == topColor) UpdateColor(k1); } else { rcolor.visible = 1; ShowColor(rcolor, redge2.x); } rcolor = redge2.color2; if(rcolor.visible != 0) { rcolor.visible = 0; int l1 = redge2.x; if(rcolor == topColor) UpdateColor(l1); } else { rcolor.visible = 1; ShowColor(rcolor, redge2.x); } break; case 1: // '\001' RColor rcolor1 = redge2.color1; if(rcolor1.visible != 0) { rcolor1.visible = 0; int i2 = redge2.x; if(rcolor1 == topColor) UpdateColor(i2); } else { rcolor1.visible = 1; ShowColor(rcolor1, redge2.x); } break; case 2: // '\002' RColor rcolor2 = redge2.color1; if(rcolor2.visible == 0) { rcolor2.visible += redge2.dir; ShowColor(rcolor2, redge2.x); } else { rcolor2.visible += redge2.dir; if(rcolor2.visible == 0) { int j2 = redge2.x; if(rcolor2 == topColor) UpdateColor(j2); } } break; } if(((Curve) (redge2)).anchor2y > i1) { redge2.Step(i1); activeEdges[l] = redge2; l++; } } nActive = l; if(antialias) { if((y & 3) == 3) { PaintAARuns(); if(theConsumer == null) return; AdvanceLine(); } } else { if(theConsumer == null) return; AdvanceLine(); } } if(theConsumer != null) SendPixels(); runPool = null; }*/ final int indexToRGB(int i) { return ctab[i]; } final int RGBToIndex(int i) { int j = (i & 0xf00000) >> 12 | (i & 0xf000) >> 8 | (i & 0xf0) >> 4; return itab[j] & 0xff; } private final int ColorDist(int i, int j) { int k = i - j; if(k < 0) return -k; else return k; } private final void FillCube(int i, int j, int k) { int l = i >> 16 & 0xff; int i1 = i >> 8 & 0xff; int j1 = i & 0xff; int k1 = l >> 4; int i2 = i1 >> 4; int k2 = j1 >> 4; int i3 = Math.max(0, k1 - k); int j3 = Math.min(15, k1 + k); int k3 = Math.max(0, i2 - k); int l3 = Math.min(15, i2 + k); int i4 = Math.max(0, k2 - k); int j4 = Math.min(15, k2 + k); for(int l1 = i3; l1 <= j3; l1++) { int k4 = l1 != 15 ? l1 << 4 : 255; for(int j2 = k3; j2 <= l3; j2++) { int l4 = j2 != 15 ? j2 << 4 : 255; int i5 = ColorDist(k4, l) + ColorDist(l4, i1); int j5 = l1 << 8 | j2 << 4; for(int l2 = i4; l2 <= j4; l2++) { int k5 = l2 != 15 ? l2 << 4 : 255; int l5 = j5 | l2; int i6 = i5 + ColorDist(k5, j1); if(i6 < error[l5]) { if(error[l5] == 50000) nEmpty--; error[l5] = i6; itab[l5] = (byte)j; } } } } } private final void BuildInverseTable() { if(itab == null || error == null) { itab = new byte[4096]; error = new int[4096]; } for(int i = 0; i < 4096; i++) error[i] = 50000; nEmpty = 4096; for(int j = 3; j < 16 && nEmpty > 0; j++) { for(int k = 0; k < nColors; k++) FillCube(ctab[k], k, j); } error = null; } public synchronized boolean updateImageSize(int i, int j) { if(i != width || j != height) { setImage(i, j/*, model*/); return true; } else { return false; } } public synchronized void setImage(int width, int height/*, ColorModel colormodel*/) {// model = colormodel; this.width=width; this.height=height;// invalidate(); ctab = new int[width*height];/* if(model instanceof IndexColorModel) { IndexColorModel indexcolormodel = (IndexColorModel)model; nColors = indexcolormodel.getMapSize(); byte abyte0[] = new byte[nColors]; byte abyte1[] = new byte[nColors]; byte abyte2[] = new byte[nColors]; indexcolormodel.getReds(abyte0); indexcolormodel.getGreens(abyte1); indexcolormodel.getBlues(abyte2); ctab = new int[nColors]; int k = 0; for(int l = 0; l < nColors; l++) { ctab[l] = 0xff000000 | (abyte0[l] & 0xff) << 16 | (abyte1[l] & 0xff) << 8 | abyte2[l] & 0xff; if(ctab[l] == -1) k++; } if(k > 100) { forceCompleteScanlines = true; SetImage(i, j, ColorModel.getRGBdefault()); return; } indexedColor = true; BuildInverseTable(); if(pixels8 == null || pixelSize < 4 * width) { pixelSize = width * height; if(pixelSize > 0x186a0 && !flash.allocateFullClug) pixelSize = 0x186a0; pixels8 = new byte[pixelSize]; pixels32 = null; } return; } model = ColorModel.getRGBdefault();*/ indexedColor = false; if(pixels32 == null || pixelSize < 4 * width) { pixelSize = width * height; if(pixelSize > 50000 && !flash.allocateFullClug) pixelSize = 50000; pixels8 = null; pixels32 = new int[pixelSize]; }// ctab = null; itab = null; } boolean update() { Rect rect = devDirtyRgn; if(rect.xmin != 0x80000000 && true) { produce(true); return true; } else return false; } synchronized void gotoFrame(ScriptPlayer scriptplayer, int i) { scriptplayer.mute = true; scriptplayer.nActions = 0; scriptplayer.DrawFrame(i - 1); scriptplayer.mute = false; scriptplayer.nActions = 0; scriptplayer.DrawFrame(i); } synchronized int drawFrame(ScriptPlayer scriptplayer, int i) { return scriptplayer.DrawFrame(i); }/* public synchronized void addConsumer(ImageConsumer imageconsumer) { if(imageconsumer != theConsumer) { theConsumer = imageconsumer; newConsumer = true; } }*//* public boolean isConsumer(ImageConsumer imageconsumer) { return theConsumer == imageconsumer; } public synchronized void removeConsumer(ImageConsumer imageconsumer) { if(theConsumer == imageconsumer) theConsumer = null; } public void startProduction(ImageConsumer imageconsumer) { addConsumer(imageconsumer); produce(false); } public void requestTopDownLeftRightResend(ImageConsumer imageconsumer) { }*/ private synchronized void produce(boolean flag) { if (ctab==null) { System.err.println("ctab==null at DisplayList.produce()"); return; } myImage=Image.createRGBImage(ctab,width,height,true); /* if (theConsumer==null) { flash.repaint(); return; } if (newConsumer) { theConsumer.setDimensions(width, height); if(theConsumer == null) return; theConsumer.setColorModel(model); if(theConsumer == null) return; theConsumer.setHints(10); newConsumer = false; } if(theConsumer == null) return; if(!flag) { bitClip = new Rect(0, 0, width, height); } else { bitClip = new Rect(devDirtyRgn); if(antialias) { bitClip.xmin /= 4; bitClip.ymin /= 4; bitClip.xmax /= 4; bitClip.ymax /= 4; } bitClip.xmin -= 2; bitClip.xmax += 2; bitClip.ymin -= 2; bitClip.ymax += 2; bitClip.xmin = Math.max(bitClip.xmin, 0); bitClip.xmax = Math.min(bitClip.xmax, width); bitClip.ymin = Math.max(bitClip.ymin, 0); bitClip.ymax = Math.min(bitClip.ymax, height); if(bitClip.xmin >= bitClip.xmax || bitClip.ymin >= bitClip.ymax) { Rect rect = bitClip; rect.xmin = rect.xmax = rect.ymin = rect.ymax = 0x80000000; } } Rect rect1 = devDirtyRgn; rect1.xmin = rect1.xmax = rect1.ymin = rect1.ymax = 0x80000000; rect1 = bitClip; if(rect1.xmin != 0x80000000 && true) { if(forceCompleteScanlines) { bitClip.xmin = 0; bitClip.xmax = width; } if(antialias) { edgeClip = new Rect(bitClip); edgeClip.xmin *= 4; edgeClip.xmax *= 4; edgeClip.ymin *= 4; edgeClip.ymax *= 4; } else { edgeClip = bitClip; } ylines = (edgeClip.ymax - edgeClip.ymin) + 1; yindex = new REdge[ylines]; if(activeEdges == null) { maxActive = 250; activeEdges = new REdge[maxActive]; } nActive = 0; activeColors = null; topColor = null; topColorXleft = 0; for(SObject sobject = objects; sobject != null; sobject = sobject.next) if(sobject.devBounds.testIntersect(edgeClip)) { sobject.BuildEdges(); sobject.drawn = true; AddEdges(sobject.edges); } if(backgroundColor != 0) { REdge redge = new REdge(); REdge redge1 = new REdge(); RColor rcolor = new RColor(this, backgroundColor); rcolor.order = 0; redge.nextObj = redge1; Point point = new Point(edgeClip.xmin, edgeClip.ymin); Point point1 = new Point(edgeClip.xmin, edgeClip.ymax); redge.set(point, point1); point.x = point1.x = edgeClip.xmax; redge1.set(point, point1); redge.fillRule = redge1.fillRule = 1; redge.color1 = redge1.color1 = rcolor; AddEdges(redge); } PaintBits(); theConsumer.imageComplete(2); flash.updateImageToScreeen(true, bitClip.xmin, bitClip.ymin, (bitClip.xmax - bitClip.xmin) + 1, (bitClip.ymax - bitClip.ymin) + 1); }*/ }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -