Blender  V3.3
Classes | Macros | Functions
datatoc_icon.c File Reference
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../blenlib/BLI_sys_types.h"
#include <dirent.h>
#include <png.h>

Go to the source code of this file.

Classes

struct  IconHead
 
struct  IconInfo
 
struct  IconMergeContext
 

Macros

#define SEP   '/'
 

Functions

static int path_ensure_slash (char *string)
 
static bool path_test_extension (const char *str, const char *ext)
 
static void endian_switch_uint32 (uint *val)
 
static const char * path_slash_rfind (const char *string)
 
static const char * path_basename (const char *path)
 
static bool write_png (const char *name, const uint *pixels, const int width, const int height)
 
static void icon_merge_context_init (struct IconMergeContext *context)
 
static struct IconInfoicon_merge_context_info_for_icon_head (struct IconMergeContext *context, struct IconHead *icon_head)
 
static void icon_merge_context_register_icon (struct IconMergeContext *context, const char *file_name, const struct IconHead *icon_head)
 
static void icon_merge_context_free (struct IconMergeContext *context)
 
static bool icon_decode_head (FILE *f_src, struct IconHead *r_head)
 
static bool icon_decode (FILE *f_src, struct IconHead *r_head, uint **r_pixels)
 
static bool icon_read (const char *file_src, struct IconHead *r_head, uint **r_pixels)
 
static bool icon_merge (struct IconMergeContext *context, const char *file_src, uint32_t **r_pixels_canvas, uint *r_canvas_w, uint *r_canvas_h)
 
static bool icondir_to_png (const char *path_src, const char *file_dst)
 
int main (int argc, char **argv)
 

Macro Definition Documentation

◆ SEP

#define SEP   '/'

Definition at line 31 of file datatoc_icon.c.

Function Documentation

◆ endian_switch_uint32()

static void endian_switch_uint32 ( uint val)
static

Definition at line 55 of file datatoc_icon.c.

Referenced by icon_decode_head().

◆ icon_decode()

static bool icon_decode ( FILE *  f_src,
struct IconHead r_head,
uint **  r_pixels 
)
static

Definition at line 276 of file datatoc_icon.c.

References free(), icon_decode_head(), IconHead::icon_h, IconHead::icon_w, and NULL.

Referenced by icon_read().

◆ icon_decode_head()

static bool icon_decode_head ( FILE *  f_src,
struct IconHead r_head 
)
static

◆ icon_merge()

static bool icon_merge ( struct IconMergeContext context,
const char *  file_src,
uint32_t **  r_pixels_canvas,
uint r_canvas_w,
uint r_canvas_h 
)
static

◆ icon_merge_context_free()

static void icon_merge_context_free ( struct IconMergeContext context)
static

Definition at line 246 of file datatoc_icon.c.

References blender::compositor::context, free(), and NULL.

Referenced by icondir_to_png().

◆ icon_merge_context_info_for_icon_head()

static struct IconInfo* icon_merge_context_info_for_icon_head ( struct IconMergeContext context,
struct IconHead icon_head 
)
static

Definition at line 213 of file datatoc_icon.c.

References blender::compositor::context, IconInfo::head, NULL, IconHead::orig_x, and IconHead::orig_y.

Referenced by icon_merge().

◆ icon_merge_context_init()

static void icon_merge_context_init ( struct IconMergeContext context)
static

Definition at line 204 of file datatoc_icon.c.

References blender::compositor::context, and NULL.

Referenced by icondir_to_png().

◆ icon_merge_context_register_icon()

static void icon_merge_context_register_icon ( struct IconMergeContext context,
const char *  file_name,
const struct IconHead icon_head 
)
static

Definition at line 232 of file datatoc_icon.c.

References blender::compositor::context, IconInfo::file_name, IconInfo::head, and path_basename().

Referenced by icon_merge().

◆ icon_read()

static bool icon_read ( const char *  file_src,
struct IconHead r_head,
uint **  r_pixels 
)
static

Definition at line 303 of file datatoc_icon.c.

References icon_decode(), and NULL.

Referenced by icon_merge().

◆ icondir_to_png()

static bool icondir_to_png ( const char *  path_src,
const char *  file_dst 
)
static

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 457 of file datatoc_icon.c.

References icondir_to_png().

◆ path_basename()

static const char* path_basename ( const char *  path)
static

Definition at line 76 of file datatoc_icon.c.

References path_slash_rfind().

Referenced by icon_merge(), and icon_merge_context_register_icon().

◆ path_ensure_slash()

static int path_ensure_slash ( char *  string)
static

Definition at line 37 of file datatoc_icon.c.

References len, and SEP.

Referenced by icondir_to_png().

◆ path_slash_rfind()

static const char* path_slash_rfind ( const char *  string)
static

Definition at line 61 of file datatoc_icon.c.

Referenced by path_basename().

◆ path_test_extension()

static bool path_test_extension ( const char *  str,
const char *  ext 
)
static

Definition at line 48 of file datatoc_icon.c.

References Freestyle::a, usdtokens::b(), and str.

Referenced by icondir_to_png().

◆ write_png()

static bool write_png ( const char *  name,
const uint pixels,
const int  width,
const int  height 
)
static

Definition at line 85 of file datatoc_icon.c.

References free(), height, NULL, and width.

Referenced by icondir_to_png().