Package tv.porst.splib.binaryparser

Examples of tv.porst.splib.binaryparser.UBits


   * @throws SWFParserException Thrown if the structure could not be parsed.
   */
  public static LineStyle4 parse(final SWFBinaryParser parser, final String fieldName) throws SWFParserException {

    final UINT16 width = parseUINT16(parser, 0x00006, fieldName + "::Width");
    final UBits startCapStyle = parseUBits(parser, 2, 0x00006, fieldName + "::StartCapStyle");
    final UBits joinStyle = parseUBits(parser, 2, 0x00006, fieldName + "::JoinStyle");
    final Flag hasFillFlag = parseFlag(parser, 0x00006, fieldName + "::HasFillFlag");
    final Flag noHScaleFlag = parseFlag(parser, 0x00006, fieldName + "::NoHScaleFlag");
    final Flag noVScaleFlag = parseFlag(parser, 0x00006, fieldName + "::NoVScaleFlag");
    final Flag pixelHintingFlag = parseFlag(parser, 0x00006, fieldName + "::PixelHintingFlag");
    final UBits reserved = parseUBits(parser, 5, 0x00006, fieldName + "::Reserved");
    final Flag noClose = parseFlag(parser, 0x00006, fieldName + "::NoClose");
    final UBits endCapStyle = parseUBits(parser, 2, 0x00006, fieldName + "::EndCapStyle");
    final UINT16 miterLimitFactor = parseUINT16If(parser, 0x00006, joinStyle.value() == 2, fieldName + "::MiterLimitFactor");
    final RGBA color = RGBAParser.parseIf(parser, !hasFillFlag.value(), fieldName + "::Color");
    final FillStyle3 fillType = FillStyle3Parser.parseIf(parser, hasFillFlag, fieldName + "::FillType");

    return new LineStyle4(width, startCapStyle, joinStyle, hasFillFlag,
View Full Code Here


    final Flag condOverDownToOutDown = parseFlag(parser, 0x00006, fieldName + "::CondOverDownToOutDown");
    final Flag condOverDownToOverUp = parseFlag(parser, 0x00006, fieldName + "::CondOverDownToOverUp");
    final Flag condOverUpToOverDown = parseFlag(parser, 0x00006, fieldName + "::CondOverUpToOverDown");
    final Flag condOverUpToIdle = parseFlag(parser, 0x00006, fieldName + "::CondOverUpToIdle");
    final Flag condIdleToOverUp = parseFlag(parser, 0x00006, fieldName + "::CondIdleToOverUp");
    final UBits condKeyPress = parseUBits(parser, 7, 0x00006, fieldName + "::CondKeyPress");
    final Flag condOverDownToIdle = parseFlag(parser, 0x00006, fieldName + "::CondOverDownToIdle");

    final int actionRecordSize = condActionSize.value() == 0 ? header.getNormalizedLength() - (parser.getBytePosition() - header.getBitPosition() / 8 + 1 - header.getHeaderLength()) : condActionSize.value() - 4 - 1;

    final List<Action> actions = ActionRecordParser.parse(parser, actionRecordSize, fieldName + "::Actions");
View Full Code Here

    final Flag clipEventRelease = parseFlag(parser, 0x00006, fieldName + "::ClipEventRelease");
    final Flag clipEventPress = parseFlag(parser, 0x00006, fieldName + "::ClipEventPress");
    final Flag clipEventInitialize = parseFlag(parser, 0x00006, fieldName + "::ClipEventInitialize");
    final Flag clipEventData = parseFlag(parser, 0x00006, fieldName + "::ClipEventData");

    final UBits reserved = parseUBitsIf(parser, 5, 0x00006, version >= 6, fieldName + "::Reserved");
    final Flag clipEventConstruct = parseFlagIf(parser, 0x00006, version >= 6, fieldName + "::ClipEventConstruct");
    final Flag clipEventKeyPress = parseFlagIf(parser, 0x00006, version >= 6, fieldName + "::ClipEventKeyPress");
    final Flag clipEventDragOut = parseFlagIf(parser, 0x00006, version >= 6, fieldName + "::ClipEventDragOut");
    final UBits reserved2 = parseUBitsIf(parser, 8, 0x00006, version >= 6, fieldName + "::Reserved2");

    parser.align();

    return new ClipEventFlags(clipEventKeyUp, clipEventKeyDown,
        clipEventMouseUp, clipEventMouseDown, clipEventMouseMove,
View Full Code Here

   */
  public static StraightEdgeRecord parse(final SWFBinaryParser parser, final String fieldName) throws SWFParserException {

    final Flag typeFlag = parseFlag(parser, 0x00006, fieldName + "::TypeFlag");
    final Flag straightFlag = parseFlag(parser, 0x00006, fieldName + "::StraightFlag");
    final UBits numBits = parseUBits(parser, 4, 0x00006, fieldName + "::NumBits");
    final Flag generalLineFlag = parseFlag(parser, 0x00006, fieldName + "::GeneralLineFlag");
    final Flag vertLineFlag =  parseFlagIf(parser, 0x00006, !generalLineFlag.value(), fieldName + "::VertLineFlag");
    final Bits deltaX = parseSBitsIf(parser, numBits.value() + 2, 0x00006, generalLineFlag.value() || !vertLineFlag.value(), fieldName + "::DeltaX");
    final Bits deltaY = parseSBitsIf(parser, numBits.value() + 2, 0x00006, generalLineFlag.value() || vertLineFlag.value(), fieldName + "::DeltaY");

    return new StraightEdgeRecord(typeFlag, straightFlag, numBits, generalLineFlag, vertLineFlag, deltaX, deltaY);
  }
View Full Code Here

   *
   * @throws SWFParserException Thrown if the structure could not be parsed.
   */
  public static ButtonRecord parse(final SWFBinaryParser parser, final String fieldName) throws SWFParserException {

    final UBits buttonReserved = parseUBits(parser, 2, 0x00006, fieldName + "::ButtonReserved");
    final Flag buttonHasBlendMode = parseFlag(parser, 0x00006, fieldName + "::ButtonHasBlendMode");
    final Flag buttonHasFilterList = parseFlag(parser, 0x00006, fieldName + "::ButtonHasFilterList");
    final Flag buttonStateHitTest = parseFlag(parser, 0x00006, fieldName + "::ButtonStateHitTest");
    final Flag buttonStateDown = parseFlag(parser, 0x00006, fieldName + "::ButtonStateDown");
    final Flag buttonStateOver = parseFlag(parser, 0x00006, fieldName + "::ButtonStateOver");
View Full Code Here

    final Fixed8 strength = Fixed8Parser.parse(parser, fieldName + "::Strength");
    final Flag innerShadow = parseFlag(parser, 0x00006, fieldName + "::InnerShadow");
    final Flag knockout = parseFlag(parser, 0x00006, fieldName + "::Knockout");
    final Flag compositeSource = parseFlag(parser, 0x00006, fieldName + "::CompositeSource");
    final Flag onTop = parseFlag(parser, 0x00006, fieldName + "::OnTop");
    final UBits passes = parseUBits(parser, 4, 0x00006, fieldName + "::Passes");

    return new BevelFilter(shadowColor, highlightColor, blurX, blurY, angle, distance, strength, innerShadow, knockout, compositeSource, onTop, passes);
  }
View Full Code Here

    final Flag stateNewStyles = parseFlag(parser, 0x00006, fieldName + "::StateNewStyles");
    final Flag stateLineStyle = parseFlag(parser, 0x00006, fieldName + "::StateLineStyle");
    final Flag stateFillStyle1 = parseFlag(parser, 0x00006, fieldName + "::StateFillStyle1");
    final Flag stateFillStyle0 = parseFlag(parser, 0x00006, fieldName + "::StateFillStyle0");
    final Flag stateMoveTo = parseFlag(parser, 0x00006, fieldName + "::StateMoveTo");
    final UBits moveBits = parseUBitsIf(parser, 5, 0x00006, stateMoveTo, fieldName + "::MoveBits");
    final UBits moveDeltaX = parseUBitsIf(parser, moveBits == null ? 0 : moveBits.value(), 0x00006, stateMoveTo, fieldName + "::MoveDeltaX");
    final UBits moveDeltaY = parseUBitsIf(parser, moveBits == null ? 0 : moveBits.value(), 0x00006, stateMoveTo, fieldName + "::MoveDeltaY");
    final UBits fillStyle0 = parseUBitsIf(parser, fillBits == null ? 0 : fillBits.value(), 0x00006, stateFillStyle0, fieldName + "::FillStyle0");
    final UBits fillStyle1 = parseUBitsIf(parser, fillBits == null ? 0 : fillBits.value(), 0x00006, stateFillStyle1, fieldName + "::FillStyle1");
    final UBits lineStyle = parseUBitsIf(parser, lineBits == null ? 0 : lineBits.value(), 0x00006, stateLineStyle, fieldName + "::LineStyle");

    if (stateNewStyles.value()) {
      parser.align();
    }

    final FillStyle3Array fillStyles = FillStyle3ArrayParser.parseIf(parser, stateNewStyles, fieldName + "::FillStyles");
    final LineStyle3Array lineStyles = LineStyle3ArrayParser.parseIf(parser, stateNewStyles, fieldName + "::LineStyles");
    final UBits numFillBits = parseUBitsIf(parser, 4, 0x00006, stateNewStyles, fieldName + "::NumFillBits");
    final UBits numLineBits = parseUBitsIf(parser, 4, 0x00006, stateNewStyles, fieldName + "::NumLineBits");

    return new StyleChangeRecord3(typeFlag, stateNewStyles, stateLineStyle, stateFillStyle1,
        stateFillStyle0, stateMoveTo, moveBits, moveDeltaX, moveDeltaY, fillStyle0, fillStyle1,
        lineStyle, fillStyles, lineStyles, numFillBits, numLineBits);
  }
View Full Code Here

   *
   * @throws SWFParserException Thrown if the structure could not be parsed.
   */
  public static Shape4Record parse(final SWFBinaryParser parser, final UBits numFillBits, final UBits numLineBits, final String fieldName) throws SWFParserException {

    final UBits first6 = parser.peekBits(6);

    if (first6.value() == 0) {
      return EndShapeRecordParser.parse(parser, fieldName);
    }
    else if ((first6.value() & 0x30) == 0x30) {
      return StraightEdgeRecordParser.parse(parser, fieldName);
    }
    else if ((first6.value() & 0x20) == 0x20) {
      return CurvedEdgeRecordParser.parse(parser, fieldName);
    }
    else {
      return StyleChangeRecord4Parser.parse(parser, numFillBits, numLineBits, fieldName);
    }
View Full Code Here

   *
   * @throws SWFParserException Thrown if the structure could not be parsed.
   */
  public static SoundInfo parse(final SWFBinaryParser parser, final String fieldName) throws SWFParserException {

    final UBits reserved = parseUBits(parser, 2, 0x00006, fieldName + "::Reserved");
    final Flag syncStop = parseFlag(parser, 0x00006, fieldName + "::SyncStopY");
    final Flag syncNoMultiple = parseFlag(parser, 0x00006, fieldName + "::SyncNoMultiple");
    final Flag hasEnvelope = parseFlag(parser, 0x00006, fieldName + "::HasMultiple");
    final Flag hasLoops = parseFlag(parser, 0x00006, fieldName + "::HasLoops");
    final Flag hasOutPoint= parseFlag(parser, 0x00006, fieldName + "::HasOutPoint");
View Full Code Here

   *
   * @throws SWFParserException Thrown if the structure could not be parsed.
   */
  public static Gradient parse(final SWFBinaryParser parser, final String fieldName) throws SWFParserException {

    final UBits spreadMode = parseUBits(parser, 2, 0x00006, fieldName + "::SpreadMode");
    final UBits interpolationMode = parseUBits(parser, 2, 0x00006, fieldName + "::InterpolationMode");
    final UBits numGradients = parseUBits(parser, 4, 0x00006, fieldName + "::NumGradients");

    final List<GradRecord> gradientRecords = new ArrayList<GradRecord>();

    for (int i=0;i<numGradients.value();i++) {
      gradientRecords.add(GradRecordParser.parse(parser, String.format(fieldName + "::GradientRecord[%d]", i)));
    }

    return new Gradient(spreadMode, interpolationMode, numGradients, new GradRecordList(gradientRecords));
  }
View Full Code Here

TOP

Related Classes of tv.porst.splib.binaryparser.UBits

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.