001package polaris.sdk.ui; 002/** Draw-list target. Host renderers may implement this interface instead of the bundled JNI backend. */ 003public interface Painter { 004 /** Called by Ui.render before any widget drawing; custom backends may override. */ 005 default void configure(Theme theme){} 006 /** Scoped profile for the current widget. Null restores its normal radius argument. */ 007 default void corners(CornerRadii profile){} 008 void clip(Rect r); 009 /** Push an intersecting rounded content clip. Coordinates are logical/absolute. 010 * A null profile follows the active theme, with the supplied radius. Max native depth: 32. 011 * Custom painters that do not override these methods retain the existing rectangular clips. */ 012 default void pushShapeClip(Rect bounds,float radius,CornerRadii profile){} 013 /** Pop only the last shaped content clip; does not change the rectangular scissor. */ 014 default void popShapeClip(){} 015 void glass(float x,float y,float w,float h,float radius,Theme t,float blur); 016 void fill(float x,float y,float w,float h,float radius,int color); 017 void stroke(float x,float y,float w,float h,float radius,float thickness,int color); 018 void line(float x,float y,float x2,float y2,float thickness,int color); 019 void ring(float x,float y,float size,float thickness,float progress,float start,int color); 020 void colorPlane(float x,float y,float w,float h,float hue); 021 default void colorPlaneAlpha(float x,float y,float w,float h,float hue,float alpha){colorPlane(x,y,w,h,hue);} 022 void text(String text,float x,float y,float size,int color); 023 float textWidth(String text,float size); 024 /** Affine text scaling without regenerating rasterized glyphs on every animated frame. */ 025 default void textScaled(String text,float x,float y,float size,int color,float scale){text(text,x,y,size*scale,color);} 026 default void textWeight(String text,float x,float y,float size,int color,int weight){text(text,x,y,size,color);} 027 default void textWeightScaled(String text,float x,float y,float size,int color,int weight,float scale){textScaled(text,x,y,size,color,scale);} 028 default float textWidth(String text,float size,int weight){return textWidth(text,size);} 029 030 /** Freeze the already drawn UI into a new backdrop for overlays. */ 031 void backdrop(); 032}