⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 orders.java

📁 cygwin 是一个在windows平台上运行的unix模拟环境
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
    private void processPatBlt(RdpPacket_Localised data, PatBltOrder patblt,
            int present, boolean delta) {
        if ((present & 0x01) != 0)
            patblt.setX(setCoordinate(data, patblt.getX(), delta));
        if ((present & 0x02) != 0)
            patblt.setY(setCoordinate(data, patblt.getY(), delta));
        if ((present & 0x04) != 0)
            patblt.setCX(setCoordinate(data, patblt.getCX(), delta));
        if ((present & 0x08) != 0)
            patblt.setCY(setCoordinate(data, patblt.getCY(), delta));
        if ((present & 0x10) != 0)
            patblt.setOpcode(ROP2_P(data.get8()));
        if ((present & 0x20) != 0)
            patblt.setBackgroundColor(setColor(data));
        if ((present & 0x40) != 0)
            patblt.setForegroundColor(setColor(data));
        parseBrush(data, patblt.getBrush(), present >> 7);
        // if(logger.isInfoEnabled()) logger.info("opcode="+patblt.getOpcode());
        surface.drawPatBltOrder(patblt);
    }

    /**
     * Parse data describing a screen blit, and perform blit on drawing surface
     * @param data Packet containing blit data
     * @param screenblt ScreenBltOrder object in which to store blit description
     * @param present Flags defining the information available within the packet
     * @param delta True if the coordinates of the blit destination are described as relative to the source
     */
    private void processScreenBlt(RdpPacket_Localised data,
            ScreenBltOrder screenblt, int present, boolean delta) {
        if ((present & 0x01) != 0)
            screenblt.setX(setCoordinate(data, screenblt.getX(), delta));
        if ((present & 0x02) != 0)
            screenblt.setY(setCoordinate(data, screenblt.getY(), delta));
        if ((present & 0x04) != 0)
            screenblt.setCX(setCoordinate(data, screenblt.getCX(), delta));
        if ((present & 0x08) != 0)
            screenblt.setCY(setCoordinate(data, screenblt.getCY(), delta));
        if ((present & 0x10) != 0)
            screenblt.setOpcode(ROP2_S(data.get8()));
        if ((present & 0x20) != 0)
            screenblt.setSrcX(setCoordinate(data, screenblt.getSrcX(), delta));
        if ((present & 0x40) != 0)
            screenblt.setSrcY(setCoordinate(data, screenblt.getSrcY(), delta));
        // if(logger.isInfoEnabled())
        // logger.info("opcode="+screenblt.getOpcode());
        surface.drawScreenBltOrder(screenblt);
    }

    /**
     * Parse data describing a line order, and draw line on drawing surface
     * @param data Packet containing line order data
     * @param line LineOrder object describing the line drawing operation
     * @param present Flags defining the information available within the packet
     * @param delta True if the coordinates of the end of the line are defined as relative to the start
     */
    private void processLine(RdpPacket_Localised data, LineOrder line,
            int present, boolean delta) {
        if ((present & 0x01) != 0)
            line.setMixmode(data.getLittleEndian16());
        if ((present & 0x02) != 0)
            line.setStartX(setCoordinate(data, line.getStartX(), delta));
        if ((present & 0x04) != 0)
            line.setStartY(setCoordinate(data, line.getStartY(), delta));
        if ((present & 0x08) != 0)
            line.setEndX(setCoordinate(data, line.getEndX(), delta));
        if ((present & 0x10) != 0)
            line.setEndY(setCoordinate(data, line.getEndY(), delta));
        if ((present & 0x20) != 0)
            line.setBackgroundColor(setColor(data));
        if ((present & 0x40) != 0)
            line.setOpcode(data.get8());

        parsePen(data, line.getPen(), present >> 7);

        // if(logger.isInfoEnabled()) logger.info("Line from
        // ("+line.getStartX()+","+line.getStartY()+") to
        // ("+line.getEndX()+","+line.getEndY()+")");

        if (line.getOpcode() < 0x01 || line.getOpcode() > 0x10) {
            logger.warn("bad ROP2 0x" + line.getOpcode());
            return;
        }

        // now draw the line
        surface.drawLineOrder(line);
    }

    /**
     * Parse data describing a rectangle order, and draw the rectangle to the drawing surface
     * @param data Packet containing rectangle order
     * @param rect RectangleOrder object in which to store order description
     * @param present Flags defining information available in packet
     * @param delta True if the rectangle is described as (x,y,width,height), as opposed to (x1,y1,x2,y2)
     */
    private void processRectangle(RdpPacket_Localised data,
            RectangleOrder rect, int present, boolean delta) {
        if ((present & 0x01) != 0)
            rect.setX(setCoordinate(data, rect.getX(), delta));
        if ((present & 0x02) != 0)
            rect.setY(setCoordinate(data, rect.getY(), delta));
        if ((present & 0x04) != 0)
            rect.setCX(setCoordinate(data, rect.getCX(), delta));
        if ((present & 0x08) != 0)
            rect.setCY(setCoordinate(data, rect.getCY(), delta));
        if ((present & 0x10) != 0)
            this.rect_colour = (this.rect_colour & 0xffffff00) | data.get8(); // rect.setColor(setColor(data));
        if ((present & 0x20) != 0)
            this.rect_colour = (this.rect_colour & 0xffff00ff)
                    | (data.get8() << 8); // rect.setColor(setColor(data));
        if ((present & 0x40) != 0)
            this.rect_colour = (this.rect_colour & 0xff00ffff)
                    | (data.get8() << 16);

        rect.setColor(this.rect_colour);
        surface.drawRectangleOrder(rect);
    }

    /**
     * Parse data describing a desktop save order, either saving the desktop to cache, or drawing a section to screen
     * @param data Packet containing desktop save order
     * @param desksave DeskSaveOrder object in which to store order description
     * @param present Flags defining information available within the packet
     * @param delta True if destination coordinates are described as relative to the source
     * @throws RdesktopException
     */
    private void processDeskSave(RdpPacket_Localised data,
            DeskSaveOrder desksave, int present, boolean delta)
            throws RdesktopException {
        int width = 0, height = 0;

        if ((present & 0x01) != 0) {
            desksave.setOffset(data.getLittleEndian32());
        }

        if ((present & 0x02) != 0) {
            desksave.setLeft(setCoordinate(data, desksave.getLeft(), delta));
        }

        if ((present & 0x04) != 0) {
            desksave.setTop(setCoordinate(data, desksave.getTop(), delta));
        }

        if ((present & 0x08) != 0) {
            desksave.setRight(setCoordinate(data, desksave.getRight(), delta));
        }

        if ((present & 0x10) != 0) {
            desksave
                    .setBottom(setCoordinate(data, desksave.getBottom(), delta));
        }

        if ((present & 0x20) != 0) {
            desksave.setAction(data.get8());
        }

        width = desksave.getRight() - desksave.getLeft() + 1;
        height = desksave.getBottom() - desksave.getTop() + 1;

        if (desksave.getAction() == 0) {
            int[] pixel = surface.getImage(desksave.getLeft(), desksave
                    .getTop(), width, height);
            cache.putDesktop((int) desksave.getOffset(), width, height, pixel);
        } else {
            int[] pixel = cache.getDesktopInt((int) desksave.getOffset(),
                    width, height);
            surface.putImage(desksave.getLeft(), desksave.getTop(), width,
                    height, pixel);
        }
    }

    /**
     * Process data describing a memory blit, and perform blit on drawing surface
     * @param data Packet containing mem blit order
     * @param memblt MemBltOrder object in which to store description of blit
     * @param present Flags defining information available in packet
     * @param delta True if destination coordinates are described as relative to the source
     */
    private void processMemBlt(RdpPacket_Localised data, MemBltOrder memblt,
            int present, boolean delta) {
        if ((present & 0x01) != 0) {
            memblt.setCacheID(data.get8());
            memblt.setColorTable(data.get8());
        }
        if ((present & 0x02) != 0)
            memblt.setX(setCoordinate(data, memblt.getX(), delta));
        if ((present & 0x04) != 0)
            memblt.setY(setCoordinate(data, memblt.getY(), delta));
        if ((present & 0x08) != 0)
            memblt.setCX(setCoordinate(data, memblt.getCX(), delta));
        if ((present & 0x10) != 0)
            memblt.setCY(setCoordinate(data, memblt.getCY(), delta));
        if ((present & 0x20) != 0)
            memblt.setOpcode(ROP2_S(data.get8()));
        if ((present & 0x40) != 0)
            memblt.setSrcX(setCoordinate(data, memblt.getSrcX(), delta));
        if ((present & 0x80) != 0)
            memblt.setSrcY(setCoordinate(data, memblt.getSrcY(), delta));
        if ((present & 0x0100) != 0)
            memblt.setCacheIDX(data.getLittleEndian16());

        // if(logger.isInfoEnabled()) logger.info("Memblt
        // opcode="+memblt.getOpcode());
        surface.drawMemBltOrder(memblt);
    }

    /**
     * Parse data describing a tri blit order, and perform blit on drawing surface
     * @param data Packet containing tri blit order
     * @param triblt TriBltOrder object in which to store blit description 
     * @param present Flags defining information available in packet
     * @param delta True if destination coordinates are described as relative to the source
     */
    private void processTriBlt(RdpPacket_Localised data, TriBltOrder triblt,
            int present, boolean delta) {
        if ((present & 0x01) != 0) {
            triblt.setCacheID(data.get8());
            triblt.setColorTable(data.get8());
        }
        if ((present & 0x02) != 0)
            triblt.setX(setCoordinate(data, triblt.getX(), delta));
        if ((present & 0x04) != 0)
            triblt.setY(setCoordinate(data, triblt.getY(), delta));
        if ((present & 0x08) != 0)
            triblt.setCX(setCoordinate(data, triblt.getCX(), delta));
        if ((present & 0x10) != 0)
            triblt.setCY(setCoordinate(data, triblt.getCY(), delta));
        if ((present & 0x20) != 0)
            triblt.setOpcode(ROP2_S(data.get8()));
        if ((present & 0x40) != 0)
            triblt.setSrcX(setCoordinate(data, triblt.getSrcX(), delta));
        if ((present & 0x80) != 0)
            triblt.setSrcY(setCoordinate(data, triblt.getSrcY(), delta));
        if ((present & 0x0100) != 0)
            triblt.setBackgroundColor(setColor(data));
        if ((present & 0x0200) != 0)
            triblt.setForegroundColor(setColor(data));

        parseBrush(data, triblt.getBrush(), present >> 10);

        if ((present & 0x8000) != 0)
            triblt.setCacheIDX(data.getLittleEndian16());
        if ((present & 0x10000) != 0)
            triblt.setUnknown(data.getLittleEndian16());

        surface.drawTriBltOrder(triblt);
    }

    /**
     * Parse data describing a multi-line order, and draw to registered surface
     * @param data Packet containing polyline order
     * @param polyline PolyLineOrder object in which to store order description 
     * @param present Flags defining information available in packet
     * @param delta True if each set of coordinates is described relative to previous set
     */
    private void processPolyLine(RdpPacket_Localised data,
            PolyLineOrder polyline, int present, boolean delta) {
        if ((present & 0x01) != 0)
            polyline.setX(setCoordinate(data, polyline.getX(), delta));
        if ((present & 0x02) != 0)
            polyline.setY(setCoordinate(data, polyline.getY(), delta));
        if ((present & 0x04) != 0)
            polyline.setOpcode(data.get8());
        if ((present & 0x10) != 0)
            polyline.setForegroundColor(setColor(data));
        if ((present & 0x20) != 0)
            polyline.setLines(data.get8());
        if ((present & 0x40) != 0) {
            int datasize = data.get8();
            polyline.setDataSize(datasize);
            byte[] databytes = new byte[datasize];
            for (int i = 0; i < datasize; i++)
                databytes[i] = (byte) data.get8();
            polyline.setData(databytes);
        }
        // logger.info("polyline delta="+delta);
        // if(logger.isInfoEnabled()) logger.info("Line from
        // ("+line.getStartX()+","+line.getStartY()+") to
        // ("+line.getEndX()+","+line.getEndY()+")");
        // now draw the line
        surface.drawPolyLineOrder(polyline);
    }

    /**
     * Process a text2 order and output to drawing surface
     * @param data Packet containing text2 order
     * @param text2 Text2Order object in which to store order description
     * @param present Flags defining information available in packet
     * @param delta Unused
     * @throws RdesktopException
     */
    private void processText2(RdpPacket_Localised data, Text2Order text2,
            int present, boolean delta) throws RdesktopException {

        if ((present & 0x000001) != 0) {
            text2.setFont(data.get8());
        }
        if ((present & 0x000002) != 0) {
            text2.setFlags(data.get8());
        }

        if ((present & 0x000004) != 0) {
            text2.setOpcode(data.get8()); // setUnknown(data.get8());
        }

        if ((present & 0x000008) != 0) {
            text2.setMixmode(data.get8());
        }

        if ((present & 0x000010) != 0) {
            text2.setForegroundColor(setColor(data));
        }

        if ((present & 0x000020) != 0) {
            text2.setBackgroundColor(setColor(data));
        }

        if ((present & 0x000040) != 0) {
            text2.setClipLeft(data.getLittleEndian16());
        }

        if ((present & 0x000080) != 0) {
            text2.setClipTop(data.getLittleEndian16());
        }

        if ((present & 0x000100) != 0) {
            text2.setClipRight(data.getLittleEndian16());
        }

        if ((present & 0x000200) != 0) {
            text2.setClipBottom(data.getLittleEndian16());
        }

        if ((present & 0x000400) != 0) {
            text2.setBoxLeft(data.getLittleEndian16());
        }

        if ((present & 0x000800) != 0) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -