src/api-impl: misc stubbing

This commit is contained in:
Mis012
2022-12-27 17:21:21 +01:00
parent 696fa5a192
commit 2e4590c4d8
15 changed files with 226 additions and 52 deletions

View File

@@ -3,56 +3,125 @@ package android.graphics;
public class Paint {
private int color = 0xFF000000;
public void setColor(int color) {
public void setColor(int color) {
this.color = color;
}
public int getColor() {
public int getColor() {
return color;
}
public void setAntiAlias(boolean aa) {}
public void setStrokeWidth(float width) {}
public void setTextSize(float textSize) {}
public void setTextSize(float textSize) {}
public Typeface setTypeface(Typeface typeface) {
return null;
public Typeface setTypeface(Typeface typeface) {
return new Typeface();
}
public void getTextBounds(String text, int start, int end, Rect bounds) {}
public void getTextBounds(char[] text, int index, int count, Rect bounds) {}
public void getTextBounds(String text, int start, int end, Rect bounds) {}
public void getTextBounds(char[] text, int index, int count, Rect bounds) {}
public void setFlags(int flags) {}
public void setFilterBitmap(boolean filter) {}
public void setStyle(Style style) {}
public float ascent() { return 0; }
public void setStyle(Style style) {}
public float ascent() { return 0; }
public float measureText(char[] text, int index, int count) { return 10; }
public float measureText(String text, int start, int end) { return 10; }
public float measureText(String text) { return 10; }
public float measureText(CharSequence text, int start, int end) { return 10; }
public float measureText(char[] text, int index, int count) { return 10; }
public float measureText(String text, int start, int end) { return 10; }
public float measureText(String text) { return 10; }
public float measureText(CharSequence text, int start, int end) { return 10; }
public enum Style {
/**
* Geometry and text drawn with this style will be filled, ignoring all
* stroke-related settings in the paint.
*/
FILL (0),
/**
* Geometry and text drawn with this style will be stroked, respecting
* the stroke-related fields on the paint.
*/
STROKE (1),
/**
* Geometry and text drawn with this style will be both filled and
* stroked at the same time, respecting the stroke-related fields on
* the paint. This mode can give unexpected results if the geometry
* is oriented counter-clockwise. This restriction does not apply to
* either FILL or STROKE.
*/
FILL_AND_STROKE (2);
Style(int nativeInt) {
this.nativeInt = nativeInt;
}
final int nativeInt;
}
public static class FontMetrics {
/**
* The maximum distance above the baseline for the tallest glyph in
* the font at a given text size.
*/
public float top;
/**
* The recommended distance above the baseline for singled spaced text.
*/
public float ascent;
/**
* The recommended distance below the baseline for singled spaced text.
*/
public float descent;
/**
* The maximum distance below the baseline for the lowest glyph in
* the font at a given text size.
*/
public float bottom;
/**
* The recommended additional space to add between lines of text.
*/
public float leading;
}
public static class FontMetricsInt {
public int top;
public int ascent;
public int descent;
public int bottom;
public int leading;
@Override public String toString() {
return "FontMetricsInt: top=" + top + " ascent=" + ascent +
" descent=" + descent + " bottom=" + bottom +
" leading=" + leading;
}
}
public /*native*/ int getFlags() {return 0;}
public /*native*/ int getHinting() {return 0;}
public /*native*/ void setHinting(int mode) {}
public /*native*/ void setDither(boolean dither) {}
public /*native*/ void setLinearText(boolean linearText) {}
public /*native*/ void setSubpixelText(boolean subpixelText) {}
public /*native*/ void setUnderlineText(boolean underlineText) {}
public /*native*/ void setStrikeThruText(boolean strikeThruText) {}
public /*native*/ void setFakeBoldText(boolean fakeBoldText) {}
public /*native*/ int getAlpha() {return 0;}
public /*native*/ void setAlpha(int a) {}
public /*native*/ float getStrokeWidth() {return 0;}
public /*native*/ float getStrokeMiter() {return 0;}
public /*native*/ void setStrokeMiter(float miter) {}
public /*native*/ float getTextSize() {return 0;}
public /*native*/ float getTextScaleX() {return 0;}
public /*native*/ void setTextScaleX(float scaleX) {}
public /*native*/ float getTextSkewX() {return 0;}
public /*native*/ void setTextSkewX(float skewX) {}
public /*native*/ float descent() {return 0;}
public /*native*/ float getFontMetrics(FontMetrics metrics) {return 0;}
public /*native*/ int getFontMetricsInt(FontMetricsInt fmi) {return 0;}
public enum Style {
/**
* Geometry and text drawn with this style will be filled, ignoring all
* stroke-related settings in the paint.
*/
FILL (0),
/**
* Geometry and text drawn with this style will be stroked, respecting
* the stroke-related fields on the paint.
*/
STROKE (1),
/**
* Geometry and text drawn with this style will be both filled and
* stroked at the same time, respecting the stroke-related fields on
* the paint. This mode can give unexpected results if the geometry
* is oriented counter-clockwise. This restriction does not apply to
* either FILL or STROKE.
*/
FILL_AND_STROKE (2);
Style(int nativeInt) {
this.nativeInt = nativeInt;
}
final int nativeInt;
}
}

View File

@@ -4,8 +4,28 @@ import android.content.res.AssetManager;
public class Typeface {
/** The default NORMAL typeface object */
public static final Typeface DEFAULT = new Typeface();
/**
* The default BOLD typeface object. Note: this may be not actually be
* bold, depending on what fonts are installed. Call getStyle() to know
* for sure.
*/
public static final Typeface DEFAULT_BOLD = new Typeface();
/** The NORMAL style of the default sans serif typeface. */
public static final Typeface SANS_SERIF = new Typeface();
/** The NORMAL style of the default serif typeface. */
public static final Typeface SERIF = new Typeface();
/** The NORMAL style of the default monospace typeface. */
public static final Typeface MONOSPACE = new Typeface();
// Style
public static final int NORMAL = 0;
public static final int BOLD = 1;
public static final int ITALIC = 2;
public static final int BOLD_ITALIC = 3;
public static Typeface createFromAsset(AssetManager mgr, String path) {
return null;
}
}