예제 #1
0
  public boolean matches(Format format) {

    if (!super.matches(format)) {
      FormatUtils.traceMatches(this, format, false);
      return false;
    }

    if (!(format instanceof RGBFormat)) {
      final boolean result = true;
      FormatUtils.traceMatches(this, format, result);
      return result;
    }

    final RGBFormat oCast = (RGBFormat) format;

    // do not check lineStride:
    final boolean result =
        FormatUtils.matches(this.bitsPerPixel, oCast.bitsPerPixel)
            && FormatUtils.matches(this.redMask, oCast.redMask)
            && FormatUtils.matches(this.greenMask, oCast.greenMask)
            && FormatUtils.matches(this.blueMask, oCast.blueMask)
            && FormatUtils.matches(this.pixelStride, oCast.pixelStride)
            && FormatUtils.matches(this.flipped, oCast.flipped)
            && FormatUtils.matches(this.endian, oCast.endian);

    FormatUtils.traceMatches(this, format, result);

    return result;
  }
예제 #2
0
  public boolean equals(Object format) {

    if (!super.equals(format)) {
      FormatUtils.traceEquals(this, (Format) format, false);
      return false;
    }

    if (!(format instanceof RGBFormat)) {
      FormatUtils.traceEquals(this, (Format) format, false);
      return false;
    }

    final RGBFormat oCast = (RGBFormat) format;
    final boolean result =
        this.bitsPerPixel == oCast.bitsPerPixel
            && this.redMask == oCast.redMask
            && this.greenMask == oCast.greenMask
            && this.blueMask == oCast.blueMask
            && this.pixelStride == oCast.pixelStride
            && this.lineStride == oCast.lineStride
            && this.flipped == oCast.flipped
            && this.endian == oCast.endian;

    FormatUtils.traceEquals(this, (Format) format, result);
    return result;
  }
예제 #3
0
 @Override
 public String toString() {
   final StringBuffer b = new StringBuffer();
   b.append("GIF video format:");
   if (FormatUtils.specified(size)) b.append(" size = " + size.width + "x" + size.height);
   if (FormatUtils.specified(frameRate)) b.append(" FrameRate = " + frameRate);
   if (FormatUtils.specified(maxDataLength)) b.append(" maxDataLength = " + maxDataLength);
   if (FormatUtils.specified(dataType)) b.append(" dataType = " + dataType);
   return b.toString();
 }
예제 #4
0
  public String toString() {
    StringBuffer b = new StringBuffer();

    b.append("RGB");

    if (size != null) b.append(", " + (int) size.getWidth() + "x" + (int) size.getHeight());
    if (frameRate != -1.f) b.append(", FrameRate=" + FormatUtils.frameRateToString(frameRate));

    if (maxDataLength != -1) b.append(", Length=" + maxDataLength);

    b.append(
        ", "
            + bitsPerPixel
            + "-bit"
            + ", Masks="
            + redMask
            + ":"
            + greenMask
            + ":"
            + blueMask
            + ", PixelStride="
            + pixelStride
            + ", LineStride="
            + lineStride);

    if (flipped == 1) b.append(", Flipped");

    return b.toString();
  }
예제 #5
0
  public Format relax() {
    final RGBFormat result = (RGBFormat) super.relax();
    result.lineStride = NOT_SPECIFIED;
    result.pixelStride = NOT_SPECIFIED;
    FormatUtils.traceRelax(this, result);

    return result;
  }
예제 #6
0
  public Object clone() {

    final RGBFormat result =
        new RGBFormat(
            FormatUtils.clone(size),
            maxDataLength,
            dataType,
            frameRate,
            bitsPerPixel,
            redMask,
            greenMask,
            blueMask,
            pixelStride,
            lineStride,
            flipped,
            endian);

    FormatUtils.traceClone(this, result);

    return result;
  }
예제 #7
0
  public Format intersects(Format other) {

    final Format result = super.intersects(other);
    if (other instanceof RGBFormat) {
      final RGBFormat resultCast = (RGBFormat) result;

      final RGBFormat oCast = (RGBFormat) other;
      if (getClass().isAssignableFrom(other.getClass())) {
        // "other" was cloned.

        if (FormatUtils.specified(this.bitsPerPixel)) resultCast.bitsPerPixel = this.bitsPerPixel;
        if (FormatUtils.specified(this.redMask)) resultCast.redMask = this.redMask;
        if (FormatUtils.specified(this.greenMask)) resultCast.greenMask = this.greenMask;
        if (FormatUtils.specified(this.blueMask)) resultCast.blueMask = this.blueMask;
        if (FormatUtils.specified(this.pixelStride)) resultCast.pixelStride = this.pixelStride;
        if (FormatUtils.specified(this.lineStride)) resultCast.lineStride = this.lineStride;
        if (FormatUtils.specified(this.flipped)) resultCast.flipped = this.flipped;
        if (FormatUtils.specified(this.endian)) resultCast.endian = this.endian;
      } else { // this was cloned

        if (!FormatUtils.specified(resultCast.bitsPerPixel))
          resultCast.bitsPerPixel = oCast.bitsPerPixel;
        if (!FormatUtils.specified(resultCast.redMask)) resultCast.redMask = oCast.redMask;
        if (!FormatUtils.specified(resultCast.greenMask)) resultCast.greenMask = oCast.greenMask;
        if (!FormatUtils.specified(resultCast.blueMask)) resultCast.blueMask = oCast.blueMask;
        if (!FormatUtils.specified(resultCast.pixelStride))
          resultCast.pixelStride = oCast.pixelStride;
        if (!FormatUtils.specified(resultCast.lineStride)) resultCast.lineStride = oCast.lineStride;
        if (!FormatUtils.specified(resultCast.flipped)) resultCast.flipped = oCast.flipped;
        if (!FormatUtils.specified(resultCast.endian)) resultCast.endian = oCast.endian;
      }
    }

    FormatUtils.traceIntersects(this, other, result);

    return result;
  }
예제 #8
0
 @Override
 public Object clone() {
   return new GIFFormat(FormatUtils.clone(size), maxDataLength, dataType, frameRate);
 }