📄 gxp_graphics.c
字号:
/* * * * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. *//** * @defgroup lowui Low Level UI * @ingroup subsystems *//** * @defgroup lowui_port Porting Interface * @ingroup lowui *//** * @defgroup lowui_extern External Interface * @ingroup lowui *//** * @file * @ingroup lowui_port * * @brief Porting interface to low-level graphics and images */#include <gx_image.h>#include <gxpport_graphics.h>#ifdef __cplusplusextern "C" {#endif/** * <b>Platform Porting API:</b> * Translate a RGB or Gray Scale to device-dependent pixel value. * * <p> * Related Java declaration: * <pre> * getPixel(IIZ)I * </pre> * * @param rgb compact rgb representation * @param gray gray scale * @param isGray use gray scale */extern jint gx_get_pixel(jint rgb, int gray, int isGray) { return gxpport_get_pixel(rgb, gray, isGray);}/** * <b>Platform Porting API:</b> * Draws a straight line between the given coordinates using the * current color, stroke style, and clipping data. * * <p> * Related Java declaration: * <pre> * drawLine(IIII)V * </pre> * * @param pixel Device-dependent pixel value * @param clip Clipping information * @param dst Platform dependent destination information * @param dotted Stroke style * @param x1 x coordinate of the start point * @param y1 y coordinate of the start point * @param x2 x coordinate of the end point * @param y2 y coordinate of the end point */extern void gx_draw_line(jint pixel, const jshort *clip, const java_imagedata *dst, int dotted, int x1, int y1, int x2, int y2) { gxpport_mutableimage_native_handle dstHandle = (gxpport_mutableimage_native_handle)(dst ? dst->nativeImageData : 0); gxpport_draw_line(pixel, clip, dstHandle, dotted, x1, y1, x2, y2);}/** * <b>Platform Porting API:</b> * Draws the outline of the specified rectangle using the current * color and stroke style at (x,y) position. * * <p> * Related Java declaration: * <pre> * drawRect(IIII)V * </pre> * * @note There is no need to check for negative (or zero) of * width and height since they are already checked before MIDP * runtime calls this function. * * @param pixel Device-dependent pixel value * @param clip Clipping information * @param dst Platform dependent destination information * @param dotted Stroke style * @param x x coordinate of the rectangle * @param y y coordinate of the rectangle * @param width Width of the rectangle * @param height Height of the rectangle */extern void gx_draw_rect(jint pixel, const jshort *clip, const java_imagedata *dst, int dotted, int x, int y, int width, int height) { gxpport_mutableimage_native_handle dstHandle = (gxpport_mutableimage_native_handle)(dst ? dst->nativeImageData : 0); gxpport_draw_rect(pixel, clip, dstHandle, dotted, x, y, width, height);}/** * <b>Platform Porting API:</b> * Fills the specified rectangle using the current color and * stroke style at (x,y) position. * * @note There is no need to check for negative (or zero) of width and * height since they are already checked before MIDP runtime calls * this function. * * <p> * <b>Reference:</b> * Related Java declaration: * <pre> * fillRect(IIII)V * </pre> * * @param pixel Device-dependent pixel value * @param clip Clipping information * @param dst Platform dependent destination information * @param dotted The stroke style to be used * @param x The x coordinate of the rectangle to be drawn * @param y The y coordinate of the rectangle to be drawn * @param width The width of the rectangle to be drawn * @param height The height of the rectangle to be drawn */extern void gx_fill_rect(jint pixel, const jshort *clip, const java_imagedata *dst, int dotted, int x, int y, int width, int height) { gxpport_mutableimage_native_handle dstHandle = (gxpport_mutableimage_native_handle)(dst ? dst->nativeImageData : 0); gxpport_fill_rect(pixel, clip, dstHandle, dotted, x, y, width, height);}/** * <b>Platform Porting API:</b> * Draws the outline of the specified rectangle, with rounded * corners, using the current color and stroke style. * * @note There is no need to check for negative (or zero) of * width and height since they are already checked before MIDP * runtime calls this function. * * <p> * <b>Reference:</b> * Related Java declaration: * <pre> * drawRoundRect(IIIIII)V * </pre> * * @param pixel Device-dependent pixel value * @param clip Clipping information * @param dst Platform dependent destination information * @param dotted The stroke style to be used * @param x The x coordinate of the rectangle to be drawn * @param y The y coordinate of the rectangle to be drawn * @param width The width of the rectangle to be drawn * @param height The height of the rectangle to be drawn * @param arcWidth The horizontal diameter of the arc at the four corners * @param arcHeight The vertical diameter of the arc at the four corners */extern void gx_draw_roundrect(jint pixel, const jshort *clip, const java_imagedata *dst, int dotted, int x, int y, int width, int height, int arcWidth, int arcHeight) { gxpport_mutableimage_native_handle dstHandle = (gxpport_mutableimage_native_handle)(dst ? dst->nativeImageData : 0); gxpport_draw_roundrect(pixel, clip, dstHandle, dotted, x, y, width, height, arcWidth, arcHeight);}/** * <b>Platform Porting API:</b> * Fills the outline of the specified rectangle, with rounded corners, * using the current color and stroke style. * * @note There is no need to check for negative (or zero) of * width and height since they are already checked before MIDP * runtime calls this function. * * <p> * <b>Reference:</b> * Related Java declaration: * <pre> * fillRoundRect(IIIIII)V * </pre> * * @param pixel Device-dependent pixel value * @param clip Clipping information * @param dst Platform dependent destination information * @param dotted The stroke style to be used * @param x The x coordinate of the rectangle to be drawn * @param y The y coordinate of the rectangle to be drawn * @param width The width of the rectangle to be drawn * @param height The height of the rectangle to be drawn * @param arcWidth The horizontal diameter of the arc at the four corners * @param arcHeight The vertical diameter of the arc at the four corners */extern void gx_fill_roundrect(jint pixel, const jshort *clip, const java_imagedata *dst, int dotted, int x, int y, int width, int height, int arcWidth, int arcHeight) { gxpport_mutableimage_native_handle dstHandle = (gxpport_mutableimage_native_handle)(dst ? dst->nativeImageData : 0); gxpport_fill_roundrect(pixel, clip, dstHandle, dotted, x, y, width, height, arcWidth, arcHeight);}/** * <b>Platform Porting API:</b> * Draws the outline of the specified circular or elliptical arc * segment using the current color and stroke style.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -