Re: Class with BufferedImage as superclass
From: ak (k.andrei_at_gmx.de.spam)
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.
b. After your read tempImg, create SurfaceGrid and draw tempImg into
Graphics of SurfaceGrid.
"Peter the Swede" <email@example.com> schrieb im Newsbeitrag
> Best groupmember,
> I have a class SurfaceGrid that extends BufferedImage. I use the
> of BufferedImage to save the class SurfaceGrid. The only thing that
> SurfaceGrid from BufferedImage is that I have som constant int's that I
> for classification of objects in my surface.
> The writing to file is no problem, it is the reading that gives me
> 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