X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FPixelBuffer.java;h=aa69b116f9f793ff1a9bcabc9010b91e8ade85ac;hb=2ccad2219888c9942f62ae8b4d4207f655690948;hp=8285f41c83bc4978acf6cae9e59896495344de21;hpb=67eeff476179a91ae930ea89cbecde22132ca532;p=org.ibex.core.git diff --git a/src/org/xwt/PixelBuffer.java b/src/org/xwt/PixelBuffer.java index 8285f41..aa69b11 100644 --- a/src/org/xwt/PixelBuffer.java +++ b/src/org/xwt/PixelBuffer.java @@ -22,17 +22,17 @@ package org.xwt; public abstract class PixelBuffer { /** draw the picture at (dx1, dy1), cropping to (cx1, cy1, cx2, cy2) */ - public abstract void drawPicture(Picture source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2); + protected abstract void drawPicture(Picture source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2); /** fill a trapezoid whose top and bottom edges are horizontal */ - public abstract void fillJSTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color); + public abstract void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int color); /** * Same as drawPicture, but only uses the alpha channel of the Picture, and is allowed to destructively modify the RGB * channels of the Picture in the process. This method may assume that the RGB channels of the image are all zero IFF it * restores this invariant before returning. */ - public abstract void drawPictureAlphaOnly(Picture source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb); + public abstract void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb); // FEATURE: we want floats (inter-pixel spacing) for antialiasing, but this hoses the fastpath line drawing... argh! /** draws a line of width w; note that the coordinates here are post-transform */ @@ -41,7 +41,8 @@ public abstract class PixelBuffer { if (y1 > y2) { int t = x1; x1 = x2; x2 = t; t = y1; y1 = y2; y2 = t; } if (x1 == x2) { - fillJSTrapezoid(x1 - w / 2, x2 + w / 2, y1 - (capped ? w / 2 : 0), x1 - w / 2, x2 + w / 2, y2 + (capped ? w / 2 : 0), color); + fillTrapezoid(x1 - w / 2, x2 + w / 2, y1 - (capped ? w / 2 : 0), + x1 - w / 2, x2 + w / 2, y2 + (capped ? w / 2 : 0), color); return; } @@ -51,9 +52,9 @@ public abstract class PixelBuffer { int last_x = x1; for(int y=y1; y<=y2; y++) { int new_x = (int)((float)(y - y1) / slope) + x1; - if (slope >= 0) fillJSTrapezoid(last_x + 1, y != y2 ? new_x + 1 : new_x, y, + if (slope >= 0) fillTrapezoid(last_x + 1, y != y2 ? new_x + 1 : new_x, y, last_x + 1, y != y2 ? new_x + 1 : new_x, y + 1, color); - else fillJSTrapezoid(y != y2 ? new_x : new_x + 1, last_x, y, + else fillTrapezoid(y != y2 ? new_x : new_x + 1, last_x, y, y != y2 ? new_x : new_x + 1, last_x, y + 1, color); last_x = new_x; } @@ -80,9 +81,9 @@ public abstract class PixelBuffer { y2 += width * Math.sin(phi); } - fillJSTrapezoid(x1 + dx, x1 + dx, y1 - dy, x1 - dx, x1 - dx + slice, y1 + dy, color); // top corner - fillJSTrapezoid(x2 + dx - slice, x2 + dx, y2 - dy, x2 - dx, x2 - dx, y2 + dy, color); // bottom corner - fillJSTrapezoid(x1 - dx, x1 - dx + slice, y1 + dy, x2 + dx - slice, x2 + dx, y2 - dy, color); // middle + fillTrapezoid(x1 + dx, x1 + dx, y1 - dy, x1 - dx, x1 - dx + slice, y1 + dy, color); // top corner + fillTrapezoid(x2 + dx - slice, x2 + dx, y2 - dy, x2 - dx, x2 - dx, y2 + dy, color); // bottom corner + fillTrapezoid(x1 - dx, x1 - dx + slice, y1 + dy, x2 + dx - slice, x2 + dx, y2 - dy, color); // middle } }