public abstract class LwjglOffsetStateUtil {
public static void apply(final LwjglRenderer renderer, final OffsetState state) {
// ask for the current state record
final RenderContext context = ContextManager.getCurrentContext();
final OffsetStateRecord record = (OffsetStateRecord) context.getStateRecord(StateType.Offset);
context.setCurrentState(StateType.Offset, state);
if (state.isEnabled()) {
// enable any set offset types
setOffsetEnabled(OffsetType.Fill, state.isTypeEnabled(OffsetType.Fill), record);
setOffsetEnabled(OffsetType.Line, state.isTypeEnabled(OffsetType.Line), record);
setOffsetEnabled(OffsetType.Point, state.isTypeEnabled(OffsetType.Point), record);
// set factor and units.
setOffset(state.getFactor(), state.getUnits(), record);
} else {
// disable all offset types
setOffsetEnabled(OffsetType.Fill, false, record);
setOffsetEnabled(OffsetType.Line, false, record);
setOffsetEnabled(OffsetType.Point, false, record);
// set factor and units to default 0, 0.
setOffset(0, 0, record);
}
if (!record.isValid()) {
record.validate();
}
}