All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.moaxcp.x11client.protocol.xvmc.CreateSubpictureReply Maven / Gradle / Ivy

There is a newer version: 0.18.2
Show newest version
package com.github.moaxcp.x11client.protocol.xvmc;

import com.github.moaxcp.x11client.protocol.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import com.github.moaxcp.x11client.protocol.XReply;
import java.io.IOException;
import java.lang.Byte;
import java.lang.Integer;
import java.lang.Override;
import java.util.List;
import lombok.Builder;
import lombok.NonNull;
import lombok.Value;

@Value
@Builder
public class CreateSubpictureReply implements XReply {
  private short sequenceNumber;

  private short widthActual;

  private short heightActual;

  private short numPaletteEntries;

  private short entryBytes;

  @NonNull
  private List componentOrder;

  @NonNull
  private List privData;

  public static CreateSubpictureReply readCreateSubpictureReply(byte pad, short sequenceNumber,
      X11Input in) throws IOException {
    int length = in.readCard32();
    short widthActual = in.readCard16();
    short heightActual = in.readCard16();
    short numPaletteEntries = in.readCard16();
    short entryBytes = in.readCard16();
    List componentOrder = in.readCard8(4);
    in.readPad(12);
    List privData = in.readCard32((int) (Integer.toUnsignedLong(length)));
    CreateSubpictureReply.CreateSubpictureReplyBuilder javaBuilder = CreateSubpictureReply.builder();
    javaBuilder.sequenceNumber(sequenceNumber);
    javaBuilder.widthActual(widthActual);
    javaBuilder.heightActual(heightActual);
    javaBuilder.numPaletteEntries(numPaletteEntries);
    javaBuilder.entryBytes(entryBytes);
    javaBuilder.componentOrder(componentOrder);
    javaBuilder.privData(privData);
    if(javaBuilder.getSize() < 32) {
      in.readPad(32 - javaBuilder.getSize());
    }
    return javaBuilder.build();
  }

  @Override
  public void write(X11Output out) throws IOException {
    out.writeCard8(getResponseCode());
    out.writePad(1);
    out.writeCard16(sequenceNumber);
    int length = privData.size();
    out.writeCard32(getLength());
    out.writeCard16(widthActual);
    out.writeCard16(heightActual);
    out.writeCard16(numPaletteEntries);
    out.writeCard16(entryBytes);
    out.writeCard8(componentOrder);
    out.writePad(12);
    out.writeCard32(privData);
    out.writePadAlign(getSize());
  }

  @Override
  public int getSize() {
    return 28 + 1 * componentOrder.size() + 4 * privData.size();
  }

  public static class CreateSubpictureReplyBuilder {
    public int getSize() {
      return 28 + 1 * componentOrder.size() + 4 * privData.size();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy