microui  14.5.5
microui
ui_drawing.h
1 /*
2  * Copyright 2020-2026 MicroEJ Corp. All rights reserved.
3  * MicroEJ Corp. PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
4  */
5 
6 #if !defined UI_DRAWING_H
7 #define UI_DRAWING_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
80 // --------------------------------------------------------------------------------
81 // Includes
82 // --------------------------------------------------------------------------------
83 
84 #include <LLUI_PAINTER_impl.h>
85 #include <LLDW_PAINTER_impl.h>
86 
87 #include "ui_configuration.h"
88 
89 // --------------------------------------------------------------------------------
90 // Defines
91 // --------------------------------------------------------------------------------
92 
96 #ifndef CONCAT
97 #define CONCAT0(p, s) p ## s
98 #define CONCAT(p, s) CONCAT0(p, s)
99 #endif
100 
101 // --------------------------------------------------------------------------------
102 // API
103 // --------------------------------------------------------------------------------
104 
105 #if defined(UI_GC_SUPPORTED_FORMATS) && (UI_GC_SUPPORTED_FORMATS > 1)
106 
107 /*
108  * @brief Tells if drawer "1" matches the destination format. The VEE port must implement
109  * this function when it includes the support to target the destination format. It not, the
110  * default weak implementation in ui_drawing.c redirects all the drawings for this destination
111  * format in the stub implementation.
112  */
113 bool UI_DRAWING_is_drawer_1(jbyte image_format);
114 
115 #if (UI_GC_SUPPORTED_FORMATS > 2)
116 /*
117  * @brief Tells drawer "2" matches the destination format. See UI_DRAWING_is_drawer_1.
118  */
119 bool UI_DRAWING_is_drawer_2(jbyte image_format);
120 
121 #endif // #if (UI_GC_SUPPORTED_FORMATS > 2)
122 
123 #endif // #if defined(UI_GC_SUPPORTED_FORMATS) && (UI_GC_SUPPORTED_FORMATS > 1)
124 
138 uint32_t UI_DRAWING_getNewImageStrideInBytes(jbyte image_format, uint32_t image_width, uint32_t image_height,
139  uint32_t default_stride);
140 
153 void UI_DRAWING_adjustNewImageCharacteristics(jbyte image_format, uint32_t width, uint32_t height, uint32_t *data_size,
154  uint32_t *data_alignment);
155 
163 void UI_DRAWING_initializeNewImage(MICROUI_Image *image);
164 
173 void UI_DRAWING_freeImageResources(MICROUI_Image *image);
174 
183 jint UI_DRAWING_stringWidth(jchar *chars, jint length, MICROUI_Font *font);
184 
194 jint UI_DRAWING_initializeRenderableStringSNIContext(jchar *chars, jint length, MICROUI_Font *font,
195  MICROUI_RenderableString *renderableString);
196 
206 DRAWING_Status UI_DRAWING_writePixel(MICROUI_GraphicsContext *gc, jint x, jint y);
207 
220 DRAWING_Status UI_DRAWING_drawLine(MICROUI_GraphicsContext *gc, jint startX, jint startY, jint endX, jint endY);
221 
233 DRAWING_Status UI_DRAWING_drawHorizontalLine(MICROUI_GraphicsContext *gc, jint x1, jint x2, jint y);
234 
246 DRAWING_Status UI_DRAWING_drawVerticalLine(MICROUI_GraphicsContext *gc, jint x, jint y1, jint y2);
247 
261 DRAWING_Status UI_DRAWING_drawRectangle(MICROUI_GraphicsContext *gc, jint x1, jint y1, jint x2, jint y2);
262 
276 DRAWING_Status UI_DRAWING_fillRectangle(MICROUI_GraphicsContext *gc, jint x1, jint y1, jint x2, jint y2);
277 
292 DRAWING_Status UI_DRAWING_drawRoundedRectangle(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
293  jint cornerEllipseWidth, jint cornerEllipseHeight);
294 
309 DRAWING_Status UI_DRAWING_fillRoundedRectangle(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
310  jint cornerEllipseWidth, jint cornerEllipseHeight);
311 
340 DRAWING_Status UI_DRAWING_drawCircleArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter, jfloat startAngle,
341  jfloat arcAngle);
342 
373 DRAWING_Status UI_DRAWING_drawEllipseArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
374  jfloat startAngle, jfloat arcAngle);
375 
404 DRAWING_Status UI_DRAWING_fillCircleArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter, jfloat startAngle,
405  jfloat arcAngle);
406 
437 DRAWING_Status UI_DRAWING_fillEllipseArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
438  jfloat startAngle, jfloat arcAngle);
439 
455 DRAWING_Status UI_DRAWING_drawEllipse(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height);
456 
471 DRAWING_Status UI_DRAWING_fillEllipse(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height);
472 
486 DRAWING_Status UI_DRAWING_drawCircle(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter);
487 
501 DRAWING_Status UI_DRAWING_fillCircle(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter);
502 
537 DRAWING_Status UI_DRAWING_drawImage(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
538  jint width, jint height, jint x, jint y, jint alpha);
539 
568 DRAWING_Status UI_DRAWING_copyImage(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
569  jint width, jint height, jint x, jint y);
570 
595 DRAWING_Status UI_DRAWING_drawRegion(MICROUI_GraphicsContext *gc, jint regionX, jint regionY, jint width, jint height,
596  jint x, jint y, jint alpha);
597 
609 DRAWING_Status UI_DRAWING_drawString(MICROUI_GraphicsContext *gc, jchar *chars, jint length, MICROUI_Font *font, jint x,
610  jint y);
611 
626 DRAWING_Status UI_DRAWING_drawRenderableString(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
627  MICROUI_Font *font, jint width,
628  MICROUI_RenderableString *renderableString, jint x, jint y);
629 
641 DRAWING_Status UI_DRAWING_drawThickFadedPoint(MICROUI_GraphicsContext *gc, jint x, jint y, jint thickness, jint fade);
642 
658 DRAWING_Status UI_DRAWING_drawThickFadedLine(MICROUI_GraphicsContext *gc, jint startX, jint startY, jint endX,
659  jint endY, jint thickness, jint fade, DRAWING_Cap startCap,
660  DRAWING_Cap endCap);
661 
676 DRAWING_Status UI_DRAWING_drawThickFadedCircle(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter,
677  jint thickness, jint fade);
678 
709 DRAWING_Status UI_DRAWING_drawThickFadedCircleArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter,
710  jfloat startAngle, jfloat arcAngle, jint thickness, jint fade,
711  DRAWING_Cap start, DRAWING_Cap end);
712 
731 DRAWING_Status UI_DRAWING_drawThickFadedEllipse(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
732  jint thickness, jint fade);
733 
746 DRAWING_Status UI_DRAWING_drawThickLine(MICROUI_GraphicsContext *gc, jint startX, jint startY, jint endX, jint endY,
747  jint thickness);
748 
762 DRAWING_Status UI_DRAWING_drawThickCircle(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter, jint thickness);
763 
781 DRAWING_Status UI_DRAWING_drawThickEllipse(MICROUI_GraphicsContext *gc, jint x, jint y, jint width, jint height,
782  jint thickness);
783 
807 DRAWING_Status UI_DRAWING_drawThickCircleArc(MICROUI_GraphicsContext *gc, jint x, jint y, jint diameter,
808  jfloat startAngle, jfloat arcAngle, jint thickness);
809 
827 DRAWING_Status UI_DRAWING_drawFlippedImage(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint regionX, jint regionY,
828  jint width, jint height, jint x, jint y, DRAWING_Flip transformation,
829  jint alpha);
830 
852 DRAWING_Status UI_DRAWING_drawRotatedImageNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
853  jint y, jint rotationX, jint rotationY, jfloat angle,
854  jint alpha);
855 
878 DRAWING_Status UI_DRAWING_drawRotatedImageBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
879  jint rotationX, jint rotationY, jfloat angle, jint alpha);
880 
897 DRAWING_Status UI_DRAWING_drawScaledImageNearestNeighbor(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x,
898  jint y, jfloat factorX, jfloat factorY, jint alpha);
899 
917 DRAWING_Status UI_DRAWING_drawScaledImageBilinear(MICROUI_GraphicsContext *gc, MICROUI_Image *img, jint x, jint y,
918  jfloat factorX, jfloat factorY, jint alpha);
919 
937 DRAWING_Status UI_DRAWING_drawScaledStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
938  MICROUI_Font *font, jint x, jint y, jfloat xRatio, jfloat yRatio);
939 
959 DRAWING_Status UI_DRAWING_drawScaledRenderableStringBilinear(MICROUI_GraphicsContext *gc, jchar *chars, jint length,
960  MICROUI_Font *font, jint width,
961  MICROUI_RenderableString *renderableString, jint x, jint y,
962  jfloat xRatio, jfloat yRatio);
963 
982 DRAWING_Status UI_DRAWING_drawCharWithRotationBilinear(MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font, jint x,
983  jint y, jint xRotation, jint yRotation, jfloat angle,
984  jint alpha);
985 
1004 DRAWING_Status UI_DRAWING_drawCharWithRotationNearestNeighbor(MICROUI_GraphicsContext *gc, jchar c, MICROUI_Font *font,
1005  jint x, jint y, jint xRotation, jint yRotation,
1006  jfloat angle, jint alpha);
1007 
1008 // --------------------------------------------------------------------------------
1009 // EOF
1010 // --------------------------------------------------------------------------------
1011 
1012 #ifdef __cplusplus
1013 }
1014 #endif
1015 
1016 #endif // UI_DRAWING_H
MicroEJ MicroUI library low level API: enable some features according to the hardware capabilities.