nanovg.pyi 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465
  1. ###############################################################################
  2. # This file is a part of Dear ImGui Bundle, NOT a part of NanoVG
  3. # -----------------------------------------------------------------------------
  4. # nanovg.pyi: auto-generated bindings for NanoVG.
  5. #
  6. # Most of the code of this file is automatically generated (using https://pthom.github.io/litgen/),
  7. # and is generally very close to the C++ version. Comments, docs are identical.
  8. # Do not manually edit the autogenerated parts (look for "Autogenerated" comments)!
  9. ###############################################################################
  10. import enum
  11. import numpy as np
  12. from typing import Any, Callable, Tuple, List, Optional, overload
  13. from imgui_bundle.imgui import ImVec4Like
  14. from imgui_bundle.imgui import ImTextureID
  15. OpaquePointer = np.uint64 | None
  16. Context = OpaquePointer
  17. UChar = int # a value between 0 and 255
  18. NvgDrawingFunction = Callable[[Context, int, int], Any]
  19. Bounds = Tuple[float, float, float, float]
  20. class Color:
  21. r: float
  22. g: float
  23. b: float
  24. a: float
  25. @overload
  26. def __init__(self, r:float, g:float, b:float, a:float):
  27. pass
  28. @overload
  29. def __init__(self, colors_tuple_4_float: tuple[float, float, float, float]): # noqa: F811
  30. pass
  31. # ruff: noqa: B008 # Do not perform function call in argument defaults
  32. # ruff: noqa: E741 # Ambiguous variable name: `l`
  33. """
  34. Python bindings for NanoVG
  35. https://github.com/memononen/nanovg
  36. """
  37. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! AUTOGENERATED CODE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  38. # <litgen_stub> // Autogenerated code below! Do not edit!
  39. #################### <generated_from:nanovg.h> ####################
  40. #
  41. # Copyright (c) 2013 Mikko Mononen memon@inside.org
  42. #
  43. # This software is provided 'as-is', without any express or implied
  44. # warranty. In no event will the authors be held liable for any damages
  45. # arising from the use of this software.
  46. # Permission is granted to anyone to use this software for any purpose,
  47. # including commercial applications, and to alter it and redistribute it
  48. # freely, subject to the following restrictions:
  49. # 1. The origin of this software must not be misrepresented; you must not
  50. # claim that you wrote the original software. If you use this software
  51. # in a product, an acknowledgment in the product documentation would be
  52. # appreciated but is not required.
  53. # 2. Altered source versions must be plainly marked as such, and must not be
  54. # misrepresented as being the original software.
  55. # 3. This notice may not be removed or altered from any source distribution.
  56. #
  57. # #ifndef NANOVG_H
  58. #
  59. # #ifdef __cplusplus
  60. #
  61. # #endif
  62. #
  63. class Paint:
  64. # float xform[6]; /* original C++ signature */
  65. xform: np.ndarray # ndarray[type=float, size=6]
  66. # float extent[2]; /* original C++ signature */
  67. extent: np.ndarray # ndarray[type=float, size=2]
  68. # float radius; /* original C++ signature */
  69. radius: float
  70. # float feather; /* original C++ signature */
  71. feather: float
  72. # NVGcolor innerColor; /* original C++ signature */
  73. inner_color: Color
  74. # NVGcolor outerColor; /* original C++ signature */
  75. outer_color: Color
  76. # int image; /* original C++ signature */
  77. image: int
  78. # NVGpaint(float radius = float(), float feather = float(), NVGcolor innerColor = NVGcolor(), NVGcolor outerColor = NVGcolor(), int image = int()); /* original C++ signature */
  79. def __init__(
  80. self,
  81. radius: float = float(),
  82. feather: float = float(),
  83. inner_color: Optional[Color] = None,
  84. outer_color: Optional[Color] = None,
  85. image: int = int()
  86. ) -> None:
  87. """Auto-generated default constructor with named params
  88. Python bindings defaults:
  89. If any of the params below is None, then its default value below will be used:
  90. * innerColor: Color()
  91. * outerColor: Color()
  92. """
  93. pass
  94. class Winding(enum.IntEnum):
  95. # NVG_CCW = 1, /* original C++ signature */
  96. ccw = enum.auto() # (= 1) # Winding for solid shapes
  97. # NVG_CW = 2, /* original C++ signature */
  98. cw = enum.auto() # (= 2) # Winding for holes
  99. class Solidity(enum.IntEnum):
  100. # NVG_SOLID = 1, /* original C++ signature */
  101. solid = enum.auto() # (= 1) # CCW
  102. # NVG_HOLE = 2, /* original C++ signature */
  103. hole = enum.auto() # (= 2) # CW
  104. class LineCap(enum.IntEnum):
  105. # NVG_BUTT, /* original C++ signature */
  106. butt = enum.auto() # (= 0)
  107. # NVG_ROUND, /* original C++ signature */
  108. round = enum.auto() # (= 1)
  109. # NVG_SQUARE, /* original C++ signature */
  110. square = enum.auto() # (= 2)
  111. # NVG_BEVEL, /* original C++ signature */
  112. bevel = enum.auto() # (= 3)
  113. # NVG_MITER, /* original C++ signature */
  114. # }
  115. miter = enum.auto() # (= 4)
  116. class Align(enum.IntEnum):
  117. # Horizontal align
  118. # NVG_ALIGN_LEFT = 1<<0, /* original C++ signature */
  119. align_left = enum.auto() # (= 1<<0) # Default, align text horizontally to left.
  120. # NVG_ALIGN_CENTER = 1<<1, /* original C++ signature */
  121. align_center = enum.auto() # (= 1<<1) # Align text horizontally to center.
  122. # NVG_ALIGN_RIGHT = 1<<2, /* original C++ signature */
  123. align_right = enum.auto() # (= 1<<2) # Align text horizontally to right.
  124. # Vertical align
  125. # NVG_ALIGN_TOP = 1<<3, /* original C++ signature */
  126. align_top = enum.auto() # (= 1<<3) # Align text vertically to top.
  127. # NVG_ALIGN_MIDDLE = 1<<4, /* original C++ signature */
  128. align_middle = enum.auto() # (= 1<<4) # Align text vertically to middle.
  129. # NVG_ALIGN_BOTTOM = 1<<5, /* original C++ signature */
  130. align_bottom = enum.auto() # (= 1<<5) # Align text vertically to bottom.
  131. # NVG_ALIGN_BASELINE = 1<<6, /* original C++ signature */
  132. align_baseline = enum.auto() # (= 1<<6) # Default, align text vertically to baseline.
  133. class BlendFactor(enum.IntEnum):
  134. # NVG_ZERO = 1<<0, /* original C++ signature */
  135. zero = enum.auto() # (= 1<<0)
  136. # NVG_ONE = 1<<1, /* original C++ signature */
  137. one = enum.auto() # (= 1<<1)
  138. # NVG_SRC_COLOR = 1<<2, /* original C++ signature */
  139. src_color = enum.auto() # (= 1<<2)
  140. # NVG_ONE_MINUS_SRC_COLOR = 1<<3, /* original C++ signature */
  141. one_minus_src_color = enum.auto() # (= 1<<3)
  142. # NVG_DST_COLOR = 1<<4, /* original C++ signature */
  143. dst_color = enum.auto() # (= 1<<4)
  144. # NVG_ONE_MINUS_DST_COLOR = 1<<5, /* original C++ signature */
  145. one_minus_dst_color = enum.auto() # (= 1<<5)
  146. # NVG_SRC_ALPHA = 1<<6, /* original C++ signature */
  147. src_alpha = enum.auto() # (= 1<<6)
  148. # NVG_ONE_MINUS_SRC_ALPHA = 1<<7, /* original C++ signature */
  149. one_minus_src_alpha = enum.auto() # (= 1<<7)
  150. # NVG_DST_ALPHA = 1<<8, /* original C++ signature */
  151. dst_alpha = enum.auto() # (= 1<<8)
  152. # NVG_ONE_MINUS_DST_ALPHA = 1<<9, /* original C++ signature */
  153. one_minus_dst_alpha = enum.auto() # (= 1<<9)
  154. # NVG_SRC_ALPHA_SATURATE = 1<<10, /* original C++ signature */
  155. # }
  156. src_alpha_saturate = enum.auto() # (= 1<<10)
  157. class CompositeOperation(enum.IntEnum):
  158. # NVG_SOURCE_OVER, /* original C++ signature */
  159. source_over = enum.auto() # (= 0)
  160. # NVG_SOURCE_IN, /* original C++ signature */
  161. source_in = enum.auto() # (= 1)
  162. # NVG_SOURCE_OUT, /* original C++ signature */
  163. source_out = enum.auto() # (= 2)
  164. # NVG_ATOP, /* original C++ signature */
  165. atop = enum.auto() # (= 3)
  166. # NVG_DESTINATION_OVER, /* original C++ signature */
  167. destination_over = enum.auto() # (= 4)
  168. # NVG_DESTINATION_IN, /* original C++ signature */
  169. destination_in = enum.auto() # (= 5)
  170. # NVG_DESTINATION_OUT, /* original C++ signature */
  171. destination_out = enum.auto() # (= 6)
  172. # NVG_DESTINATION_ATOP, /* original C++ signature */
  173. destination_atop = enum.auto() # (= 7)
  174. # NVG_LIGHTER, /* original C++ signature */
  175. lighter = enum.auto() # (= 8)
  176. # NVG_COPY, /* original C++ signature */
  177. copy = enum.auto() # (= 9)
  178. # NVG_XOR, /* original C++ signature */
  179. # }
  180. xor = enum.auto() # (= 10)
  181. class CompositeOperationState:
  182. # int srcRGB; /* original C++ signature */
  183. src_rgb: int
  184. # int dstRGB; /* original C++ signature */
  185. dst_rgb: int
  186. # int srcAlpha; /* original C++ signature */
  187. src_alpha: int
  188. # int dstAlpha; /* original C++ signature */
  189. dst_alpha: int
  190. # NVGcompositeOperationState(int srcRGB = int(), int dstRGB = int(), int srcAlpha = int(), int dstAlpha = int()); /* original C++ signature */
  191. def __init__(
  192. self,
  193. src_rgb: int = int(),
  194. dst_rgb: int = int(),
  195. src_alpha: int = int(),
  196. dst_alpha: int = int()
  197. ) -> None:
  198. """Auto-generated default constructor with named params"""
  199. pass
  200. class GlyphPosition:
  201. # const char* str; /* original C++ signature */
  202. str: str # Position of the glyph in the input string. # (const)
  203. # float x; /* original C++ signature */
  204. x: float # The x-coordinate of the logical glyph position.
  205. # float minx, /* original C++ signature */
  206. minx: float # The bounds of the glyph shape.
  207. # maxx; /* original C++ signature */
  208. maxx: float # The bounds of the glyph shape.
  209. # NVGglyphPosition(float x = float(), float minx = float(), float maxx = float()); /* original C++ signature */
  210. def __init__(
  211. self,
  212. x: float = float(),
  213. minx: float = float(),
  214. maxx: float = float()
  215. ) -> None:
  216. """Auto-generated default constructor with named params"""
  217. pass
  218. class TextRow:
  219. # const char* start; /* original C++ signature */
  220. start: str # Pointer to the input text where the row starts. # (const)
  221. # const char* end; /* original C++ signature */
  222. end: str # Pointer to the input text where the row ends (one past the last character). # (const)
  223. # const char* next; /* original C++ signature */
  224. next: str # Pointer to the beginning of the next row. # (const)
  225. # float width; /* original C++ signature */
  226. width: float # Logical width of the row.
  227. # float minx, /* original C++ signature */
  228. minx: float # Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
  229. # maxx; /* original C++ signature */
  230. maxx: float # Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
  231. # NVGtextRow(float width = float(), float minx = float(), float maxx = float()); /* original C++ signature */
  232. def __init__(
  233. self,
  234. width: float = float(),
  235. minx: float = float(),
  236. maxx: float = float()
  237. ) -> None:
  238. """Auto-generated default constructor with named params"""
  239. pass
  240. class ImageFlags(enum.IntEnum):
  241. # NVG_IMAGE_GENERATE_MIPMAPS = 1<<0, /* original C++ signature */
  242. image_generate_mipmaps = enum.auto() # (= 1<<0) # Generate mipmaps during creation of the image.
  243. # NVG_IMAGE_REPEATX = 1<<1, /* original C++ signature */
  244. image_repeatx = enum.auto() # (= 1<<1) # Repeat image in X direction.
  245. # NVG_IMAGE_REPEATY = 1<<2, /* original C++ signature */
  246. image_repeaty = enum.auto() # (= 1<<2) # Repeat image in Y direction.
  247. # NVG_IMAGE_FLIPY = 1<<3, /* original C++ signature */
  248. image_flipy = enum.auto() # (= 1<<3) # Flips (inverses) image in Y direction when rendered.
  249. # NVG_IMAGE_PREMULTIPLIED = 1<<4, /* original C++ signature */
  250. image_premultiplied = enum.auto() # (= 1<<4) # Image data has premultiplied alpha.
  251. # NVG_IMAGE_NEAREST = 1<<5, /* original C++ signature */
  252. image_nearest = enum.auto() # (= 1<<5) # Image interpolation is Nearest instead Linear
  253. # void nvgBeginFrame(NVGcontext* ctx, float windowWidth, float windowHeight, float devicePixelRatio); /* original C++ signature */
  254. def begin_frame(
  255. ctx: Context,
  256. window_width: float,
  257. window_height: float,
  258. device_pixel_ratio: float
  259. ) -> None:
  260. """ Begin drawing a new frame
  261. Calls to nanovg drawing API should be wrapped in nvgBeginFrame() & nvgEndFrame()
  262. nvgBeginFrame() defines the size of the window to render to in relation currently
  263. set viewport (i.e. glViewport on GL backends). Device pixel ration allows to
  264. control the rendering on Hi-DPI devices.
  265. For example, GLFW returns two dimension for an opened window: window size and
  266. frame buffer size. In that case you would set windowWidth/Height to the window size
  267. devicePixelRatio to: frameBufferWidth / windowWidth.
  268. """
  269. pass
  270. # void nvgCancelFrame(NVGcontext* ctx); /* original C++ signature */
  271. def cancel_frame(ctx: Context) -> None:
  272. """ Cancels drawing the current frame."""
  273. pass
  274. # void nvgEndFrame(NVGcontext* ctx); /* original C++ signature */
  275. def end_frame(ctx: Context) -> None:
  276. """ Ends drawing flushing remaining render state."""
  277. pass
  278. #
  279. # Composite operation
  280. #
  281. # The composite operations in NanoVG are modeled after HTML Canvas API, and
  282. # the blend func is based on OpenGL (see corresponding manuals for more info).
  283. # The colors in the blending state have premultiplied alpha.
  284. # void nvgGlobalCompositeOperation(NVGcontext* ctx, int op); /* original C++ signature */
  285. def global_composite_operation(ctx: Context, op: int) -> None:
  286. """ Sets the composite operation. The op parameter should be one of NVGcompositeOperation."""
  287. pass
  288. # void nvgGlobalCompositeBlendFunc(NVGcontext* ctx, int sfactor, int dfactor); /* original C++ signature */
  289. def global_composite_blend_func(ctx: Context, sfactor: int, dfactor: int) -> None:
  290. """ Sets the composite operation with custom pixel arithmetic. The parameters should be one of NVGblendFactor."""
  291. pass
  292. # void nvgGlobalCompositeBlendFuncSeparate(NVGcontext* ctx, int srcRGB, int dstRGB, int srcAlpha, int dstAlpha); /* original C++ signature */
  293. def global_composite_blend_func_separate(
  294. ctx: Context,
  295. src_rgb: int,
  296. dst_rgb: int,
  297. src_alpha: int,
  298. dst_alpha: int
  299. ) -> None:
  300. """ Sets the composite operation with custom pixel arithmetic for RGB and alpha components separately. The parameters should be one of NVGblendFactor."""
  301. pass
  302. #
  303. # Color utils
  304. #
  305. # Colors in NanoVG are stored as unsigned ints in ABGR format.
  306. # NVGcolor nvgRGB(unsigned char r, unsigned char g, unsigned char b); /* original C++ signature */
  307. def rgb(r: UChar, g: UChar, b: UChar) -> Color:
  308. """ Returns a color value from red, green, blue values. Alpha will be set to 255 (1.0)."""
  309. pass
  310. # NVGcolor nvgRGBf(float r, float g, float b); /* original C++ signature */
  311. def rgb_f(r: float, g: float, b: float) -> Color:
  312. """ Returns a color value from red, green, blue values. Alpha will be set to 1.0."""
  313. pass
  314. # NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a); /* original C++ signature */
  315. def rgba(r: UChar, g: UChar, b: UChar, a: UChar) -> Color:
  316. """ Returns a color value from red, green, blue and alpha values."""
  317. pass
  318. # NVGcolor nvgRGBAf(float r, float g, float b, float a); /* original C++ signature */
  319. def rgba_f(r: float, g: float, b: float, a: float) -> Color:
  320. """ Returns a color value from red, green, blue and alpha values."""
  321. pass
  322. # NVGcolor nvgLerpRGBA(NVGcolor c0, NVGcolor c1, float u); /* original C++ signature */
  323. def lerp_rgba(c0: Color, c1: Color, u: float) -> Color:
  324. """ Linearly interpolates from color c0 to c1, and returns resulting color value."""
  325. pass
  326. # NVGcolor nvgTransRGBA(NVGcolor c0, unsigned char a); /* original C++ signature */
  327. def trans_rgba(c0: Color, a: UChar) -> Color:
  328. """ Sets transparency of a color value."""
  329. pass
  330. # NVGcolor nvgTransRGBAf(NVGcolor c0, float a); /* original C++ signature */
  331. def trans_rgb_af(c0: Color, a: float) -> Color:
  332. """ Sets transparency of a color value."""
  333. pass
  334. # NVGcolor nvgHSL(float h, float s, float l); /* original C++ signature */
  335. def hsl(h: float, s: float, l: float) -> Color:
  336. """ Returns color value specified by hue, saturation and lightness.
  337. HSL values are all in range [0..1], alpha will be set to 255.
  338. """
  339. pass
  340. # NVGcolor nvgHSLA(float h, float s, float l, unsigned char a); /* original C++ signature */
  341. def hsla(h: float, s: float, l: float, a: UChar) -> Color:
  342. """ Returns color value specified by hue, saturation and lightness and alpha.
  343. HSL values are all in range [0..1], alpha in range [0..255]
  344. """
  345. pass
  346. #
  347. # State Handling
  348. #
  349. # NanoVG contains state which represents how paths will be rendered.
  350. # The state contains transform, fill and stroke styles, text and font styles,
  351. # and scissor clipping.
  352. # void nvgSave(NVGcontext* ctx); /* original C++ signature */
  353. def save(ctx: Context) -> None:
  354. """ Pushes and saves the current render state into a state stack.
  355. A matching nvgRestore() must be used to restore the state.
  356. """
  357. pass
  358. # void nvgRestore(NVGcontext* ctx); /* original C++ signature */
  359. def restore(ctx: Context) -> None:
  360. """ Pops and restores current render state."""
  361. pass
  362. # void nvgReset(NVGcontext* ctx); /* original C++ signature */
  363. def reset(ctx: Context) -> None:
  364. """ Resets current render state to default values. Does not affect the render state stack."""
  365. pass
  366. #
  367. # Render styles
  368. #
  369. # Fill and stroke render style can be either a solid color or a paint which is a gradient or a pattern.
  370. # Solid color is simply defined as a color value, different kinds of paints can be created
  371. # using nvgLinearGradient(), nvgBoxGradient(), nvgRadialGradient() and nvgImagePattern().
  372. #
  373. # Current render style can be saved and restored using nvgSave() and nvgRestore().
  374. # void nvgShapeAntiAlias(NVGcontext* ctx, int enabled); /* original C++ signature */
  375. def shape_anti_alias(ctx: Context, enabled: int) -> None:
  376. """ Sets whether to draw antialias for nvgStroke() and nvgFill(). It's enabled by default."""
  377. pass
  378. # void nvgStrokeColor(NVGcontext* ctx, NVGcolor color); /* original C++ signature */
  379. def stroke_color(ctx: Context, color: Color) -> None:
  380. """ Sets current stroke style to a solid color."""
  381. pass
  382. # void nvgStrokePaint(NVGcontext* ctx, NVGpaint paint); /* original C++ signature */
  383. def stroke_paint(ctx: Context, paint: Paint) -> None:
  384. """ Sets current stroke style to a paint, which can be a one of the gradients or a pattern."""
  385. pass
  386. # void nvgFillColor(NVGcontext* ctx, NVGcolor color); /* original C++ signature */
  387. def fill_color(ctx: Context, color: Color) -> None:
  388. """ Sets current fill style to a solid color."""
  389. pass
  390. # void nvgFillPaint(NVGcontext* ctx, NVGpaint paint); /* original C++ signature */
  391. def fill_paint(ctx: Context, paint: Paint) -> None:
  392. """ Sets current fill style to a paint, which can be a one of the gradients or a pattern."""
  393. pass
  394. # void nvgMiterLimit(NVGcontext* ctx, float limit); /* original C++ signature */
  395. def miter_limit(ctx: Context, limit: float) -> None:
  396. """ Sets the miter limit of the stroke style.
  397. Miter limit controls when a sharp corner is beveled.
  398. """
  399. pass
  400. # void nvgStrokeWidth(NVGcontext* ctx, float size); /* original C++ signature */
  401. def stroke_width(ctx: Context, size: float) -> None:
  402. """ Sets the stroke width of the stroke style."""
  403. pass
  404. # void nvgLineCap(NVGcontext* ctx, int cap); /* original C++ signature */
  405. def line_cap(ctx: Context, cap: int) -> None:
  406. """ Sets how the end of the line (cap) is drawn,
  407. Can be one of: NVG_BUTT (default), NVG_ROUND, NVG_SQUARE.
  408. """
  409. pass
  410. # void nvgLineJoin(NVGcontext* ctx, int join); /* original C++ signature */
  411. def line_join(ctx: Context, join: int) -> None:
  412. """ Sets how sharp path corners are drawn.
  413. Can be one of NVG_MITER (default), NVG_ROUND, NVG_BEVEL.
  414. """
  415. pass
  416. # void nvgGlobalAlpha(NVGcontext* ctx, float alpha); /* original C++ signature */
  417. def global_alpha(ctx: Context, alpha: float) -> None:
  418. """ Sets the transparency applied to all rendered shapes.
  419. Already transparent paths will get proportionally more transparent as well.
  420. """
  421. pass
  422. #
  423. # Transforms
  424. #
  425. # The paths, gradients, patterns and scissor region are transformed by an transformation
  426. # matrix at the time when they are passed to the API.
  427. # The current transformation matrix is a affine matrix:
  428. # [sx kx tx]
  429. # [ky sy ty]
  430. # [ 0 0 1]
  431. # Where: sx,sy define scaling, kx,ky skewing, and tx,ty translation.
  432. # The last row is assumed to be 0,0,1 and is not stored.
  433. #
  434. # Apart from nvgResetTransform(), each transformation function first creates
  435. # specific transformation matrix and pre-multiplies the current transformation by it.
  436. #
  437. # Current coordinate system (transformation) can be saved and restored using nvgSave() and nvgRestore().
  438. # void nvgResetTransform(NVGcontext* ctx); /* original C++ signature */
  439. def reset_transform(ctx: Context) -> None:
  440. """ Resets current transform to a identity matrix."""
  441. pass
  442. # void nvgTransform(NVGcontext* ctx, float a, float b, float c, float d, float e, float f); /* original C++ signature */
  443. def transform(
  444. ctx: Context,
  445. a: float,
  446. b: float,
  447. c: float,
  448. d: float,
  449. e: float,
  450. f: float
  451. ) -> None:
  452. """ Premultiplies current coordinate system by specified matrix.
  453. The parameters are interpreted as matrix as follows:
  454. [a c e]
  455. [b d f]
  456. [0 0 1]
  457. """
  458. pass
  459. # void nvgTranslate(NVGcontext* ctx, float x, float y); /* original C++ signature */
  460. def translate(ctx: Context, x: float, y: float) -> None:
  461. """ Translates current coordinate system."""
  462. pass
  463. # void nvgRotate(NVGcontext* ctx, float angle); /* original C++ signature */
  464. def rotate(ctx: Context, angle: float) -> None:
  465. """ Rotates current coordinate system. Angle is specified in radians."""
  466. pass
  467. # void nvgSkewX(NVGcontext* ctx, float angle); /* original C++ signature */
  468. def skew_x(ctx: Context, angle: float) -> None:
  469. """ Skews the current coordinate system along X axis. Angle is specified in radians."""
  470. pass
  471. # void nvgSkewY(NVGcontext* ctx, float angle); /* original C++ signature */
  472. def skew_y(ctx: Context, angle: float) -> None:
  473. """ Skews the current coordinate system along Y axis. Angle is specified in radians."""
  474. pass
  475. # void nvgScale(NVGcontext* ctx, float x, float y); /* original C++ signature */
  476. def scale(ctx: Context, x: float, y: float) -> None:
  477. """ Scales the current coordinate system."""
  478. pass
  479. # void nvgCurrentTransform(NVGcontext* ctx, float* xform); /* original C++ signature */
  480. def current_transform(ctx: Context, xform: float) -> None:
  481. """ Stores the top part (a-f) of the current transformation matrix in to the specified buffer.
  482. [a c e]
  483. [b d f]
  484. [0 0 1]
  485. There should be space for 6 floats in the return buffer for the values a-f.
  486. """
  487. pass
  488. # The following functions can be used to make calculations on 2x3 transformation matrices.
  489. # A 2x3 matrix is represented as float[6].
  490. # void nvgTransformIdentity(float* dst); /* original C++ signature */
  491. def transform_identity(dst: float) -> None:
  492. """ Sets the transform to identity matrix."""
  493. pass
  494. # void nvgTransformTranslate(float* dst, float tx, float ty); /* original C++ signature */
  495. def transform_translate(dst: float, tx: float, ty: float) -> None:
  496. """ Sets the transform to translation matrix matrix."""
  497. pass
  498. # void nvgTransformScale(float* dst, float sx, float sy); /* original C++ signature */
  499. def transform_scale(dst: float, sx: float, sy: float) -> None:
  500. """ Sets the transform to scale matrix."""
  501. pass
  502. # void nvgTransformRotate(float* dst, float a); /* original C++ signature */
  503. def transform_rotate(dst: float, a: float) -> None:
  504. """ Sets the transform to rotate matrix. Angle is specified in radians."""
  505. pass
  506. # void nvgTransformSkewX(float* dst, float a); /* original C++ signature */
  507. def transform_skew_x(dst: float, a: float) -> None:
  508. """ Sets the transform to skew-x matrix. Angle is specified in radians."""
  509. pass
  510. # void nvgTransformSkewY(float* dst, float a); /* original C++ signature */
  511. def transform_skew_y(dst: float, a: float) -> None:
  512. """ Sets the transform to skew-y matrix. Angle is specified in radians."""
  513. pass
  514. # void nvgTransformMultiply(float* dst, const float* src); /* original C++ signature */
  515. def transform_multiply(dst: float, src: float) -> None:
  516. """ Sets the transform to the result of multiplication of two transforms, of A = A*B."""
  517. pass
  518. # void nvgTransformPremultiply(float* dst, const float* src); /* original C++ signature */
  519. def transform_premultiply(dst: float, src: float) -> None:
  520. """ Sets the transform to the result of multiplication of two transforms, of A = B*A."""
  521. pass
  522. # int nvgTransformInverse(float* dst, const float* src); /* original C++ signature */
  523. def transform_inverse(dst: float, src: float) -> int:
  524. """ Sets the destination to inverse of specified transform.
  525. Returns 1 if the inverse could be calculated, else 0.
  526. """
  527. pass
  528. # void nvgTransformPoint(float* dstx, float* dsty, const float* xform, float srcx, float srcy); /* original C++ signature */
  529. def transform_point(
  530. dstx: float,
  531. dsty: float,
  532. xform: float,
  533. srcx: float,
  534. srcy: float
  535. ) -> None:
  536. """ Transform a point by given transform."""
  537. pass
  538. # Converts degrees to radians and vice versa.
  539. # float nvgDegToRad(float deg); /* original C++ signature */
  540. def deg_to_rad(deg: float) -> float:
  541. pass
  542. # float nvgRadToDeg(float rad); /* original C++ signature */
  543. def rad_to_deg(rad: float) -> float:
  544. pass
  545. #
  546. # Images
  547. #
  548. # NanoVG allows you to load jpg, png, psd, tga, pic and gif files to be used for rendering.
  549. # In addition you can upload your own image. The image loading is provided by stb_image.
  550. # The parameter imageFlags is combination of flags defined in NVGimageFlags.
  551. # int nvgCreateImage(NVGcontext* ctx, const char* filename, int imageFlags); /* original C++ signature */
  552. def create_image(ctx: Context, filename: str, image_flags: int) -> int:
  553. """ Creates image by loading it from the disk from specified file name.
  554. Returns handle to the image.
  555. """
  556. pass
  557. # int nvgCreateImageMem(NVGcontext* ctx, int imageFlags, unsigned char* data, int ndata); /* original C++ signature */
  558. def create_image_mem(ctx: Context, image_flags: int, data: UChar, ndata: int) -> int:
  559. """ Creates image by loading it from the specified chunk of memory.
  560. Returns handle to the image.
  561. """
  562. pass
  563. # int nvgCreateImageRGBA(NVGcontext* ctx, int w, int h, int imageFlags, const unsigned char* data); /* original C++ signature */
  564. def create_image_rgba(
  565. ctx: Context,
  566. w: int,
  567. h: int,
  568. image_flags: int,
  569. data: UChar
  570. ) -> int:
  571. """ Creates image from specified image data.
  572. Returns handle to the image.
  573. """
  574. pass
  575. # void nvgUpdateImage(NVGcontext* ctx, int image, const unsigned char* data); /* original C++ signature */
  576. def update_image(ctx: Context, image: int, data: UChar) -> None:
  577. """ Updates image data specified by image handle."""
  578. pass
  579. # void nvgDeleteImage(NVGcontext* ctx, int image); /* original C++ signature */
  580. def delete_image(ctx: Context, image: int) -> None:
  581. """ Deletes created image."""
  582. pass
  583. #
  584. # Paints
  585. #
  586. # NanoVG supports four types of paints: linear gradient, box gradient, radial gradient and image pattern.
  587. # These can be used as paints for strokes and fills.
  588. # NVGpaint nvgLinearGradient(NVGcontext* ctx, float sx, float sy, float ex, float ey, /* original C++ signature */
  589. # NVGcolor icol, NVGcolor ocol);
  590. def linear_gradient(
  591. ctx: Context,
  592. sx: float,
  593. sy: float,
  594. ex: float,
  595. ey: float,
  596. icol: Color,
  597. ocol: Color
  598. ) -> Paint:
  599. """ Creates and returns a linear gradient. Parameters (sx,sy)-(ex,ey) specify the start and end coordinates
  600. of the linear gradient, icol specifies the start color and ocol the end color.
  601. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
  602. """
  603. pass
  604. # NVGpaint nvgBoxGradient(NVGcontext* ctx, float x, float y, float w, float h, /* original C++ signature */
  605. # float r, float f, NVGcolor icol, NVGcolor ocol);
  606. def box_gradient(
  607. ctx: Context,
  608. x: float,
  609. y: float,
  610. w: float,
  611. h: float,
  612. r: float,
  613. f: float,
  614. icol: Color,
  615. ocol: Color
  616. ) -> Paint:
  617. """ Creates and returns a box gradient. Box gradient is a feathered rounded rectangle, it is useful for rendering
  618. drop shadows or highlights for boxes. Parameters (x,y) define the top-left corner of the rectangle,
  619. (w,h) define the size of the rectangle, r defines the corner radius, and f feather. Feather defines how blurry
  620. the border of the rectangle is. Parameter icol specifies the inner color and ocol the outer color of the gradient.
  621. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
  622. """
  623. pass
  624. # NVGpaint nvgRadialGradient(NVGcontext* ctx, float cx, float cy, float inr, float outr, /* original C++ signature */
  625. # NVGcolor icol, NVGcolor ocol);
  626. def radial_gradient(
  627. ctx: Context,
  628. cx: float,
  629. cy: float,
  630. inr: float,
  631. outr: float,
  632. icol: Color,
  633. ocol: Color
  634. ) -> Paint:
  635. """ Creates and returns a radial gradient. Parameters (cx,cy) specify the center, inr and outr specify
  636. the inner and outer radius of the gradient, icol specifies the start color and ocol the end color.
  637. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
  638. """
  639. pass
  640. # NVGpaint nvgImagePattern(NVGcontext* ctx, float ox, float oy, float ex, float ey, /* original C++ signature */
  641. # float angle, int image, float alpha);
  642. def image_pattern(
  643. ctx: Context,
  644. ox: float,
  645. oy: float,
  646. ex: float,
  647. ey: float,
  648. angle: float,
  649. image: int,
  650. alpha: float
  651. ) -> Paint:
  652. """ Creates and returns an image pattern. Parameters (ox,oy) specify the left-top location of the image pattern,
  653. (ex,ey) the size of one image, angle rotation around the top-left corner, image is handle to the image to render.
  654. The gradient is transformed by the current transform when it is passed to nvgFillPaint() or nvgStrokePaint().
  655. """
  656. pass
  657. #
  658. # Scissoring
  659. #
  660. # Scissoring allows you to clip the rendering into a rectangle. This is useful for various
  661. # user interface cases like rendering a text edit or a timeline.
  662. # void nvgScissor(NVGcontext* ctx, float x, float y, float w, float h); /* original C++ signature */
  663. def scissor(ctx: Context, x: float, y: float, w: float, h: float) -> None:
  664. """ Sets the current scissor rectangle.
  665. The scissor rectangle is transformed by the current transform.
  666. """
  667. pass
  668. # void nvgIntersectScissor(NVGcontext* ctx, float x, float y, float w, float h); /* original C++ signature */
  669. def intersect_scissor(ctx: Context, x: float, y: float, w: float, h: float) -> None:
  670. """ Intersects current scissor rectangle with the specified rectangle.
  671. The scissor rectangle is transformed by the current transform.
  672. Note: in case the rotation of previous scissor rect differs from
  673. the current one, the intersection will be done between the specified
  674. rectangle and the previous scissor rectangle transformed in the current
  675. transform space. The resulting shape is always rectangle.
  676. """
  677. pass
  678. # void nvgResetScissor(NVGcontext* ctx); /* original C++ signature */
  679. def reset_scissor(ctx: Context) -> None:
  680. """ Reset and disables scissoring."""
  681. pass
  682. #
  683. # Paths
  684. #
  685. # Drawing a new shape starts with nvgBeginPath(), it clears all the currently defined paths.
  686. # Then you define one or more paths and sub-paths which describe the shape. The are functions
  687. # to draw common shapes like rectangles and circles, and lower level step-by-step functions,
  688. # which allow to define a path curve by curve.
  689. #
  690. # NanoVG uses even-odd fill rule to draw the shapes. Solid shapes should have counter clockwise
  691. # winding and holes should have counter clockwise order. To specify winding of a path you can
  692. # call nvgPathWinding(). This is useful especially for the common shapes, which are drawn CCW.
  693. #
  694. # Finally you can fill the path using current fill style by calling nvgFill(), and stroke it
  695. # with current stroke style by calling nvgStroke().
  696. #
  697. # The curve segments and sub-paths are transformed by the current transform.
  698. # void nvgBeginPath(NVGcontext* ctx); /* original C++ signature */
  699. def begin_path(ctx: Context) -> None:
  700. """ Clears the current path and sub-paths."""
  701. pass
  702. # void nvgMoveTo(NVGcontext* ctx, float x, float y); /* original C++ signature */
  703. def move_to(ctx: Context, x: float, y: float) -> None:
  704. """ Starts new sub-path with specified point as first point."""
  705. pass
  706. # void nvgLineTo(NVGcontext* ctx, float x, float y); /* original C++ signature */
  707. def line_to(ctx: Context, x: float, y: float) -> None:
  708. """ Adds line segment from the last point in the path to the specified point."""
  709. pass
  710. # void nvgBezierTo(NVGcontext* ctx, float c1x, float c1y, float c2x, float c2y, float x, float y); /* original C++ signature */
  711. def bezier_to(
  712. ctx: Context,
  713. c1x: float,
  714. c1y: float,
  715. c2x: float,
  716. c2y: float,
  717. x: float,
  718. y: float
  719. ) -> None:
  720. """ Adds cubic bezier segment from last point in the path via two control points to the specified point."""
  721. pass
  722. # void nvgQuadTo(NVGcontext* ctx, float cx, float cy, float x, float y); /* original C++ signature */
  723. def quad_to(ctx: Context, cx: float, cy: float, x: float, y: float) -> None:
  724. """ Adds quadratic bezier segment from last point in the path via a control point to the specified point."""
  725. pass
  726. # void nvgArcTo(NVGcontext* ctx, float x1, float y1, float x2, float y2, float radius); /* original C++ signature */
  727. def arc_to(
  728. ctx: Context,
  729. x1: float,
  730. y1: float,
  731. x2: float,
  732. y2: float,
  733. radius: float
  734. ) -> None:
  735. """ Adds an arc segment at the corner defined by the last path point, and two specified points."""
  736. pass
  737. # void nvgClosePath(NVGcontext* ctx); /* original C++ signature */
  738. def close_path(ctx: Context) -> None:
  739. """ Closes current sub-path with a line segment."""
  740. pass
  741. # void nvgPathWinding(NVGcontext* ctx, int dir); /* original C++ signature */
  742. def path_winding(ctx: Context, dir: int) -> None:
  743. """ Sets the current sub-path winding, see NVGwinding and NVGsolidity."""
  744. pass
  745. # void nvgArc(NVGcontext* ctx, float cx, float cy, float r, float a0, float a1, int dir); /* original C++ signature */
  746. def arc(
  747. ctx: Context,
  748. cx: float,
  749. cy: float,
  750. r: float,
  751. a0: float,
  752. a1: float,
  753. dir: int
  754. ) -> None:
  755. """ Creates new circle arc shaped sub-path. The arc center is at cx,cy, the arc radius is r,
  756. and the arc is drawn from angle a0 to a1, and swept in direction dir (NVG_CCW, or NVG_CW).
  757. Angles are specified in radians.
  758. """
  759. pass
  760. # void nvgRect(NVGcontext* ctx, float x, float y, float w, float h); /* original C++ signature */
  761. def rect(ctx: Context, x: float, y: float, w: float, h: float) -> None:
  762. """ Creates new rectangle shaped sub-path."""
  763. pass
  764. # void nvgRoundedRect(NVGcontext* ctx, float x, float y, float w, float h, float r); /* original C++ signature */
  765. def rounded_rect(
  766. ctx: Context,
  767. x: float,
  768. y: float,
  769. w: float,
  770. h: float,
  771. r: float
  772. ) -> None:
  773. """ Creates new rounded rectangle shaped sub-path."""
  774. pass
  775. # void nvgRoundedRectVarying(NVGcontext* ctx, float x, float y, float w, float h, float radTopLeft, float radTopRight, float radBottomRight, float radBottomLeft); /* original C++ signature */
  776. def rounded_rect_varying(
  777. ctx: Context,
  778. x: float,
  779. y: float,
  780. w: float,
  781. h: float,
  782. rad_top_left: float,
  783. rad_top_right: float,
  784. rad_bottom_right: float,
  785. rad_bottom_left: float
  786. ) -> None:
  787. """ Creates new rounded rectangle shaped sub-path with varying radii for each corner."""
  788. pass
  789. # void nvgEllipse(NVGcontext* ctx, float cx, float cy, float rx, float ry); /* original C++ signature */
  790. def ellipse(ctx: Context, cx: float, cy: float, rx: float, ry: float) -> None:
  791. """ Creates new ellipse shaped sub-path."""
  792. pass
  793. # void nvgCircle(NVGcontext* ctx, float cx, float cy, float r); /* original C++ signature */
  794. def circle(ctx: Context, cx: float, cy: float, r: float) -> None:
  795. """ Creates new circle shaped sub-path."""
  796. pass
  797. # void nvgFill(NVGcontext* ctx); /* original C++ signature */
  798. def fill(ctx: Context) -> None:
  799. """ Fills the current path with current fill style."""
  800. pass
  801. # void nvgStroke(NVGcontext* ctx); /* original C++ signature */
  802. def stroke(ctx: Context) -> None:
  803. """ Fills the current path with current stroke style."""
  804. pass
  805. #
  806. # Text
  807. #
  808. # NanoVG allows you to load .ttf files and use the font to render text.
  809. #
  810. # The appearance of the text can be defined by setting the current text style
  811. # and by specifying the fill color. Common text and font settings such as
  812. # font size, letter spacing and text align are supported. Font blur allows you
  813. # to create simple text effects such as drop shadows.
  814. #
  815. # At render time the font face can be set based on the font handles or name.
  816. #
  817. # Font measure functions return values in local space, the calculations are
  818. # carried in the same resolution as the final rendering. This is done because
  819. # the text glyph positions are snapped to the nearest pixels sharp rendering.
  820. #
  821. # The local space means that values are not rotated or scale as per the current
  822. # transformation. For example if you set font size to 12, which would mean that
  823. # line height is 16, then regardless of the current scaling and rotation, the
  824. # returned line height is always 16. Some measures may vary because of the scaling
  825. # since aforementioned pixel snapping.
  826. #
  827. # While this may sound a little odd, the setup allows you to always render the
  828. # same way regardless of scaling. I.e. following works regardless of scaling:
  829. #
  830. # const char* txt = "Text me up.";
  831. # nvgTextBounds(vg, x,y, txt, None, bounds);
  832. # nvgBeginPath(vg);
  833. # nvgRect(vg, bounds[0],bounds[1], bounds[2]-bounds[0], bounds[3]-bounds[1]);
  834. # nvgFill(vg);
  835. #
  836. # Note: currently only solid color fill is supported for text.
  837. # int nvgCreateFont(NVGcontext* ctx, const char* name, const char* filename); /* original C++ signature */
  838. def create_font(ctx: Context, name: str, filename: str) -> int:
  839. """ Creates font by loading it from the disk from specified file name.
  840. Returns handle to the font.
  841. """
  842. pass
  843. # int nvgCreateFontAtIndex(NVGcontext* ctx, const char* name, const char* filename, const int fontIndex); /* original C++ signature */
  844. def create_font_at_index(
  845. ctx: Context,
  846. name: str,
  847. filename: str,
  848. font_index: int
  849. ) -> int:
  850. """ fontIndex specifies which font face to load from a .ttf/.ttc file."""
  851. pass
  852. # int nvgCreateFontMem(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData); /* original C++ signature */
  853. def create_font_mem(
  854. ctx: Context,
  855. name: str,
  856. data: UChar,
  857. ndata: int,
  858. free_data: int
  859. ) -> int:
  860. """ Creates font by loading it from the specified memory chunk.
  861. Returns handle to the font.
  862. """
  863. pass
  864. # int nvgCreateFontMemAtIndex(NVGcontext* ctx, const char* name, unsigned char* data, int ndata, int freeData, const int fontIndex); /* original C++ signature */
  865. def create_font_mem_at_index(
  866. ctx: Context,
  867. name: str,
  868. data: UChar,
  869. ndata: int,
  870. free_data: int,
  871. font_index: int
  872. ) -> int:
  873. """ fontIndex specifies which font face to load from a .ttf/.ttc file."""
  874. pass
  875. # int nvgFindFont(NVGcontext* ctx, const char* name); /* original C++ signature */
  876. def find_font(ctx: Context, name: str) -> int:
  877. """ Finds a loaded font of specified name, and returns handle to it, or -1 if the font is not found."""
  878. pass
  879. # int nvgAddFallbackFontId(NVGcontext* ctx, int baseFont, int fallbackFont); /* original C++ signature */
  880. def add_fallback_font_id(ctx: Context, base_font: int, fallback_font: int) -> int:
  881. """ Adds a fallback font by handle."""
  882. pass
  883. # int nvgAddFallbackFont(NVGcontext* ctx, const char* baseFont, const char* fallbackFont); /* original C++ signature */
  884. def add_fallback_font(ctx: Context, base_font: str, fallback_font: str) -> int:
  885. """ Adds a fallback font by name."""
  886. pass
  887. # void nvgResetFallbackFontsId(NVGcontext* ctx, int baseFont); /* original C++ signature */
  888. def reset_fallback_fonts_id(ctx: Context, base_font: int) -> None:
  889. """ Resets fallback fonts by handle."""
  890. pass
  891. # void nvgResetFallbackFonts(NVGcontext* ctx, const char* baseFont); /* original C++ signature */
  892. def reset_fallback_fonts(ctx: Context, base_font: str) -> None:
  893. """ Resets fallback fonts by name."""
  894. pass
  895. # void nvgFontSize(NVGcontext* ctx, float size); /* original C++ signature */
  896. def font_size(ctx: Context, size: float) -> None:
  897. """ Sets the font size of current text style."""
  898. pass
  899. # void nvgFontBlur(NVGcontext* ctx, float blur); /* original C++ signature */
  900. def font_blur(ctx: Context, blur: float) -> None:
  901. """ Sets the blur of current text style."""
  902. pass
  903. # void nvgFontFaceId(NVGcontext* ctx, int font); /* original C++ signature */
  904. def font_face_id(ctx: Context, font: int) -> None:
  905. """ Sets the font face based on specified id of current text style."""
  906. pass
  907. # void nvgFontFace(NVGcontext* ctx, const char* font); /* original C++ signature */
  908. def font_face(ctx: Context, font: str) -> None:
  909. """ Sets the font face based on specified name of current text style."""
  910. pass
  911. class Texture(enum.IntEnum):
  912. """
  913. Internal Render API
  914. """
  915. # NVG_TEXTURE_ALPHA = 0x01, /* original C++ signature */
  916. texture_alpha = enum.auto() # (= 0x01)
  917. # NVG_TEXTURE_RGBA = 0x02, /* original C++ signature */
  918. # }
  919. texture_rgba = enum.auto() # (= 0x02)
  920. class Scissor:
  921. # float xform[6]; /* original C++ signature */
  922. xform: np.ndarray # ndarray[type=float, size=6]
  923. # float extent[2]; /* original C++ signature */
  924. extent: np.ndarray # ndarray[type=float, size=2]
  925. # NVGscissor(); /* original C++ signature */
  926. def __init__(self) -> None:
  927. """Auto-generated default constructor"""
  928. pass
  929. class Vertex:
  930. # float x, /* original C++ signature */
  931. x: float
  932. # y, /* original C++ signature */
  933. y: float
  934. # u, /* original C++ signature */
  935. u: float
  936. # v; /* original C++ signature */
  937. v: float
  938. # NVGvertex(float x = float(), float y = float(), float u = float(), float v = float()); /* original C++ signature */
  939. def __init__(
  940. self,
  941. x: float = float(),
  942. y: float = float(),
  943. u: float = float(),
  944. v: float = float()
  945. ) -> None:
  946. """Auto-generated default constructor with named params"""
  947. pass
  948. class Path:
  949. # int first; /* original C++ signature */
  950. first: int
  951. # int count; /* original C++ signature */
  952. count: int
  953. # unsigned char closed; /* original C++ signature */
  954. closed: UChar
  955. # int nbevel; /* original C++ signature */
  956. nbevel: int
  957. # NVGvertex* fill; /* original C++ signature */
  958. fill: Vertex
  959. # int nfill; /* original C++ signature */
  960. nfill: int
  961. # NVGvertex* stroke; /* original C++ signature */
  962. stroke: Vertex
  963. # int nstroke; /* original C++ signature */
  964. nstroke: int
  965. # int winding; /* original C++ signature */
  966. winding: int
  967. # int convex; /* original C++ signature */
  968. convex: int
  969. # NVGpath(int first = int(), int count = int(), int nbevel = int(), int nfill = int(), int nstroke = int(), int winding = int(), int convex = int()); /* original C++ signature */
  970. def __init__(
  971. self,
  972. first: int = int(),
  973. count: int = int(),
  974. nbevel: int = int(),
  975. nfill: int = int(),
  976. nstroke: int = int(),
  977. winding: int = int(),
  978. convex: int = int()
  979. ) -> None:
  980. """Auto-generated default constructor with named params"""
  981. pass
  982. class Params:
  983. # void* userPtr; /* original C++ signature */
  984. user_ptr: Any
  985. # int edgeAntiAlias; /* original C++ signature */
  986. edge_anti_alias: int
  987. # NVGparams(int edgeAntiAlias = int()); /* original C++ signature */
  988. def __init__(self, edge_anti_alias: int = int()) -> None:
  989. """Auto-generated default constructor with named params"""
  990. pass
  991. # Constructor and destructor, called by the render back-end.
  992. # NVGcontext* nvgCreateInternal(NVGparams* params); /* original C++ signature */
  993. def create_internal(params: Params) -> Context:
  994. pass
  995. # void nvgDeleteInternal(NVGcontext* ctx); /* original C++ signature */
  996. def delete_internal(ctx: Context) -> None:
  997. pass
  998. # NVGparams* nvgInternalParams(NVGcontext* ctx); /* original C++ signature */
  999. def internal_params(ctx: Context) -> Params:
  1000. pass
  1001. # void nvgDebugDumpPathCache(NVGcontext* ctx); /* original C++ signature */
  1002. def debug_dump_path_cache(ctx: Context) -> None:
  1003. """ Debug function to dump cached path data."""
  1004. pass
  1005. # #ifdef __cplusplus
  1006. #
  1007. # #endif
  1008. #
  1009. # #endif
  1010. #################### </generated_from:nanovg.h> ####################
  1011. #################### <generated_from:nvg_imgui.h> ####################
  1012. # #ifdef IMGUI_BUNDLE_WITH_NANOVG
  1013. #
  1014. # #endif
  1015. # <submodule nvg_imgui>
  1016. class nvg_imgui: # Proxy class that introduces typings for the *submodule* nvg_imgui
  1017. pass # (This corresponds to a C++ namespace. All methods are static!)
  1018. #/////////////////////////////////////////////////////////////////////////
  1019. #
  1020. # NanoVG context creation/deletion
  1021. #
  1022. #///////////////////////////////////////////////////////////////////////
  1023. class NvgCreateFlags(enum.IntEnum):
  1024. """ Combination of NVGcreateFlags in nanovg_gl.h + nanovg_mtl.h"""
  1025. # NVG_ANTIALIAS = 1<<0, /* original C++ signature */
  1026. # Flag indicating if geometry based antialiasing is used (may not be needed when using MSAA).
  1027. antialias = enum.auto() # (= 1<<0)
  1028. # NVG_STENCIL_STROKES = 1<<1, /* original C++ signature */
  1029. # Flag indicating if strokes should be drawn using stencil buffer. The rendering will be a little
  1030. # slower, but path overlaps (i.e. self-intersecting or sharp turns) will be drawn just once.
  1031. stencil_strokes = enum.auto() # (= 1<<1)
  1032. # NVG_DEBUG = 1<<2, /* original C++ signature */
  1033. # Flag indicating that additional debug checks are done.
  1034. debug = enum.auto() # (= 1<<2)
  1035. # NVG_DOUBLE_BUFFER = 1 << 12, /* original C++ signature */
  1036. # Flag indicating if double buffering scheme is used (Metal only!)
  1037. double_buffer = enum.auto() # (= 1 << 12)
  1038. # NVG_TRIPLE_BUFFER = 1 << 13, /* original C++ signature */
  1039. # }
  1040. # Flag indicating if triple buffering scheme is used (Metal only!)
  1041. triple_buffer = enum.auto() # (= 1 << 13)
  1042. # If using HelloImGui, you can use this function to create a NanoVG context
  1043. # (it will select the correct function depending on the rendering backend)
  1044. # NVGcontext* CreateNvgContext_HelloImGui(int flags = 0); /* original C++ signature */
  1045. @staticmethod
  1046. def create_nvg_context_hello_imgui(flags: int = 0) -> Context:
  1047. pass
  1048. # void DeleteNvgContext_HelloImGui(NVGcontext* vg); /* original C++ signature */
  1049. @staticmethod
  1050. def delete_nvg_context_hello_imgui(vg: Context) -> None:
  1051. pass
  1052. #/////////////////////////////////////////////////////////////////////////
  1053. #
  1054. # NanoVG framebuffer
  1055. #
  1056. #///////////////////////////////////////////////////////////////////////
  1057. class NvgFramebuffer:
  1058. """ NvgFramebuffer: a framebuffer that can be used by NanoVG + ImGui
  1059. Internally stored inside the renderer backend (e.g. OpenGL)
  1060. Note: this class can be instantiated only after a valid renderer backend (OpenGL) has been created
  1061. """
  1062. # NVGcontext *vg = nullptr; /* original C++ signature */
  1063. vg: Optional[Context] = None
  1064. # int Width = 0, /* original C++ signature */
  1065. width: int = 0
  1066. # Height = 0; /* original C++ signature */
  1067. height: int = 0
  1068. # int NvgImageFlags = 0; /* original C++ signature */
  1069. nvg_image_flags: int = 0
  1070. # ImTextureID TextureId = {}; /* original C++ signature */
  1071. texture_id: ImTextureID = ImTextureID()
  1072. # Warning: this constructor can be called only after a valid renderer backend (OpenGL) has been created
  1073. # (will call Init())
  1074. # NvgFramebuffer( /* original C++ signature */
  1075. # NVGcontext *vg,
  1076. # int width, int height,
  1077. # int nvgImageFlags
  1078. # );
  1079. def __init__(self, vg: Context, width: int, height: int, nvg_image_flags: int) -> None:
  1080. """ See NVGimageFlags"""
  1081. pass
  1082. # void Bind(); /* original C++ signature */
  1083. def bind(self) -> None:
  1084. """ Make the framebuffer the current render target"""
  1085. pass
  1086. # void Unbind(); /* original C++ signature */
  1087. def unbind(self) -> None:
  1088. """ Restore the previous render target"""
  1089. pass
  1090. #/////////////////////////////////////////////////////////////////////////
  1091. #
  1092. # NanoVG rendering utilities
  1093. # (render NanoVG to either ImGui background or to a framebuffer)
  1094. #
  1095. #///////////////////////////////////////////////////////////////////////
  1096. # void RenderNvgToBackground( /* original C++ signature */
  1097. # NVGcontext* vg,
  1098. # NvgDrawingFunction nvgDrawingFunction,
  1099. # ImVec4 clearColor = ImVec4(0.f, 0.f, 0.f, 1.f)
  1100. # );
  1101. @staticmethod
  1102. def render_nvg_to_background(
  1103. vg: Context,
  1104. nvg_drawing_function: NvgDrawingFunction,
  1105. clear_color: Optional[ImVec4Like] = None
  1106. ) -> None:
  1107. """ Render the given drawing function to the background of the application
  1108. (i.e. the main viewport)
  1109. If clearColor.w > 0., the background will be cleared with this color
  1110. Python bindings defaults:
  1111. If clearColor is None, then its default value will be: ImVec4(0., 0., 0., 1.)
  1112. """
  1113. pass
  1114. # void RenderNvgToFrameBuffer( /* original C++ signature */
  1115. # NVGcontext* vg,
  1116. # NvgFramebuffer& texture,
  1117. # NvgDrawingFunction drawFunc,
  1118. # ImVec4 clearColor = ImVec4(0.f, 0.f, 0.f, 1.f)
  1119. # );
  1120. @staticmethod
  1121. def render_nvg_to_frame_buffer(
  1122. vg: Context,
  1123. texture: NvgFramebuffer,
  1124. draw_func: NvgDrawingFunction,
  1125. clear_color: Optional[ImVec4Like] = None
  1126. ) -> None:
  1127. """ Render the given drawing function to the given framebuffer
  1128. If clearColor.w > 0., the background will be cleared with this color
  1129. Python bindings defaults:
  1130. If clearColor is None, then its default value will be: ImVec4(0., 0., 0., 1.)
  1131. """
  1132. pass
  1133. # </submodule nvg_imgui>
  1134. #################### </generated_from:nvg_imgui.h> ####################
  1135. #################### <generated_from:nvg_cpp_text.h> ####################
  1136. # C++ Wrappers to NanoVG text functions, to simplify python bindings
  1137. # float nvgcpp_Text(NVGcontext* ctx, float x, float y, const std::string& text); /* original C++ signature */
  1138. def text(ctx: Context, x: float, y: float, text: str) -> float:
  1139. """ Draws text string at specified location. If end is specified only the sub-string up to the end is drawn."""
  1140. pass
  1141. # void nvgcpp_TextBox(NVGcontext* ctx, float x, float y, float breakRowWidth, const std::string& text); /* original C++ signature */
  1142. def text_box(
  1143. ctx: Context,
  1144. x: float,
  1145. y: float,
  1146. break_row_width: float,
  1147. text: str
  1148. ) -> None:
  1149. """ Draws multi-line text string at specified location wrapped at the specified width. If end is specified only the sub-string up to the end is drawn.
  1150. White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
  1151. Words longer than the max width are split at nearest character (i.e. no hyphenation).
  1152. """
  1153. pass
  1154. # std::tuple<Bounds, float> nvgcpp_TextBounds(NVGcontext* ctx, float x, float y, const std::string& text); /* original C++ signature */
  1155. def text_bounds(ctx: Context, x: float, y: float, text: str) -> Tuple[Bounds, float]:
  1156. """ Measures the specified text string. Parameter bounds should be a pointer to float[4],
  1157. if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
  1158. Returns the bounds + the horizontal advance of the measured text (i.e. where the next character should drawn)
  1159. Measured values are returned in local coordinate space.
  1160. """
  1161. pass
  1162. # Bounds nvgcpp_TextBoxBounds(NVGcontext* ctx, float x, float y, float breakRowWidth, const std::string& text); /* original C++ signature */
  1163. def text_box_bounds(
  1164. ctx: Context,
  1165. x: float,
  1166. y: float,
  1167. break_row_width: float,
  1168. text: str
  1169. ) -> Bounds:
  1170. """ Measures the specified multi-text string. Parameter bounds should be a pointer to float[4],
  1171. if the bounding box of the text should be returned. The bounds value are [xmin,ymin, xmax,ymax]
  1172. Measured values are returned in local coordinate space.
  1173. """
  1174. pass
  1175. # std::vector<NVGglyphPosition> nvgcpp_TextGlyphPositions(NVGcontext* ctx, float x, float y, const std::string& text); /* original C++ signature */
  1176. def text_glyph_positions(
  1177. ctx: Context,
  1178. x: float,
  1179. y: float,
  1180. text: str
  1181. ) -> List[GlyphPosition]:
  1182. """ Calculates the glyph x positions of the specified text. If end is specified only the sub-string will be used.
  1183. Measured values are returned in local coordinate space.
  1184. """
  1185. pass
  1186. class TextMetricsData:
  1187. # float ascender; /* original C++ signature */
  1188. ascender: float
  1189. # float descender; /* original C++ signature */
  1190. descender: float
  1191. # float lineh; /* original C++ signature */
  1192. lineh: float
  1193. # TextMetricsData(float ascender = float(), float descender = float(), float lineh = float()); /* original C++ signature */
  1194. def __init__(
  1195. self,
  1196. ascender: float = float(),
  1197. descender: float = float(),
  1198. lineh: float = float()
  1199. ) -> None:
  1200. """Auto-generated default constructor with named params"""
  1201. pass
  1202. # TextMetricsData nvgcpp_TextMetrics(NVGcontext* ctx); /* original C++ signature */
  1203. def text_metrics(ctx: Context) -> TextMetricsData:
  1204. """ Returns the vertical metrics based on the current text style.
  1205. Measured values are returned in local coordinate space.
  1206. """
  1207. pass
  1208. class TextRowSimple:
  1209. # std::string row_text; /* original C++ signature */
  1210. row_text: str
  1211. # float width; /* original C++ signature */
  1212. width: float # Logical width of the row.
  1213. # float minx, /* original C++ signature */
  1214. minx: float # Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
  1215. # maxx; /* original C++ signature */
  1216. maxx: float # Actual bounds of the row. Logical with and bounds can differ because of kerning and some parts over extending.
  1217. # NVGtextRowSimple(std::string row_text = std::string(), float width = float(), float minx = float(), float maxx = float()); /* original C++ signature */
  1218. def __init__(
  1219. self,
  1220. row_text: str = "",
  1221. width: float = float(),
  1222. minx: float = float(),
  1223. maxx: float = float()
  1224. ) -> None:
  1225. """Auto-generated default constructor with named params"""
  1226. pass
  1227. # std::vector<NVGtextRowSimple> nvgcpp_TextBreakLines(NVGcontext* ctx, const std::string& text, float breakRowWidth); /* original C++ signature */
  1228. def text_break_lines(
  1229. ctx: Context,
  1230. text: str,
  1231. break_row_width: float
  1232. ) -> List[TextRowSimple]:
  1233. """ Breaks the specified text into lines. If end is specified only the sub-string will be used.
  1234. White space is stripped at the beginning of the rows, the text is split at word boundaries or when new-line characters are encountered.
  1235. Words longer than the max width are split at nearest character (i.e. no hyphenation).
  1236. """
  1237. pass
  1238. # void nvgcpp_TextAlign(NVGcontext* ctx, int align); /* original C++ signature */
  1239. def text_align(ctx: Context, align: int) -> None:
  1240. """ Sets the text align of current text style, see NVGalign for options."""
  1241. pass
  1242. # void nvgcpp_TextLineHeight(NVGcontext* ctx, float lineHeight); /* original C++ signature */
  1243. def text_line_height(ctx: Context, line_height: float) -> None:
  1244. """ Sets the proportional line height of current text style. The line height is specified as multiple of font size."""
  1245. pass
  1246. # std::tuple<int, int> nvgcpp_ImageSize(NVGcontext* ctx, int image); /* original C++ signature */
  1247. def image_size(ctx: Context, image: int) -> Tuple[int, int]:
  1248. """ Returns the dimensions of a created image."""
  1249. pass
  1250. #################### </generated_from:nvg_cpp_text.h> ####################
  1251. # </litgen_stub> // Autogenerated code end!