Beispiel #1
0
        internal PlainImage ReadPlainImage()
        {
            awt.Image img = ReadImage(_currentFrame);
            if (img == null)
            {
                return(null);
            }

            // its possible to fail to load thumbnails and metadata, but image is ok.
            awt.Image [] th = null;
#if THUMBNAIL_SUPPORTED
            try {
                th = ReadThumbnails(_currentFrame);
            }
            catch (Exception) {}
#endif

            XmlDocument md = null;
            imageio.metadata.IIOMetadata nativeMd = null;
            try {
                nativeMd = ReadImageMetadata(_currentFrame);
                md       = ConvertImageMetadata(nativeMd);
            }
            catch (Exception) {}

            float [] resolution = GetResolution(md);

            PlainImage pi = new PlainImage(img, th, ImageFormat, resolution[0], resolution[1], FormatFrameDimesion);
            pi.NativeMetadata = nativeMd;
            return(pi);
        }
Beispiel #2
0
        public PlainImage Clone(bool cloneImage)
        {
            awt.Image    img = NativeImage;
            awt.Image [] th  = _thumbnails;

            if (cloneImage)
            {
                img = new BufferedImage(
                    ((BufferedImage)NativeObject).getColorModel(),
                    ((BufferedImage)NativeObject).copyData(null),
                    ((BufferedImage)NativeObject).isAlphaPremultiplied(), null);

                if (Thumbnails != null)
                {
                    th = new java.awt.Image[Thumbnails.Length];
                    for (int i = 0; i < Thumbnails.Length; i++)
                    {
                        th[i] = new BufferedImage(
                            ((BufferedImage)Thumbnails[i]).getColorModel(),
                            ((BufferedImage)Thumbnails[i]).copyData(null),
                            ((BufferedImage)Thumbnails[i]).isAlphaPremultiplied(), null);
                    }
                }
            }

            return(new PlainImage(
                       img,
                       th,
                       ImageFormat,
                       HorizontalResolution,
                       VerticalResolution,
                       Dimension));
        }
 public ProjectInfo(string name, string version, string info, Image logo, string copyright, string licenceName, string licenceText)
   : base(name, version, info, copyright, licenceName)
 {
   ProjectInfo projectInfo = this;
   this.logo = logo;
   this.licenceText = licenceText;
 }
Beispiel #4
0
        private awt.Image [] ReadThumbnails(int frameIndex)
        {
            awt.Image [] thArray = null;

            try {
                if (NativeReader.readerSupportsThumbnails())
                {
                    int tmbNumber = NativeReader.getNumThumbnails(frameIndex);

                    if (tmbNumber > 0)
                    {
                        thArray = new awt.Image[tmbNumber];

                        for (int i = 0; i < tmbNumber; i++)
                        {
                            thArray[i] = NativeReader.readThumbnail(frameIndex, i);
                        }
                    }
                }
                return(thArray);
            }
            catch (java.io.IOException ex) {
                throw new System.IO.IOException(ex.Message, ex);
            }
        }
        internal static Image ImageFromNativeImage(awt.Image nativeImage, ImageFormat format)
        {
            if (nativeImage is BufferedImage)
            {
                return(new Bitmap(nativeImage, format));
            }

            throw new ArgumentException("Invalid image type");
        }
Beispiel #6
0
		public PlainImage(awt.Image image, awt.Image [] thumbnails, ImageFormat format, float xRes, float yRes, FrameDimension dimension) {
			_nativeObject = image;
			_thumbnails = thumbnails;
			_imageFormat = format;

			_xResolution = xRes;
			_yResolution = yRes;

			_dimension = dimension;
		}
        public static BufferedImage convertToBufferedImage(java.awt.Image image)
        {
            BufferedImage newImage = new BufferedImage(
                image.getWidth(null), image.getHeight(null),
                BufferedImage.TYPE_INT_ARGB);
            Graphics2D g = newImage.createGraphics();

            g.drawImage(image, 0, 0, null);
            g.dispose();
            return(newImage);
        }
Beispiel #8
0
        public PlainImage(awt.Image image, awt.Image [] thumbnails, ImageFormat format, float xRes, float yRes, FrameDimension dimension)
        {
            _nativeObject = image;
            _thumbnails   = thumbnails;
            _imageFormat  = format;

            _xResolution = xRes;
            _yResolution = yRes;

            _dimension = dimension;
        }
Beispiel #9
0
		/// <summary>
		/// Sets the image to be displayed in the minimized icon for this frame.
		/// </summary>
		public void setIconImage(Image @image)
		{
		}
 /// <summary>
 /// Repaints the component when the image has changed.
 /// </summary>
 public bool imageUpdate(Image @img, int @infoflags, int @x, int @y, int @w, int @h)
 {
     return default(bool);
 }
 /// <summary>
 /// Returns the status of the construction of a screen representation
 /// of the specified image.
 /// </summary>
 public int checkImage(Image @image, int @width, int @height, ImageObserver @observer)
 {
     return default(int);
 }
 /// <summary>
 /// Returns the status of the construction of a screen representation
 /// of the specified image.
 /// </summary>
 public int checkImage(Image @image, ImageObserver @observer)
 {
     return default(int);
 }
 /// <summary>
 /// Prepares an image for rendering on this component at the
 /// specified width and height.
 /// </summary>
 public bool prepareImage(Image @image, int @width, int @height, ImageObserver @observer)
 {
     return default(bool);
 }
 /// <summary>
 /// Prepares an image for rendering on this component.
 /// </summary>
 public bool prepareImage(Image @image, ImageObserver @observer)
 {
     return default(bool);
 }
		/// <summary>
		/// Renders an image, applying a transform from image space into user space
		/// before drawing.
		/// </summary>
		abstract public bool drawImage(Image @img, AffineTransform @xform, ImageObserver @obs);
		private awt.Image [] ReadThumbnails(int frameIndex) {
			awt.Image [] thArray = null;

			try {
				if (NativeReader.readerSupportsThumbnails()) {
					int tmbNumber = NativeReader.getNumThumbnails(frameIndex);

					if (tmbNumber > 0) {
						thArray = new awt.Image[ tmbNumber ];

						for (int i = 0; i < tmbNumber; i++) {
							thArray[i] = NativeReader.readThumbnail(frameIndex, i);
						}
					}
				}
				return thArray;
			}
			catch (java.io.IOException ex) {
				throw new System.IO.IOException(ex.Message, ex);
			}
		}
 public override void paint(Graphics g) {
     var insets = getInsets();
     var bounds = getBounds();
     var width = (int)(bounds.getWidth() - insets.left - insets.right);
     var height = (int)(bounds.getHeight() - insets.top - insets.bottom - status.getBounds().getHeight());
     var cellWidth = width / WIDTH;
     var cellHeight = height / HEIGHT;
     var hmargin = (cellWidth % WIDTH) / 2 + insets.left;
     var vmargin = (cellHeight % HEIGHT) / 2 + insets.top;
     if (buffer == null) {
         buffer = createImage((int)bounds.getWidth(), (int)bounds.getHeight());
     }
     var bg = buffer.getGraphics();
     bg.clearRect(0, 0, (int)bounds.getWidth(), (int)bounds.getHeight());
     for (int i = 0; i < WIDTH; i++) {
         for (int j = 0; j < HEIGHT; j++) {
             if ((i % 2 == 0) == (j % 2 == 0)) {
                 bg.setColor(LIGHT_GRAY2);
             } else {
                 bg.setColor(Color.LIGHT_GRAY);
             }
             bg.fillRect(i * cellWidth + hmargin, j * cellHeight + vmargin, cellWidth, cellHeight);
         }                
     }
     for (int i = 0; i < WIDTH; i++) {
         for (int j = 0; j < HEIGHT; j++) {
             var dalek = board[i][j];
             if (dalek != null) {
                 bg.drawImage((dalek.Broken) ? this.Wreckage : this.Dalek, i * cellWidth + hmargin, j * cellHeight + vmargin, null);
             }
         }
     }
     if (whoX >= 0) {
         bg.drawImage(this.DoctorWho, whoX * cellWidth + hmargin, whoY * cellHeight + vmargin, null);
     }
     if (state == State.GameOver) {
         bg.setFont(FONT);
         bg.setColor(Color.DARK_GRAY);
         bg.drawString("Game Over", 205, 305);
         bg.setColor(Color.BLACK);
         bg.drawString("Game Over", 200, 300);
     }
     g.drawImage(buffer, 0, 0, this);
 }
Beispiel #18
0
 public virtual void setLogo(Image logo)
 {
   this.logo = logo;
 }
		/// <summary>
		/// Draws as much of the specified image as is currently available.
		/// </summary>
		abstract public bool drawImage(Image @img, int @x, int @y, ImageObserver @observer);
		/// <summary>
		/// Draws as much of the specified area of the specified image as is
		/// currently available, scaling it on the fly to fit inside the
		/// specified area of the destination drawable surface.
		/// </summary>
		abstract public bool drawImage(Image @img, int @dx1, int @dy1, int @dx2, int @dy2, int @sx1, int @sy1, int @sx2, int @sy2, ImageObserver @observer);
		/// <summary>
		/// Draws as much of the specified image as has already been scaled
		/// to fit inside the specified rectangle.
		/// </summary>
		abstract public bool drawImage(Image @img, int @x, int @y, int @width, int @height, ImageObserver @observer);