⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 defaultlcdui.c

📁 用于移动设备上的java虚拟机源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
    KNI_GetObjectClass(thisClass, gHandle);    KNI_TRANSLATE(thisClass, x, y, gHandle);    LCDUIfillRect(KNI_PIXEL(thisClass, gHandle),		  KNI_CLIP(thisClass, gHandle, myClip, cHandle),		  KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		  KNI_LINESTYLE(thisClass, gHandle),		  x, y, w, h);    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      drawRoundRect(IIIIII)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Draws the outline of the specified rounded corner *                 rectangle using the current color and stroke style. * INTERFACE (operand stack manipulation): *   parameters:  x          the x coordinate of the rectangle to be drawn *                y          the y coordinate of the rectangle to be drawn *                width      the width of the rectangle to be drawn *                height     the height of the rectangle to be drawn *                arcWidth   the horizontal diameter of the arc at the *                            four corners *                arcHeight  the vertical diameter of the arc at the *                            four corners *   returns:     <nothing> *=======================================================================*/KNIEXPORT KNI_RETURNTYPE_VOIDJava_javax_microedition_lcdui_Graphics_drawRoundRect() {    int arcHeight = KNI_GetParameterAsInt(6);    int  arcWidth = KNI_GetParameterAsInt(5);    int         h = KNI_GetParameterAsInt(4);    int         w = KNI_GetParameterAsInt(3);    int         y = KNI_GetParameterAsInt(2);    int         x = KNI_GetParameterAsInt(1);    jshort myClip[4]; /* Defined in Graphics.java as 4 shorts */    KNI_StartHandles(4);    KNI_DeclareHandle(thisClass);    KNI_DeclareHandle(gHandle);    KNI_DeclareHandle(cHandle);    KNI_DeclareHandle(iHandle);    KNI_GetParameterAsObject(0, thisClass);    KNI_GetObjectClass(thisClass, gHandle);    KNI_TRANSLATE(thisClass, x, y, gHandle);    LCDUIdrawRoundRect(KNI_PIXEL(thisClass, gHandle),		       KNI_CLIP(thisClass, gHandle, myClip, cHandle),		       KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		       KNI_LINESTYLE(thisClass, gHandle),		       x, y, w, h, arcWidth, arcHeight);    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      fillRoundRect(IIIIII)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Fills the specified rounded corner rectangle using the *                 current color. * INTERFACE (operand stack manipulation): *   parameters:  x          the x coordinate of the rectangle to be filled *                y          the y coordinate of the rectangle to be filled *                width      the width of the rectangle to be filled *                height     the height of the rectangle to be filled *                arcWidth   the horizontal diameter of the arc at the *                            four corners *                arcHeight  the vertical diameter of the arc at the *                            four corners *   returns:     <nothing> *=======================================================================*/KNIEXPORT KNI_RETURNTYPE_VOIDJava_javax_microedition_lcdui_Graphics_fillRoundRect() {    int arcHeight = KNI_GetParameterAsInt(6);    int  arcWidth = KNI_GetParameterAsInt(5);    int         h = KNI_GetParameterAsInt(4);    int         w = KNI_GetParameterAsInt(3);    int         y = KNI_GetParameterAsInt(2);    int         x = KNI_GetParameterAsInt(1);    jshort myClip[4]; /* Defined in Graphics.java as 4 shorts */    KNI_StartHandles(4);    KNI_DeclareHandle(thisClass);    KNI_DeclareHandle(gHandle);    KNI_DeclareHandle(cHandle);    KNI_DeclareHandle(iHandle);    KNI_GetParameterAsObject(0, thisClass);    KNI_GetObjectClass(thisClass, gHandle);    KNI_TRANSLATE(thisClass, x, y, gHandle);    LCDUIfillRoundRect(KNI_PIXEL(thisClass, gHandle),		       KNI_CLIP(thisClass, gHandle, myClip, cHandle),		       KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		       KNI_LINESTYLE(thisClass, gHandle),		       x, y, w, h, arcWidth, arcHeight);    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      drawArc(IIIIII)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Draws the outline of a circular or elliptical arc *                 covering the specified rectangle, using the current *                 color and stroke style. * INTERFACE (operand stack manipulation): *   parameters:  x            the x coordinate of the upper-left corner *                              of the arc to be drawn *                y            the y coordinate of the upper-left corner *                              of the arc to be drawn *                width        the width of the arc to be drawn *                height       the height of the arc to be drawn *                startAngle   the beginning angle. *                arcAngle     the angular extent of the arc, relative to *                              the start angle. *   returns:     <nothing> *=======================================================================*/KNIEXPORT KNI_RETURNTYPE_VOIDJava_javax_microedition_lcdui_Graphics_drawArc() {    int   arcAngle = KNI_GetParameterAsInt(6);    int startAngle = KNI_GetParameterAsInt(5);    int          h = KNI_GetParameterAsInt(4);    int          w = KNI_GetParameterAsInt(3);    int          y = KNI_GetParameterAsInt(2);    int          x = KNI_GetParameterAsInt(1);    jshort myClip[4]; /* Defined in Graphics.java as 4 shorts */    KNI_StartHandles(4);    KNI_DeclareHandle(thisClass);    KNI_DeclareHandle(gHandle);    KNI_DeclareHandle(cHandle);    KNI_DeclareHandle(iHandle);    KNI_GetParameterAsObject(0, thisClass);    KNI_GetObjectClass(thisClass, gHandle);    KNI_TRANSLATE(thisClass, x, y, gHandle);    if (arcAngle < 0) {        startAngle += arcAngle;        arcAngle = -arcAngle;    }    startAngle = (startAngle + 360) % 360;    LCDUIdrawArc(KNI_PIXEL(thisClass, gHandle),		 KNI_CLIP(thisClass, gHandle, myClip, cHandle),		 KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		 KNI_LINESTYLE(thisClass, gHandle),		 x, y, w, h, startAngle, arcAngle);    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      fillArc(IIIIII)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Draws the outline of a circular or elliptical arc *                 covering the specified rectangle, using the current *                 color and stroke style. * INTERFACE (operand stack manipulation): *   parameters:  x            the x coordinate of the upper-left corner *                              of the arc to be filled *                y            the y coordinate of the upper-left corner *                              of the arc to be filled *                width        the width of the arc to be filled *                height       the height of the arc to be filled *                startAngle   the beginning angle. *                arcAngle     the angular extent of the arc, relative to *                              the start angle. *   returns:     <nothing> *=======================================================================*/KNIEXPORT KNI_RETURNTYPE_VOIDJava_javax_microedition_lcdui_Graphics_fillArc() {    int   arcAngle = KNI_GetParameterAsInt(6);    int startAngle = KNI_GetParameterAsInt(5);    int          h = KNI_GetParameterAsInt(4);    int          w = KNI_GetParameterAsInt(3);    int          y = KNI_GetParameterAsInt(2);    int          x = KNI_GetParameterAsInt(1);    jshort myClip[4]; /* Defined in Graphics.java as 4 shorts */    KNI_StartHandles(4);    KNI_DeclareHandle(thisClass);    KNI_DeclareHandle(gHandle);    KNI_DeclareHandle(cHandle);    KNI_DeclareHandle(iHandle);    KNI_GetParameterAsObject(0, thisClass);    KNI_GetObjectClass(thisClass, gHandle);    KNI_TRANSLATE(thisClass, x, y, gHandle);    if (arcAngle < 0) {        startAngle += arcAngle;        arcAngle = -arcAngle;    }    startAngle = (startAngle + 360) % 360;    LCDUIfillArc(KNI_PIXEL(thisClass, gHandle),		 KNI_CLIP(thisClass, gHandle, myClip, cHandle),		 KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		 KNI_LINESTYLE(thisClass, gHandle),		 x, y, w, h, startAngle, arcAngle);    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      fillTriangle(IIIIII)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Draws a filled triangle connecting the given points *                using the current color and stroke style. * * INTERFACE (operand stack manipulation): *   parameters:  x1    the x coordinate of the first vertice *                y1    the y coordinate of the first vertice *                x2    the x coordinate of the second vertice *                y2    the y coordinate of the second vertice *                x3    the x coordinate of the third vertice *                y3    the y coordinate of the third vertice *   returns:     <nothing> *=======================================================================*/KNIEXPORT KNI_RETURNTYPE_VOIDJava_javax_microedition_lcdui_Graphics_fillTriangle(KNITRAPS) {    int         y3 = KNI_GetParameterAsInt(6);    int         x3 = KNI_GetParameterAsInt(5);    int         y2 = KNI_GetParameterAsInt(4);    int         x2 = KNI_GetParameterAsInt(3);    int         y1 = KNI_GetParameterAsInt(2);    int         x1 = KNI_GetParameterAsInt(1);    jshort myClip[4]; /* Defined in Graphics.java as 4 shorts */    KNI_StartHandles(4);    KNI_DeclareHandle(thisClass);    KNI_DeclareHandle(gHandle);    KNI_DeclareHandle(cHandle);    KNI_DeclareHandle(iHandle);    KNI_GetParameterAsObject(0, thisClass);    KNI_GetObjectClass(thisClass, gHandle);    KNI_TRANSLATE(thisClass, x1, y1, gHandle);    KNI_TRANSLATE(thisClass, x2, y2, gHandle);    KNI_TRANSLATE(thisClass, x3, y3, gHandle);    LCDUIfillTriangle(KNI_PIXEL(thisClass, gHandle),		      KNI_CLIP(thisClass, gHandle, myClip, cHandle),		      KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		      KNI_LINESTYLE(thisClass, gHandle),		      x1, y1, x2, y2, x3, y3);    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      drawString(Ljava/lang/String;III)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Draws the specified String using the current font *                 and color. * INTERFACE (operand stack manipulation): *   parameters:  str      the String to be drawn *                x        the x coordinate of the anchor point *                y        the y coordinate of the anchor point *                anchor   the anchor point for positioning the text *   returns:     <nothing> *=======================================================================*/KNIEXPORT KNI_RETURNTYPE_VOIDJava_javax_microedition_lcdui_Graphics_drawString() {    int anchor = KNI_GetParameterAsInt(4);    int      y = KNI_GetParameterAsInt(3);    int      x = KNI_GetParameterAsInt(2);    int strLen;    KNI_StartHandles(7);    KNI_DeclareHandle(str);    KNI_DeclareHandle(thisClass);    KNI_DeclareHandle(font);    KNI_DeclareHandle(gHandle);    KNI_DeclareHandle(fHandle);    KNI_DeclareHandle(cHandle);    KNI_DeclareHandle(iHandle);    KNI_GetParameterAsObject(1, str);    KNI_GetParameterAsObject(0, thisClass);    strLen = KNI_GetStringLength(str);    if (strLen < 0) {        KNI_ThrowNew("java/lang/NullPointerException", "");    } else if (!checkAnchor(anchor, VCENTER)) {        KNI_ThrowNew("java/lang/IllegalArgumentException", "");    } else {	unicode* chars;	jshort   myClip[4]; /* Defined in Graphics.java as 4 shorts */	int      FONTPARAMS;	chars = (unicode*)midpMalloc(strLen<<1);    if (chars == NULL) {        KNI_ThrowNew("java/lang/OutOfMemoryError", "");    } else {	    KNI_GetObjectClass(thisClass, gHandle);	    KNI_FONT(thisClass, gHandle, font);	    KNI_GetObjectClass(font, fHandle);	    DECLARE_KNI_FONT_PARAMS(font, fHandle);        KNI_TRANSLATE(thisClass, x, y, gHandle);	    KNI_GetStringRegion(str, 0, strLen, chars);	    LCDUIdrawChars(KNI_PIXEL(thisClass, gHandle),		           KNI_CLIP(thisClass, gHandle, myClip, cHandle),		           KNI_IMAGEDST(thisClass, gHandle, iHandle, NULL), 		           KNI_LINESTYLE(thisClass, gHandle),		           FONTPARAMS, x, y, anchor, chars, strLen);	    midpFree(chars);        }    }    KNI_EndHandles();    KNI_ReturnVoid();}/*========================================================================= * FUNCTION:      drawSubString(Ljava/lang/String;IIIII)V * CLASS:         javax.microedition.lcdui.Graphics * TYPE:          virtual native function * OVERVIEW:      Draws the specified String using the current font *                 and color. * INTERFACE (operand stack manipulation): *   parameters:  str      the String to be drawn *                offset   zero-based index of first character in the *                          substring *                length   length of the substring *                x        the x coordinate of the anchor point *                y        the y coordinate of the anchor point *                anchor   the anchor point for positioning the text *   returns:     <nothing>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -