com.github.moaxcp.x11client.protocol.dri2.DRI2Buffer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x11-client Show documentation
Show all versions of x11-client Show documentation
An x11 client implemented in java
package com.github.moaxcp.x11client.protocol.dri2;
import com.github.moaxcp.x11client.protocol.X11Input;
import com.github.moaxcp.x11client.protocol.X11Output;
import com.github.moaxcp.x11client.protocol.XStruct;
import java.io.IOException;
import java.lang.Override;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
public class DRI2Buffer implements XStruct {
private int attachment;
private int name;
private int pitch;
private int cpp;
private int flags;
public static DRI2Buffer readDRI2Buffer(X11Input in) throws IOException {
int attachment = in.readCard32();
int name = in.readCard32();
int pitch = in.readCard32();
int cpp = in.readCard32();
int flags = in.readCard32();
DRI2Buffer.DRI2BufferBuilder javaBuilder = DRI2Buffer.builder();
javaBuilder.attachment(attachment);
javaBuilder.name(name);
javaBuilder.pitch(pitch);
javaBuilder.cpp(cpp);
javaBuilder.flags(flags);
return javaBuilder.build();
}
@Override
public void write(X11Output out) throws IOException {
out.writeCard32(attachment);
out.writeCard32(name);
out.writeCard32(pitch);
out.writeCard32(cpp);
out.writeCard32(flags);
}
@Override
public int getSize() {
return 20;
}
public static class DRI2BufferBuilder {
public DRI2Buffer.DRI2BufferBuilder attachment(Attachment attachment) {
this.attachment = (int) attachment.getValue();
return this;
}
public DRI2Buffer.DRI2BufferBuilder attachment(int attachment) {
this.attachment = attachment;
return this;
}
public int getSize() {
return 20;
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy