WOWCube Docs logo
WOWCube Docs
Mission Control
Section Shortcuts
APIExamplesSourceWOWConnectChangelog
Filters
SDK and language defaults persist in cookies.
SDK version
Navigation Tree
Collapsed by default, focused on the active path.
Made byMcKay Seamons
GitHub
  1. Home
  2. Docs
  3. Source
  4. graphics.inc
Mission NodeSDK 6.2Pawngraphics.inc

graphics.inc

SDK Source File: graphics.inc

Source / SDK 6.2 / Pawn / Core

graphics.inc

graphics.inc
CPP
1/****h* PawnLibs/graphics
2 * Description
3 * TBD: explain basic principles and underlying hardware limitations
4 ******/
5
6/****s* PawnLibs/graphics/GFX_POINT
7 * Summary
8 * Array with named fields which represents a point on a screen.
9 * Synopsis
10 */
11#define GFX_POINT [ .x, .y ]
12/*
13 * Description
14 * Fields:
15 * * x, y - coordinates of the point
16 ******/
17
18/****s* PawnLibs/graphics/GFX_RECTANGLE
19 * Summary
20 * Array with named fields which represents a rectangle.
21 * Synopsis
22 */
23#define GFX_RECTANGLE [ .x, .y, .w, .h ]
24/*
25 * Description
26 * Fields:
27 * * x, y - top left coordinates of the rectangle
28 * * w - width of the rectangle
29 * * h - height of the rectangle
30 ******/
31
32/****s* PawnLibs/graphics/GFX_PARTICLE
33 * Summary
34 * Array with named fields with a single particle description.
35 * Synopsis
36 */
37#define GFX_PARTICLE [ .ttl, .vx, .vy, .ax, .ay, bool:.explosion, .velocity ]
38/*
39 * Description
40 * Fields:
41 * * ttl - a particles lifetime in ms
42 * * vx, vy - an initial particles velocity in px/ms
43 * * ax, ay - a particles acceleration in px/ms^2
44 * * explosion - an explosion emulation flag
45 * * velocity - an explosion velocity
46 * See also
47 * * GFX_EMISSION
48 * * GFX_drawParticles()
49 * * GFX_drawParticlesXY()
50 ******/
51
52/****s* PawnLibs/graphics/GFX_EMISSION
53 * Summary
54 * Array with named fields with particles emission description.
55 * Synopsis
56 */
57#define GFX_EMISSION [ .duration, .frequency, .max, bool:.loop ]
58/*
59 * Description
60 * Fields:
61 * * duration - how long particles emit in ms
62 * * frequency - how frequently new particles emit in Hz
63 * * max - how many particles can emit
64 * * loop - keep emission TBD: check?
65 * See also
66 * * GFX_PARTICLE
67 * * GFX_drawParticles()
68 * * GFX_drawParticlesXY()
69 ******/
70
71/****c* PawnLibs/graphics/GFX_text_align
72 * Summary
73 * Enumeration of a text align variants.
74 * Synopsis
75 */
76const GFX_text_align: {
77 TEXT_ALIGN_CENTER = 0,
78 TEXT_ALIGN_TOP_CENTER,
79 TEXT_ALIGN_BOTTOM_CENTER,
80 TEXT_ALIGN_LEFT_CORNER,
81 TEXT_ALIGN_LEFT_TOP_CORNER,
82 TEXT_ALIGN_LEFT_BOTTOM_CORNER,
83 TEXT_ALIGN_RIGHT_CORNER,
84 TEXT_ALIGN_RIGHT_TOP_CORNER,
85 TEXT_ALIGN_RIGHT_BOTTOM_CORNER,
86};
87/******/
88
89/****c* PawnLibs/graphics/GFX_mirror
90 * Summary
91 * Enumeration of an image mirror variants.
92 * Synopsis
93 */
94const GFX_mirror: {
95 MIRROR_BLANK = 0,
96 MIRROR_X,
97 MIRROR_Y,
98 MIRROR_XY,
99};
100/******/
101
102/****c* PawnLibs/graphics/GFX_format
103 * Summary
104 * Enumeration of a pixel color formats.
105 * Synopsis
106 */
107const GFX_format: {
108 FORMAT_RGB565 = 0,
109 FORMAT_ARGB6666,
110 FORMAT_ARGB8888,
111};
112/******/
113
114/****e* PawnLibs/graphics/ON_Render
115 * Summary
116 * Render handler.
117 * Synopsis
118 */
119forward ON_Render();
120/*
121 * Description
122 * Public function with such signature will be called at the end of an
123 * application loop. Useful to logically divide the application and rendering
124 * logic. There is no limitations to render entire scene in the ON_Tick()
125 * handler.
126 ******/
127
128/****n* PawnLibs/graphics/GFX_getAssetId
129 * Summary
130 * Get an image ID by the filename.
131 * Synopsis
132 */
133native GFX_getAssetId(const name[]);
134/*
135 * Description
136 * Usually an application uses image IDs to draw sprites and backgrounds. But
137 * sometimes IDs are unknown, e.g. in common libraries, or they change rapidly
138 * during development. This interface can be used to get an ID of the image by
139 * its filename in the runtime. Maximum asset name length is 15 characters,
140 * remaining symbols are truncated during lookup.
141 * Inputs
142 * * name - an image filename for which ID is requested
143 * Return value
144 * The ID of image with a given filename or -1 in case of error.
145 * See also
146 * * ON_Init()
147 * History
148 * * v5.0 - renamed from GFX_getId() to GFX_getAssetId()
149 * * v6.0 - truncate asset name in WASM API
150 ******/
151
152/****n* PawnLibs/graphics/GFX_clear
153 * Summary
154 * Clear a layer with a given color.
155 * Synopsis
156 */
157native GFX_clear(const color);
158/*
159 * Inputs
160 * * color - a color in RGB888 format to clear a layer with
161 * History
162 * * v6.0 - changed color format
163 ******/
164
165/****n* PawnLibs/graphics/GFX_drawPoint
166 * Summary
167 * Draw a point specified by its coordinates with a given color.
168 * Synopsis
169 */
170native GFX_drawPoint(const point[GFX_POINT], color);
171native GFX_drawPointXY(x, y, color);
172/*
173 * Inputs
174 * * point or (x, y) - coordinates of point to draw
175 * * color - a color in ARGB8888 format to draw point with
176 * See also
177 * * GFX_POINT
178 * History
179 * * v5.0 - added GFX_drawPointXY() alias
180 ******/
181
182/****n* PawnLibs/graphics/GFX_drawCircle
183 * Summary
184 * Draw a circle at the given point with given radius, color and line width.
185 * Synopsis
186 */
187native GFX_drawCircle(const center[GFX_POINT], radius, width, color);
188native GFX_drawCircleXY(x, y, radius, width, color);
189/*
190 * Inputs
191 * * center or (x, y) - coordinates of the circle center
192 * * radius - radius of the circle
193 * * width - line width used to draw the circle
194 * * color - a color in ARGB8888 format to draw circle with
195 * See also
196 * * GFX_POINT
197 * History
198 * * v5.0 - added GFX_drawCircleXY() alias
199 ******/
200
201/****o* PawnLibs/graphics/GFX_drawSolidCircle
202 * Summary
203 * Draw a solid circle at the given point with given radius and color.
204 * Synopsis
205 */
206native GFX_drawSolidCircle(const center[GFX_POINT], radius, color);
207native GFX_drawSolidCircleXY(x, y, radius, color);
208/*
209 * Inputs
210 * * center or (x, y) - coordinates of the circle center
211 * * radius - radius of the circle
212 * * color - a color in ARGB8888 format to draw circle with
213 * See also
214 * * GFX_POINT
215 * * GFX_setFillShader()
216 * * GFX_setLinearGradientShader()
217 * * GFX_setRadialGradientShader()
218 * History
219 * * v5.0 - added GFX_drawSolidCircleXY() alias
220 * * v6.0 - DEPRECATED, use GFX_setFillShader() instead
221 ******/
222
223/****n* PawnLibs/graphics/GFX_drawArc
224 * Summary
225 * Draw an arc at the given point with given radius, line width, color and
226 * angles.
227 * Synopsis
228 */
229native GFX_drawArc(const center[GFX_POINT], radius, width, from, to, color);
230native GFX_drawArcXY(x, y, radius, width, from, to, color);
231/*
232 * Inputs
233 * * center or (x, y) - coordinates of the arc center
234 * * radius - radius of the arc
235 * * width - line width used to draw the arc
236 * * from - starting angle of the arc TBD: in - ? from - ?
237 * * to - ending angle of the arc TBD: in - ? from - ?
238 * * color - a color in ARGB8888 format to draw arc with
239 * See also
240 * * GFX_POINT
241 * History
242 * * v5.0 - added GFX_drawArcXY() alias
243 ******/
244
245/****n* PawnLibs/graphics/GFX_drawSector
246 * Summary
247 * Draw a filled circular sector, connecting the arc to the circle's center
248 * like a piece of pie.
249 * Synopsis
250 */
251native GFX_drawSector(const center[GFX_POINT], radius, from, to, color);
252native GFX_drawSectorXY(x, y, radius, from, to, color);
253/*
254 * Inputs
255 * * center or (x, y) - coordinates of the circle's center
256 * * radius - radius of the circle
257 * * from - starting angle of the sector TBD: in - ? from - ?
258 * * to - ending angle of the sector TBD: in - ? from - ?
259 * * color - a color in ARGB8888 format to draw arc with
260 * See also
261 * * GFX_POINT
262 * History
263 * * v5.1 - created
264 ******/
265
266/****n* PawnLibs/graphics/GFX_drawLine
267 * Summary
268 * Draw a line with from a given point to another one and given width and
269 * color.
270 * Synopsis
271 */
272native GFX_drawLine(const start[GFX_POINT], const end[GFX_POINT], width, color);
273native GFX_drawLineXY(xs, ys, xe, ye, width, color);
274/*
275 * Inputs
276 * * start or (xs, ys) - coordinates of the line starting point
277 * * end or (xe, ye) - coordinates of the line ending point
278 * * width - line width to draw
279 * * color - a color in ARGB8888 format to draw line with
280 * See also
281 * * GFX_POINT
282 * History
283 * * v5.0 - added GFX_drawLineXY() alias
284 ******/
285
286/****n* PawnLibs/graphics/GFX_drawRectangle
287 * Summary
288 * Draw a solid rectangle at a given position with specified dimensions and a
289 * color.
290 * Synopsis
291 */
292native GFX_drawRectangle(const rectangle[GFX_RECTANGLE], color);
293native GFX_drawRectangleXY(x, y, w, h, color);
294/*
295 * Inputs
296 * * rectangle or (x, y, w, h) - top left corner coordinates and dimensions of
297 * the rectangle to draw
298 * * color - a color in ARGB8888 format to draw rectangle with
299 * See also
300 * * GFX_RECTANGLE
301 * History
302 * * v5.0 - added GFX_drawRectangleXY() alias
303 ******/
304
305/****n* PawnLibs/graphics/GFX_drawText
306 * Summary
307 * Draw a formatted text by the specified coordinates with a given color,
308 * scale, text align and a rotation angle.
309 * Synopsis
310 */
311native GFX_drawText(const center[GFX_POINT], scale, angle, fontId, GFX_text_align: align, color, const format[], {Float,Fixed,_}:...);
312native GFX_drawTextXY(x, y, scale, angle, fontId, GFX_text_align: align, color, const format[], {Float,Fixed,_}:...);
313/*
314 * Inputs
315 * * center or (x, y) - coordinates of the text center
316 * * scale - percentage scale, max font size is 200x200px (100%)
317 * * angle - clockwise rotation angle in degrees
318 * * fontId - not applicable, reserved for future use
319 * * align - text align (TBD: double check)
320 * * color - a color in ARGB8888 format to draw text with
321 * * format - format string, see log.inc for specification
322 * * ... - variable values to insert in the resulting string
323 * See also
324 * * GFX_POINT
325 * * GFX_text_align
326 * * PawnLibs/log
327 * History
328 * * v5.0 - clarified documentation, added GFX_drawTextXY() alias
329 ******/
330
331/****n* PawnLibs/graphics/GFX_bakeImage
332 * Summary
333 * Set an ID of a memory buffer to save next rendering result.
334 * Synopsis
335 */
336native GFX_bakeImage(const id, const width, const height, const GFX_format: format, bool: overwrite = true);
337/*
338 * Description
339 * Specifies the image that will be created by combining the group of
340 * graphical primitives used between GFX_bakeImage() and GFS_render()
341 * according their order and taking into account alpha channel in images. HW
342 * has a limitation and can combine no more than 4 layers simultaneously, so
343 * if there are more primitives then they will be combined in a cascade.
344 * Useful for creating complex images like backgrounds for later usage.
345 * Inputs
346 * * id - an ID of image to access later
347 * * width, height - image dimensions
348 * * format - color format of baked image
349 * * overwrite - true to overwrite previously baked image, false to append on
350 * top of it
351 * See also
352 * * GFX_format
353 * * GFX_render()
354 * * GFX_removeBakedImage()
355 * History
356 * * v6.0 - added overwrite parameter
357 ******/
358
359/****n* PawnLibs/graphics/GFX_setRenderTarget
360 * Summary
361 * Set a screen which will be used to display next rendering result.
362 * Synopsis
363 */
364native GFX_setRenderTarget(const screen);
365/*
366 * Description
367 * Cube module is a special device which has 3 independent screens to display
368 * graphics. GFX_setRenderTarget() specifies a screen number which will be
369 * used to display a next rendering result. Graphics primitives used in
370 * between GFX_setRenderTarget() and GFX_render() calls will be combined
371 * together according their order and taking into account alpha channel in
372 * images. Resulting image will be immediately flushed onto the given screen.
373 * HW has a limitation and can combine no more than 4 layers simultaneously,
374 * so if there are more primitives then they will be combined in a cascade. To
375 * display anything on the screen GFX_setRenderTarget() has to be always
376 * called.
377 * Inputs
378 * * screen - a screen number to render the resulting image on
379 * See also
380 * * GFX_render()
381 * * GFX_bakeImage()
382 * History
383 * * v5.0 - renamed from GFX_updateDisplay() to GFX_setRenderTarget()
384 ******/
385
386/****n* PawnLibs/graphics/GFX_drawImage
387 * Summary
388 * Draw an image from application assets at a specified position and with
389 * given transformations.
390 * Synopsis
391 */
392native GFX_drawImage(const center[GFX_POINT], opacity, colorKey, scaleX, scaleY, angle, GFX_mirror: mirror, id);
393native GFX_drawImageXY(x, y, opacity, colorKey, scaleX, scaleY, angle, GFX_mirror: mirror, id);
394/*
395 * Inputs
396 * * center or (x, y) - coordinates of the image center to draw
397 * * opacity - opacity of the entire image, 0 is fully transparent
398 * * colorKey - transparent background color, pixels of that color will not be
399 * used for rendering, it is useful for image with color format without
400 * alpha channel, e.g. RGB565
401 * * (scaleX, scaleY) - scale in percent from 1 to 100 along the corresponding
402 * axis
403 * * angle - clockwise rotation angle in degrees
404 * * mirror - mirroring variant
405 * * id - an ID of assets image to draw
406 * See also
407 * * GFX_POINT
408 * * GFX_mirror
409 * * GFX_cacheImages()
410 * History
411 * * v5.0 - added GFX_drawImageXY() alias, color argument clarified
412 * * v6.0 - added scale parameters
413 ******/
414
415/****n* PawnLibs/graphics/GFX_drawSubImage
416 * Summary
417 * Draw a sub window of an image from application assets at a specified
418 * position and with given transformations.
419 * Synopsis
420 */
421native GFX_drawSubImage(const center[GFX_POINT], winX, winY, winW, winH, opacity, colorKey, scaleX, scaleY, angle, GFX_mirror: mirror, id);
422native GFX_drawSubImageXY(x, y, winX, winY, winW, winH, opacity, colorKey, scaleX, scaleY, angle, GFX_mirror: mirror, id);
423/*
424 * Inputs
425 * * center or (x, y) - coordinates of the sub image center to draw
426 * * (winX, winY, winW, winH) - coordinates of image sub window relative to
427 * its top level corner
428 * * opacity - opacity of the entire image, 0 is fully transparent
429 * * colorKey - transparent background color, pixels of that color will not be
430 * used for rendering, it is useful for image with color format without
431 * alpha channel, e.g. RGB565
432 * * (scaleX, scaleY) - scale in percent from 1 to 100 along the corresponding
433 * axis
434 * * angle - clockwise rotation angle in degrees
435 * * mirror - mirroring variant
436 * * id - an ID of assets image to draw sub window
437 * See also
438 * * GFX_POINT
439 * * GFX_mirror
440 * * GFX_cacheImages()
441 * History
442 * * v6.2 - added
443 ******/
444
445/****n* PawnLibs/graphics/GFX_drawBakedImage
446 * Summary
447 * Draw a previously baked image at a specified position and with given
448 * transformations.
449 * Synopsis
450 */
451native GFX_drawBakedImage(const center[GFX_POINT], opacity, colorKey, scaleX, scaleY, angle, GFX_mirror: mirror, id);
452native GFX_drawBakedImageXY(x, y, opacity, colorKey, scaleX, scaleY, angle, GFX_mirror: mirror, id);
453/*
454 * Inputs
455 * * center or (x, y) - coordinates of the image center to draw
456 * * opacity - opacity of the entire image, 0 is fully transparent
457 * * colorKey - transparent background color, pixels of that color will not be
458 * used for rendering, it is useful for image with color format without
459 * alpha channel, e.g. RGB565
460 * * (scaleX, scaleY) - scale in percent from 1 to 100 along the corresponding
461 * axis
462 * * angle - clockwise rotation angle in degrees
463 * * mirror - mirroring variants
464 * * id - an ID of the baked image to draw
465 * See also
466 * * GFX_POINT
467 * * GFX_mirror
468 * History
469 * * v5.0 - added GFX_drawBakedImageXY() alias, color argument clarified
470 * * v6.0 - added scale parameters
471 ******/
472
473/****n* PawnLibs/graphics/GFX_setFillShader
474 * Summary
475 * Fill next primitives with specified color.
476 * Synopsis
477 */
478native GFX_setFillShader(color);
479/*
480 * Inputs
481 * * color - a color in ARGB8888 format to fill with
482 * History
483 * * v6.0 - added primitives shading
484 ******/
485
486 /****n* PawnLibs/graphics/GFX_setLinearGradientShader
487 * Summary
488 * Fill next primitives with linear gradient from a given point / color to
489 * another one.
490 * Synopsis
491 */
492native GFX_setLinearGradientShader(const start[GFX_POINT], const end[GFX_POINT], color0, color1);
493native GFX_setLinearGradientShaderXY(x0, y0, x1, y1, color0, color1);
494/*
495 * Inputs
496 * * start or (xs, ys) - coordinates of the fill starting point
497 * * end or (xe, ye) - coordinates of the fill ending point
498 * * color0 - a color in ARGB8888 format to start fill with
499 * * color1 - a color in ARGB8888 format to end fill with
500 * History
501 * * v6.0 - added primitives shading
502 ******/
503
504 /****n* PawnLibs/graphics/GFX_setRadialGradientShader
505 * Summary
506 * Fill next primitives with radial gradient from a given point with radius
507 * and from a given color to another one.
508 * Synopsis
509 */
510native GFX_setRadialGradientShader(const center[GFX_POINT], radius, color0, color1);
511native GFX_setRadialGradientShaderXY(x, y, radius, color0, color1);
512/*
513 * Inputs
514 * * center or (x, y) - coordinates of the fill center
515 * * radius - radius of the fill
516 * * color0 - a color in ARGB8888 format to start fill with
517 * * color1 - a color in ARGB8888 format to end fill with
518 * History
519 * * v6.0 - added primitives shading
520 ******/
521
522/****n* PawnLibs/graphics/GFX_removeShader
523 * Summary
524 * Do not use shading in next primitives.
525 * Synopsis
526 */
527native GFX_removeShader();
528/*
529 * Inputs
530 * History
531 * * v6.0 - added primitives shading
532 ******/
533
534/****n* PawnLibs/graphics/GFX_drawParticles
535 * Summary
536 * Draw particle system with given parameters.
537 * Synopsis
538 */
539native GFX_drawParticles(const center[GFX_POINT], opacity, colorKey, angle, id, const particle[GFX_PARTICLE], const emission[GFX_EMISSION], time);
540native GFX_drawParticlesXY(x, y, opacity, colorKey, angle, id, const particle[GFX_PARTICLE], const emission[GFX_EMISSION], time);
541/*
542 * Description
543 * TBD: create extended description how to use a particle system.
544 * Inputs
545 * * center or (x, y) - coordinates of the (TBD: clarify which center) center
546 * to draw
547 * * opacity - opacity of the entire particle system, 0 is fully transparent
548 * * colorKey - transparent background color, pixels of that color will not be
549 * used for rendering, it is useful for image with color format without
550 * alpha channel, e.g. RGB565
551 * * angle - clockwise rotation angle in degrees
552 * * id - an ID of the assets image to use as a particle
553 * * particle - a particle parameters
554 * * emission - a particle emission parameters
555 * * time - TBD: check
556 * See also
557 * * GFX_POINT
558 * * GFX_PARTICLE
559 * * GFX_EMISSION
560 * History
561 * * v5.0 - added GFX_drawParticlesXY() alias, color argument clarified
562 ******/
563
564/****n* PawnLibs/graphics/GFX_drawQrCode
565 * Summary
566 * Generate and draw QR-code for a given text string.
567 * Synopsis
568 */
569native GFX_drawQrCode(const center[GFX_POINT], size, color0, color1, angle, id, const text[]);
570native GFX_drawQrCodeXY(x, y, size, color0, color1, angle, id, const text[]);
571/*
572 * Description
573 * Supported version 2 which is limited by 32 characters of input.
574 * Inputs
575 * * center or (x, y) - coordinates of the resulting image of the QR-code to
576 * draw
577 * * size - size of the individual square representing a single bit in the
578 * encodeded text string
579 * * color0 - color of squares representing zeroes in the ARGB8888 format
580 * * color1 - color of squares representing ones in the ARGB8888 format
581 * * angle - clockwise rotation angle in degrees
582 * * id - an ID of resulting image to distinguish different codes on the same
583 scene, starts from 0
584 * * text - text string to encode and draw, maximum size is 256 characters
585 * See also
586 * * GFX_POINT
587 * History
588 * * v6.0 - added
589 ******/
590
591/****n* PawnLibs/graphics/GFX_render
592 * Summary
593 * Start rendering process.
594 * Synopsis
595 */
596native GFX_render();
597/*
598 * See also
599 * * GFX_setRenderTarget()
600 * * GFX_bakeImage()
601 ******/
602
603/****n* PawnLibs/graphics/GFX_cacheImages
604 * Summary
605 * Force platform to cache application images.
606 * Synopsis
607 */
608native GFX_cacheImages(imageList[], size = sizeof(imageList));
609/*
610 * Description
611 * Platform automatically reads and caches images from flash when the
612 * application draws an image. Flash operations are synchronous and may cause
613 * delays especially when reading large portions of data. To prevent the
614 * application from lags it is possible to cache image data in advance.
615 * However if application requests to draw a non-cached image and there is not
616 * enough memory then oldest accessed images will be removed from cache. Also
617 * there is a limit of 256 for a total number of cached images.
618 * Inputs
619 * * imageList - array with IDs of images to cache
620 * * size - size of imageList array
621 * Return value
622 * Number of cached images or negative value if an error happened. Error
623 * codes:
624 * * -1 invalid function arguments count
625 * * -2 invalid imageList array
626 * See also
627 * * GFX_clearCache()
628 * History
629 * * v5.0 - moved from appCtrl module to graphics
630 ******/
631
632/****n* PawnLibs/graphics/GFX_clearCache
633 * Summary
634 * Clear all cached images.
635 * Synopsis
636 */
637native GFX_clearCache();
638/*
639 * Description
640 * Oldest accessed image cache will be automatically freed if there is not
641 * enough memory to cache a new image. This function forces this process, e.g.
642 * when switch game levels.
643 * See also
644 * * GFX_cacheImages()
645 * * GFX_removeBakedImage()
646 ******/
647
648/****n* PawnLibs/graphics/GFX_removeBakedImage
649 * Summary
650 * Remove specified baked image from cache.
651 * Synopsis
652 */
653native GFX_removeBakedImage(id);
654/*
655 * Description
656 * Baked images do not automatically invalidate. This function allows to
657 * remove any baked image from cache to save some space.
658 * Inputs
659 * * id - an ID of the baked image to remove from cache
660 * See also
661 * * GFX_clearCache()
662 * * GFX_bakeImage()
663 * History
664 * * v6.0 - added
665 ******/
666
667/****n* PawnLibs/graphics/GFX_getAssetsCount
668 * Summary
669 * Get the total count of graphic assets.
670 * Synopsis
671 */
672native GFX_getAssetsCount();
673/*
674 * Return value
675 * Number of graphic assets.
676 * History
677 * * v6.0 - added
678 ******/
679
680/****f* PawnLibs/graphics/GFX_fromARGB8888
681 * Summary
682 * Returns a hexadecimal value of a color constructed from the channel
683 * components.
684 * Synopsis
685 */
686stock GFX_fromARGB8888(a, r, g, b)
687/*
688 * Inputs
689 * * a - the alpha channel, valid values are 0 through 255
690 * * r - the red channel, valid values are 0 through 255
691 * * g - the green channel, valid values are 0 through 255
692 * * b - the blue channel, valid values are 0 through 255
693 * Return value
694 * The hexadecimal value of a color constructed from the channel components.
695 * See also
696 * * GFX_toARGB8888()
697 * History
698 * * v5.0 - created
699 * Source
700 */
701{
702 return (a & 0xFF) << 24 | (r & 0xFF) << 16 | (g & 0xFF) << 8 | (b & 0xFF);
703}
704/******/
705
706/****f* PawnLibs/graphics/GFX_toARGB8888
707 * Summary
708 * Returns channel values of a color in the hexadecimal format.
709 * Synopsis
710 */
711stock GFX_toARGB8888(value, &a, &r, &g, &b)
712/*
713 * Inputs
714 * * value - the hexadecimal value of the color
715 * Outputs
716 * * a - the alpha channel
717 * * r - the red channel
718 * * g - the green channel
719 * * b - the blue channel
720 * See also
721 * * GFX_fromARGB8888
722 * History
723 * * v5.0 - created
724 * Source
725 */
726{
727 a = value & 0xFF000000;
728 r = value & 0x00FF0000;
729 g = value & 0x0000FF00;
730 b = value & 0x000000FF;
731}
732/******/
733
734
Wrapped for easier reading. Turn wrap off to inspect exact line lengths.
Context Rail

Related nodes

fixed.inc
Source / SDK 6.2 / Pawn / Core
leaderboard.inc
Source / SDK 6.2 / Pawn / Core
log.inc
Source / SDK 6.2 / Pawn / Core
math.inc
Source / SDK 6.2 / Pawn / Core
Previous Node
fixed.inc
Source / SDK 6.2 / Pawn / Core
Next Node
leaderboard.inc
Source / SDK 6.2 / Pawn / Core