Re: Class with BufferedImage as superclass

From: ak (k.andrei_at_gmx.de.spam)
Date: 11/15/03


Date: Sat, 15 Nov 2003 11:36:57 +0100

a. Could you write constructor of your SurfaceGrid that takes BufferedImage
as argument? It were possible if your SurfaceGrid implements RenderedImage
and uses BufferedImage as delegate.
or
b. After your read tempImg, create SurfaceGrid and draw tempImg into
Graphics of SurfaceGrid.

"Peter the Swede" <pela9765@student.uu.se> schrieb im Newsbeitrag
news:3fb54ce5$1@puffinus.its.uu.se...
> Best groupmember,
>
> I have a class SurfaceGrid that extends BufferedImage. I use the
properties
> of BufferedImage to save the class SurfaceGrid. The only thing that
differs
> SurfaceGrid from BufferedImage is that I have som constant int's that I
use
> for classification of objects in my surface.
>
> The writing to file is no problem, it is the reading that gives me
problem.
> I read the file like this:
>
> BufferedImage tempImg = ImageIO.read(new File(mySurfaceGridFileName);
>
> After that I want to cast tempImg to SurfaceGrid, but by trying:
>
> SurfaceGrid sg = (SurfaceGrid) tempImg;
>
> That does not work, what should I do?
>
> I would appreciate any suggestions.
>
> Cheers, Peter
>
>



Relevant Pages

  • Re: Class with BufferedImage as superclass
    ... I have already changed my implementation where I just have a BufferedImage ... It were possible if your SurfaceGrid implements RenderedImage ... create SurfaceGrid and draw tempImg into ... >> Cheers, Peter ...
    (comp.lang.java.programmer)
  • Class with BufferedImage as superclass
    ... I have a class SurfaceGrid that extends BufferedImage. ... BufferedImage tempImg = ImageIO.read; ...
    (comp.lang.java.programmer)
  • Re: Class with BufferedImage as superclass
    ... >:I have a class SurfaceGrid that extends BufferedImage. ... Steve W. Jackson ...
    (comp.lang.java.programmer)