displaymode.java

来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 119 行

JAVA
119
字号
/*
 * $Id: DisplayMode.java,v 1.1 2003/11/25 11:51:40 epr Exp $
 */
package org.jnode.driver.video.vgahw;

import java.util.StringTokenizer;

/**
 * @author Ewout Prangsma (epr@users.sourceforge.net)
 */
public class DisplayMode {
	
	/** Clock frequency in kHz */
	private final int freq;
	
	/** Visible display width in pixels */
	private final int width;
	/** h-sync pulse start */
	private final int hsyncStart;
	/** h-sync pulse end */
	private final int hsyncEnd;
	/** Total pixels per line */
	private final int hTotal;
	
	/** Visible display height in lines */
	private final int height;
	/** v-sync pulse start */
	private final int vsyncStart;
	/** v-sync pulse end */
	private final int vsyncEnd;
	/** Total lines per frame */
	private final int vTotal;
	
	/**
	 * Create a new instance
	 * @param arg In the form of: freq width hsync-s hsync-e htotal height v-syncs v-synce vtotal
	 */
	public DisplayMode(String arg) {
		final StringTokenizer tok = new StringTokenizer(arg);
		freq = Integer.parseInt(tok.nextToken());
		width = Integer.parseInt(tok.nextToken());
		hsyncStart = Integer.parseInt(tok.nextToken());
		hsyncEnd = Integer.parseInt(tok.nextToken());
		hTotal = Integer.parseInt(tok.nextToken());
		height = Integer.parseInt(tok.nextToken());
		vsyncStart = Integer.parseInt(tok.nextToken());
		vsyncEnd = Integer.parseInt(tok.nextToken());
		vTotal= Integer.parseInt(tok.nextToken());
	}

	/**
	 * Gets the pixel frequency in kHz
	 */
	public final int getFreq() {
		return this.freq;
	}

	/**
	 * Gets the visible display height in lines
	 */
	public final int getHeight() {
		return this.height;
	}

	/**
	 * Gets the end of the h-sync pulse
	 */
	public final int getHsyncEnd() {
		return this.hsyncEnd;
	}

	/**
	 * Gets the start of the h-sync pulse
	 */
	public final int getHsyncStart() {
		return this.hsyncStart;
	}

	/**
	 * Gets the total pixels per line
	 */
	public final int getHTotal() {
		return this.hTotal;
	}

	/**
	 * Gets the end of the v-sync pulse
	 */
	public final int getVsyncEnd() {
		return this.vsyncEnd;
	}

	/**
	 * Gets the start of the v-sync pulse
	 */
	public final int getVsyncStart() {
		return this.vsyncStart;
	}

	/**
	 * Gets the total lines per frame
	 */
	public final int getVTotal() {
		return this.vTotal;
	}

	/**
	 * Gets the visible display width in pixels per line
	 */
	public final int getWidth() {
		return this.width;
	}
	
	public String toString() {
		return "" + freq + " " + width + " " + hsyncStart + " " + hsyncEnd + " " + hTotal + " "+
			height + " " + vsyncStart + " " + vsyncEnd + " " + vTotal;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?