001: /*
002: * ImageLine.java
003: *
004: * Copyright (C) 2000-2002 Peter Graves
005: * $Id: ImageLine.java,v 1.2 2002/11/27 23:57:31 piso Exp $
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License
009: * as published by the Free Software Foundation; either version 2
010: * of the License, or (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
015: * GNU General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
020: */
021:
022: package org.armedbear.j;
023:
024: import java.awt.Image;
025: import java.awt.Rectangle;
026:
027: public final class ImageLine extends AbstractLine implements Line {
028: private Image image;
029: private final int imageHeight;
030: private final int imageWidth;
031: private final int height;
032: private final Rectangle rect;
033:
034: public ImageLine(Image image, Rectangle r) {
035: this .image = image;
036: rect = new Rectangle(r);
037: height = Math.max(r.height, Display.getCharHeight());
038: ;
039: imageHeight = r.height;
040: imageWidth = r.width;
041: }
042:
043: public final Image getImage() {
044: return image;
045: }
046:
047: public final Rectangle getRect() {
048: return rect;
049: }
050:
051: public final int getImageHeight() {
052: return imageHeight;
053:
054: }
055:
056: public final int getImageWidth() {
057: return imageWidth;
058: }
059:
060: public final int getHeight() {
061: return height;
062: }
063:
064: public final int getWidth() {
065: return getImageWidth();
066: }
067:
068: public final int flags() {
069: return 0;
070: }
071:
072: public final void setFlags(int flags) {
073: }
074:
075: public String getText() {
076: return null;
077: }
078:
079: public final void setText(String s) {
080: }
081:
082: public final char charAt(int i) {
083: return '\0';
084: }
085:
086: public final String substring(int beginIndex) {
087: return null;
088: }
089:
090: public final String substring(int beginIndex, int endIndex) {
091: return null;
092: }
093:
094: public final String trim() {
095: return null;
096: }
097:
098: public final int length() {
099: return 0;
100: }
101:
102: public final byte[] getBytes(String encoding) {
103: return null;
104: }
105:
106: public final boolean isBlank() {
107: return false;
108: }
109:
110: public final void flushImage() {
111: if (image != null) {
112: image.flush();
113: image = null;
114: }
115: }
116:
117: protected void finalize() throws Throwable {
118: flushImage();
119: super.finalize();
120: }
121: }
|