NovaSVG 0.10.0
A header-only SVG library
Loading...
Searching...
No Matches
surface.h File Reference
#include "private.h"
#include "utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <assert.h>
#include <stdint.h>
Include dependency graph for surface.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  stbi_io_callbacks
 
struct  stbi__context
 
struct  stbi__result_info
 
struct  stbi__huffman
 
struct  stbi__jpeg
 
struct  stbi__resample
 
struct  stbi__zhuffman
 
struct  stbi__zbuf
 
struct  stbi__pngchunk
 
struct  stbi__png
 
struct  stbi__bmp_data
 
struct  stbi__pic_packet
 
struct  stbi__gif_lzw
 
struct  stbi__gif
 

Namespaces

namespace  novasvg
 Main namespace for the NovaSVG library.
 
namespace  novasvg::render
 

Macros

#define STB_IMAGE_STATIC
 
#define STB_IMAGE_IMPLEMENTATION
 
#define PLUTOVG_STB_IMAGE_H
 
#define STBI_VERSION   1
 
#define STBIDEF   static
 
#define STBI_ASSERT(x)   assert(x)
 
#define STBI_EXTERN   extern
 
#define stbi_inline
 
#define STBI_NOTUSED(v)   (void)sizeof(v)
 
#define stbi_lrot(x, y)   (((x) << (y)) | ((x) >> (-(y) & 31)))
 
#define STBI_MALLOC(sz)   malloc(sz)
 
#define STBI_REALLOC(p, newsz)   realloc(p,newsz)
 
#define STBI_FREE(p)   free(p)
 
#define STBI_REALLOC_SIZED(p, oldsz, newsz)   STBI_REALLOC(p,newsz)
 
#define STBI_SIMD_ALIGN(type, name)   type name
 
#define STBI_MAX_DIMENSIONS   (1 << 24)
 
#define stbi__err(x, y)   stbi__err(x)
 
#define stbi__errpf(x, y)   ((float *)(size_t) (stbi__err(x,y)?NULL:NULL))
 
#define stbi__errpuc(x, y)   ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL))
 
#define stbi__vertically_flip_on_load   stbi__vertically_flip_on_load_global
 
#define STBI__BYTECAST(x)   ((stbi_uc) ((x) & 255))
 
#define STBI__COMBO(a, b)   ((a)*8+(b))
 
#define STBI__CASE(a, b)   case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
 
#define STBI__COMBO(a, b)   ((a)*8+(b))
 
#define STBI__CASE(a, b)   case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)
 
#define stbi__float2int(x)   ((int) (x))
 
#define FAST_BITS   9
 
#define stbi__f2f(x)   ((int) (((x) * 4096 + 0.5)))
 
#define stbi__fsh(x)   ((x) * 4096)
 
#define STBI__IDCT_1D(s0, s1, s2, s3, s4, s5, s6, s7)
 
#define STBI__MARKER_none   0xff
 
#define STBI__RESTART(x)   ((x) >= 0xd0 && (x) <= 0xd7)
 
#define stbi__DNL(x)   ((x) == 0xdc)
 
#define stbi__SOI(x)   ((x) == 0xd8)
 
#define stbi__EOI(x)   ((x) == 0xd9)
 
#define stbi__SOF(x)   ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2)
 
#define stbi__SOS(x)   ((x) == 0xda)
 
#define stbi__SOF_progressive(x)   ((x) == 0xc2)
 
#define stbi__div4(x)   ((stbi_uc) ((x) >> 2))
 
#define stbi__div16(x)   ((stbi_uc) ((x) >> 4))
 
#define stbi__float2fixed(x)   (((int) ((x) * 4096.0f + 0.5f)) << 8)
 
#define STBI__ZFAST_BITS   9
 
#define STBI__ZFAST_MASK   ((1 << STBI__ZFAST_BITS) - 1)
 
#define STBI__ZNSYMS   288
 
#define stbi__unpremultiply_on_load   stbi__unpremultiply_on_load_global
 
#define stbi__de_iphone_flag   stbi__de_iphone_flag_global
 
#define STBI__PNG_TYPE(a, b, c, d)   (((unsigned) (a) << 24) + ((unsigned) (b) << 16) + ((unsigned) (c) << 8) + (unsigned) (d))
 
#define STBI__HDR_BUFLEN   1024
 

Typedefs

typedef unsigned char stbi_uc
 
typedef unsigned short stbi_us
 
typedef uint16_t stbi__uint16
 
typedef int16_t stbi__int16
 
typedef uint32_t stbi__uint32
 
typedef int32_t stbi__int32
 
typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 :-1]
 
typedef stbi_uc *(* resample_row_func) (stbi_uc *out, stbi_uc *in0, stbi_uc *in1, int w, int hs)
 

Enumerations

enum  {
  STBI_default = 0 , STBI_grey = 1 , STBI_grey_alpha = 2 , STBI_rgb = 3 ,
  STBI_rgb_alpha = 4
}
 
enum  { STBI_ORDER_RGB , STBI_ORDER_BGR }
 
enum  { STBI__SCAN_load =0 , STBI__SCAN_type , STBI__SCAN_header }
 
enum  {
  STBI__F_none =0 , STBI__F_sub =1 , STBI__F_up =2 , STBI__F_avg =3 ,
  STBI__F_paeth =4 , STBI__F_avg_first
}
 

Functions

surface_t * novasvg::render::surface_create (int width, int height)
 Creates a new image surface with the specified dimensions.
 
surface_t * novasvg::render::surface_create_for_data (unsigned char *data, int width, int height, int stride)
 Creates an image surface using existing pixel data.
 
surface_t * novasvg::render::surface_load_from_image_file (const char *filename)
 Loads an image surface from a file.
 
surface_t * novasvg::render::surface_load_from_image_data (const void *data, int length)
 Loads an image surface from raw image data.
 
NOVASVG_INLINE uint8_t * novasvg::render::base64_decode (const char *data, int length, size_t *out_length)
 
surface_t * novasvg::render::surface_load_from_image_base64 (const char *data, int length)
 Loads an image surface from base64-encoded data.
 
surface_t * novasvg::render::surface_reference (surface_t *surface)
 Increments the reference count for a surface.
 
void novasvg::render::surface_destroy (surface_t *surface)
 Decrements the reference count and destroys the surface if the count reaches zero.
 
int novasvg::render::surface_get_reference_count (const surface_t *surface)
 Gets the current reference count of a surface.
 
unsigned char * novasvg::render::surface_get_data (const surface_t *surface)
 Gets the pixel data of the surface.
 
int novasvg::render::surface_get_width (const surface_t *surface)
 Gets the width of the surface.
 
int novasvg::render::surface_get_height (const surface_t *surface)
 Gets the height of the surface.
 
int novasvg::render::surface_get_stride (const surface_t *surface)
 Gets the stride of the surface.
 
void novasvg::render::surface_clear (surface_t *surface, const color_t *color)
 Clears the entire surface with the specified color.
 
void novasvg::render::convert_argb_to_rgba (unsigned char *dst, const unsigned char *src, int width, int height, int stride)
 Converts pixel data from premultiplied ARGB to RGBA format.
 
void novasvg::render::convert_rgba_to_argb (unsigned char *dst, const unsigned char *src, int width, int height, int stride)
 Converts pixel data from RGBA to premultiplied ARGB format.
 

Macro Definition Documentation

◆ FAST_BITS

#define FAST_BITS   9

Definition at line 1729 of file surface.h.

◆ PLUTOVG_STB_IMAGE_H

#define PLUTOVG_STB_IMAGE_H

Definition at line 143 of file surface.h.

◆ STB_IMAGE_IMPLEMENTATION

#define STB_IMAGE_IMPLEMENTATION

Definition at line 9 of file surface.h.

◆ STB_IMAGE_STATIC

#define STB_IMAGE_STATIC

Definition at line 8 of file surface.h.

◆ STBI__BYTECAST

#define STBI__BYTECAST (   x)    ((stbi_uc) ((x) & 255))

Definition at line 1544 of file surface.h.

◆ STBI__CASE [1/2]

#define STBI__CASE (   a,
  b 
)    case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)

◆ STBI__CASE [2/2]

#define STBI__CASE (   a,
  b 
)    case STBI__COMBO(a,b): for(i=x-1; i >= 0; --i, src += a, dest += b)

◆ STBI__COMBO [1/2]

#define STBI__COMBO (   a,
  b 
)    ((a)*8+(b))

◆ STBI__COMBO [2/2]

#define STBI__COMBO (   a,
  b 
)    ((a)*8+(b))

◆ stbi__de_iphone_flag

#define stbi__de_iphone_flag   stbi__de_iphone_flag_global

Definition at line 4797 of file surface.h.

◆ stbi__div16

#define stbi__div16 (   x)    ((stbi_uc) ((x) >> 4))

Definition at line 3296 of file surface.h.

◆ stbi__div4

#define stbi__div4 (   x)    ((stbi_uc) ((x) >> 2))

Definition at line 3247 of file surface.h.

◆ stbi__DNL

#define stbi__DNL (   x)    ((x) == 0xdc)

Definition at line 3150 of file surface.h.

◆ stbi__EOI

#define stbi__EOI (   x)    ((x) == 0xd9)

Definition at line 3152 of file surface.h.

◆ stbi__err

#define stbi__err (   x,
  y 
)    stbi__err(x)

Definition at line 997 of file surface.h.

◆ stbi__errpf

#define stbi__errpf (   x,
  y 
)    ((float *)(size_t) (stbi__err(x,y)?NULL:NULL))

Definition at line 1000 of file surface.h.

◆ stbi__errpuc

#define stbi__errpuc (   x,
  y 
)    ((unsigned char *)(size_t) (stbi__err(x,y)?NULL:NULL))

Definition at line 1001 of file surface.h.

◆ stbi__f2f

#define stbi__f2f (   x)    ((int) (((x) * 4096 + 0.5)))

Definition at line 2219 of file surface.h.

◆ stbi__float2fixed

#define stbi__float2fixed (   x)    (((int) ((x) * 4096.0f + 0.5f)) << 8)

Definition at line 3452 of file surface.h.

◆ stbi__float2int

#define stbi__float2int (   x)    ((int) (x))

Definition at line 1678 of file surface.h.

◆ stbi__fsh

#define stbi__fsh (   x)    ((x) * 4096)

Definition at line 2220 of file surface.h.

◆ STBI__HDR_BUFLEN

#define STBI__HDR_BUFLEN   1024

Definition at line 6885 of file surface.h.

◆ STBI__IDCT_1D

#define STBI__IDCT_1D (   s0,
  s1,
  s2,
  s3,
  s4,
  s5,
  s6,
  s7 
)

Definition at line 2223 of file surface.h.

◆ STBI__MARKER_none

#define STBI__MARKER_none   0xff

Definition at line 2708 of file surface.h.

◆ STBI__PNG_TYPE

#define STBI__PNG_TYPE (   a,
  b,
  c,
  d 
)    (((unsigned) (a) << 24) + ((unsigned) (b) << 16) + ((unsigned) (c) << 8) + (unsigned) (d))

Definition at line 4865 of file surface.h.

◆ STBI__RESTART

#define STBI__RESTART (   x)    ((x) >= 0xd0 && (x) <= 0xd7)

Definition at line 2725 of file surface.h.

◆ stbi__SOF

#define stbi__SOF (   x)    ((x) == 0xc0 || (x) == 0xc1 || (x) == 0xc2)

Definition at line 3153 of file surface.h.

◆ stbi__SOF_progressive

#define stbi__SOF_progressive (   x)    ((x) == 0xc2)

Definition at line 3156 of file surface.h.

◆ stbi__SOI

#define stbi__SOI (   x)    ((x) == 0xd8)

Definition at line 3151 of file surface.h.

◆ stbi__SOS

#define stbi__SOS (   x)    ((x) == 0xda)

Definition at line 3154 of file surface.h.

◆ stbi__unpremultiply_on_load

#define stbi__unpremultiply_on_load   stbi__unpremultiply_on_load_global

Definition at line 4796 of file surface.h.

◆ stbi__vertically_flip_on_load

#define stbi__vertically_flip_on_load   stbi__vertically_flip_on_load_global

Definition at line 1020 of file surface.h.

◆ STBI__ZFAST_BITS

#define STBI__ZFAST_BITS   9

Definition at line 3882 of file surface.h.

◆ STBI__ZFAST_MASK

#define STBI__ZFAST_MASK   ((1 << STBI__ZFAST_BITS) - 1)

Definition at line 3883 of file surface.h.

◆ STBI__ZNSYMS

#define STBI__ZNSYMS   288

Definition at line 3884 of file surface.h.

◆ STBI_ASSERT

#define STBI_ASSERT (   x)    assert(x)

Definition at line 533 of file surface.h.

◆ STBI_EXTERN

#define STBI_EXTERN   extern

Definition at line 539 of file surface.h.

◆ STBI_FREE

#define STBI_FREE (   p)    free(p)

Definition at line 614 of file surface.h.

◆ stbi_inline

#define stbi_inline

Definition at line 547 of file surface.h.

◆ stbi_lrot

#define stbi_lrot (   x,
  y 
)    (((x) << (y)) | ((x) >> (-(y) & 31)))

Definition at line 600 of file surface.h.

◆ STBI_MALLOC

#define STBI_MALLOC (   sz)    malloc(sz)

Definition at line 612 of file surface.h.

◆ STBI_MAX_DIMENSIONS

#define STBI_MAX_DIMENSIONS   (1 << 24)

Definition at line 726 of file surface.h.

◆ STBI_NOTUSED

#define STBI_NOTUSED (   v)    (void)sizeof(v)

Definition at line 590 of file surface.h.

◆ STBI_REALLOC

#define STBI_REALLOC (   p,
  newsz 
)    realloc(p,newsz)

Definition at line 613 of file surface.h.

◆ STBI_REALLOC_SIZED

#define STBI_REALLOC_SIZED (   p,
  oldsz,
  newsz 
)    STBI_REALLOC(p,newsz)

Definition at line 618 of file surface.h.

◆ STBI_SIMD_ALIGN

#define STBI_SIMD_ALIGN (   type,
  name 
)    type name

Definition at line 722 of file surface.h.

◆ STBI_VERSION

#define STBI_VERSION   1

Definition at line 361 of file surface.h.

◆ STBIDEF

#define STBIDEF   static

Definition at line 383 of file surface.h.

Typedef Documentation

◆ resample_row_func

typedef stbi_uc *(* resample_row_func) (stbi_uc *out, stbi_uc *in0, stbi_uc *in1, int w, int hs)

Definition at line 3244 of file surface.h.

◆ stbi__int16

typedef int16_t stbi__int16

Definition at line 579 of file surface.h.

◆ stbi__int32

typedef int32_t stbi__int32

Definition at line 581 of file surface.h.

◆ stbi__uint16

typedef uint16_t stbi__uint16

Definition at line 578 of file surface.h.

◆ stbi__uint32

typedef uint32_t stbi__uint32

Definition at line 580 of file surface.h.

◆ stbi_uc

typedef unsigned char stbi_uc

Definition at line 374 of file surface.h.

◆ stbi_us

typedef unsigned short stbi_us

Definition at line 375 of file surface.h.

◆ validate_uint32

typedef unsigned char validate_uint32[sizeof(stbi__uint32)==4 ? 1 :-1]

Definition at line 585 of file surface.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
STBI_default 
STBI_grey 
STBI_grey_alpha 
STBI_rgb 
STBI_rgb_alpha 

Definition at line 363 of file surface.h.

◆ anonymous enum

anonymous enum
Enumerator
STBI_ORDER_RGB 
STBI_ORDER_BGR 

Definition at line 823 of file surface.h.

◆ anonymous enum

anonymous enum
Enumerator
STBI__SCAN_load 
STBI__SCAN_type 
STBI__SCAN_header 

Definition at line 1430 of file surface.h.

◆ anonymous enum

anonymous enum
Enumerator
STBI__F_none 
STBI__F_sub 
STBI__F_up 
STBI__F_avg 
STBI__F_paeth 
STBI__F_avg_first 

Definition at line 4427 of file surface.h.