Skip to content
This repository was archived by the owner on Oct 6, 2024. It is now read-only.

Commit 5df128d

Browse files
committed
simple import for issue #14
Signed-off-by: Mattias Andrée <[email protected]>
1 parent 30f718d commit 5df128d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/se/kth/maandree/utilsay/Image.java

+22
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,28 @@ public Pony importPony() throws IOException
160160
pony.matrix[y][x] = new Pony.Cell(Pony.Cell.NNW_SSE, null, null, null);
161161
else if ((r == 0) && (g == 0) && (b == 255))
162162
pony.matrix[y][x] = new Pony.Cell(Pony.Cell.NNE_SSW, null, null, null);
163+
else if ((r == 0) && (g == 255) && (b == 0))
164+
{
165+
int bw = x, _x = x;
166+
for (x++; x < width; x++)
167+
{ a = r = g = b = 0;
168+
for (int yy = 0; yy < this.magnified; yy++)
169+
for (int xx = 0; xx < this.magnified; xx++)
170+
{ int argb = image.getRGB(x * this.magnified + xx, y * this.magnified + yy);
171+
a += (argb >> 24) & 255;
172+
r += (argb >> 16) & 255;
173+
g += (argb >> 8) & 255;
174+
b += argb & 255;
175+
}
176+
if ((a != 100) || (r != 0) || (g != 255) || (b != 0))
177+
break;
178+
}
179+
bw = x-- - bw;
180+
pony.matrix[y][_x] = null;
181+
pony.metamatrix[y][_x] = new Pony.Meta[] { new Pony.Balloon(
182+
null, null, new Integer(bw), null,
183+
null, null, Pony.Balloon.NONE) };
184+
}
163185
break;
164186

165187
case 99:

0 commit comments

Comments
 (0)