Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

interface_icons.c File Reference

#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "MEM_guardedalloc.h"
#include "GPU_extensions.h"
#include "BLI_math.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
#include "DNA_brush_types.h"
#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "RNA_access.h"
#include "RNA_enum_types.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_icons.h"
#include "BKE_utildefines.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "BIF_gl.h"
#include "BIF_glutil.h"
#include "ED_datafiles.h"
#include "ED_render.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
#include "interface_intern.h"

Go to the source code of this file.

Classes

struct  IconImage
struct  DrawInfo
struct  IconTexture

Defines

#define ICON_IMAGE_W   600
#define ICON_IMAGE_H   640
#define ICON_GRID_COLS   26
#define ICON_GRID_ROWS   30
#define ICON_GRID_MARGIN   5
#define ICON_GRID_W   16
#define ICON_GRID_H   16
#define ICON_TYPE_PREVIEW   0
#define ICON_TYPE_TEXTURE   1
#define ICON_TYPE_BUFFER   2
#define ICON_TYPE_VECTOR   3
#define INIT_BRUSH_ICON(icon_id, name)

Typedefs

typedef struct IconImage IconImage
typedef void(* VectorDrawFunc )(int x, int y, int w, int h, float alpha)
typedef struct DrawInfo DrawInfo
typedef struct IconTexture IconTexture

Functions

static void def_internal_icon (ImBuf *bbuf, int icon_id, int xofs, int yofs, int size, int type)
static void def_internal_vicon (int icon_id, VectorDrawFunc drawFunc)
static void viconutil_set_point (GLint pt[2], int x, int y)
static void viconutil_draw_tri (GLint(*pts)[2])
static void viconutil_draw_lineloop (GLint(*pts)[2], int numPoints)
static void viconutil_draw_lineloop_smooth (GLint(*pts)[2], int numPoints)
static void viconutil_draw_points (GLint(*pts)[2], int numPoints, int pointSize)
static void vicon_x_draw (int x, int y, int w, int h, float alpha)
static void vicon_view3d_draw (int x, int y, int w, int h, float alpha)
static void vicon_edit_draw (int x, int y, int w, int h, float alpha)
static void vicon_editmode_hlt_draw (int x, int y, int w, int h, float alpha)
static void vicon_editmode_dehlt_draw (int x, int y, int w, int h, float UNUSED(alpha))
static void vicon_disclosure_tri_right_draw (int x, int y, int w, int UNUSED(h), float alpha)
static void vicon_small_tri_right_draw (int x, int y, int w, int UNUSED(h), float alpha)
static void vicon_disclosure_tri_down_draw (int x, int y, int w, int UNUSED(h), float alpha)
static void vicon_move_up_draw (int x, int y, int w, int h, float UNUSED(alpha))
static void vicon_move_down_draw (int x, int y, int w, int h, float UNUSED(alpha))
static void init_brush_icons (void)
static void init_internal_icons (void)
static void init_iconfile_list (struct ListBase *list)
static void free_iconfile_list (struct ListBase *list)
int UI_iconfile_get_index (const char *filename)
ListBaseUI_iconfile_list (void)
void UI_icons_free (void)
void UI_icons_free_drawinfo (void *drawinfo)
static DrawInfoicon_create_drawinfo (void)
int UI_icon_get_width (int icon_id)
int UI_icon_get_height (int icon_id)
void UI_icons_init (int first_dyn_id)
static int preview_render_size (enum eIconSizes size)
static void icon_create_rect (struct PreviewImage *prv_img, enum eIconSizes size)
static void icon_set_image (bContext *C, ID *id, PreviewImage *prv_img, enum eIconSizes size)
static void icon_draw_rect (float x, float y, int w, int h, float UNUSED(aspect), int rw, int rh, unsigned int *rect, float alpha, float *rgb, short is_preview)
static void icon_draw_texture (float x, float y, float w, float h, int ix, int iy, int UNUSED(iw), int ih, float alpha, float *rgb)
static int get_draw_size (enum eIconSizes size)
static void icon_draw_size (float x, float y, int icon_id, float aspect, float alpha, float *rgb, enum eIconSizes size, int draw_size, int UNUSED(nocreate), short is_preview)
static void ui_id_icon_render (bContext *C, ID *id, int big)
static void ui_id_brush_render (bContext *C, ID *id)
static int ui_id_brush_get_icon (bContext *C, ID *id)
int ui_id_icon_get (bContext *C, ID *id, int big)
static void icon_draw_at_size (float x, float y, int icon_id, float aspect, float alpha, enum eIconSizes size, int nocreate)
void UI_icon_draw_aspect (float x, float y, int icon_id, float aspect, float alpha)
void UI_icon_draw_aspect_color (float x, float y, int icon_id, float aspect, float *rgb)
void UI_icon_draw (float x, float y, int icon_id)
void UI_icon_draw_size (float x, float y, int size, int icon_id, float alpha)
void UI_icon_draw_preview (float x, float y, int icon_id)
void UI_icon_draw_preview_aspect (float x, float y, int icon_id, float aspect)
void UI_icon_draw_preview_aspect_size (float x, float y, int icon_id, float aspect, int size)

Variables

static struct ListBase iconfilelist = {NULL, NULL}
static IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f}

Detailed Description

Definition in file interface_icons.c.


Define Documentation

#define ICON_GRID_COLS   26

Definition at line 81 of file interface_icons.c.

Referenced by init_internal_icons().

#define ICON_GRID_H   16

Definition at line 86 of file interface_icons.c.

Referenced by init_internal_icons().

#define ICON_GRID_MARGIN   5

Definition at line 84 of file interface_icons.c.

Referenced by init_internal_icons().

#define ICON_GRID_ROWS   30

Definition at line 82 of file interface_icons.c.

Referenced by init_internal_icons().

#define ICON_GRID_W   16

Definition at line 85 of file interface_icons.c.

Referenced by init_internal_icons().

#define ICON_IMAGE_H   640

Definition at line 79 of file interface_icons.c.

Referenced by init_iconfile_list(), and init_internal_icons().

#define ICON_IMAGE_W   600

Definition at line 78 of file interface_icons.c.

Referenced by init_iconfile_list(), and init_internal_icons().

#define ICON_TYPE_BUFFER   2
#define ICON_TYPE_PREVIEW   0

Definition at line 96 of file interface_icons.c.

Referenced by icon_create_drawinfo(), and icon_draw_size().

#define ICON_TYPE_TEXTURE   1

Definition at line 97 of file interface_icons.c.

Referenced by def_internal_icon(), icon_draw_size(), and init_internal_icons().

#define ICON_TYPE_VECTOR   3

Definition at line 99 of file interface_icons.c.

Referenced by def_internal_vicon(), and icon_draw_size().

#define INIT_BRUSH_ICON (   icon_id,
  name 
)
Value:
bbuf = IMB_ibImageFromMemory((unsigned char*)datatoc_ ##name## _png,       \
                     datatoc_ ##name## _png_size, IB_rect, "<brush icon>");    \
    def_internal_icon(bbuf, icon_id, 0, 0, w, ICON_TYPE_BUFFER);               \
    IMB_freeImBuf(bbuf);

Referenced by init_brush_icons().


Typedef Documentation

typedef struct DrawInfo DrawInfo
typedef struct IconImage IconImage
typedef struct IconTexture IconTexture
typedef void(* VectorDrawFunc)(int x, int y, int w, int h, float alpha)

Definition at line 94 of file interface_icons.c.


Function Documentation

static void def_internal_icon ( ImBuf bbuf,
int  icon_id,
int  xofs,
int  yofs,
int  size,
int  type 
) [static]
static void def_internal_vicon ( int  icon_id,
VectorDrawFunc  drawFunc 
) [static]
static void free_iconfile_list ( struct ListBase list) [static]

Definition at line 674 of file interface_icons.c.

References BLI_freelinkN(), ListBase::first, IconFile::next, and NULL.

Referenced by UI_icons_free().

static int get_draw_size ( enum eIconSizes  size) [static]
static DrawInfo* icon_create_drawinfo ( void  ) [static]
static void icon_create_rect ( struct PreviewImage prv_img,
enum eIconSizes  size 
) [static]
static void icon_draw_at_size ( float  x,
float  y,
int  icon_id,
float  aspect,
float  alpha,
enum eIconSizes  size,
int  nocreate 
) [static]
static void icon_draw_rect ( float  x,
float  y,
int  w,
int  h,
float   UNUSEDaspect,
int  rw,
int  rh,
unsigned int *  rect,
float  alpha,
float *  rgb,
short  is_preview 
) [static]
static void icon_draw_size ( float  x,
float  y,
int  icon_id,
float  aspect,
float  alpha,
float *  rgb,
enum eIconSizes  size,
int  draw_size,
int   UNUSEDnocreate,
short  is_preview 
) [static]
static void icon_draw_texture ( float  x,
float  y,
float  w,
float  h,
int  ix,
int  iy,
int   UNUSEDiw,
int  ih,
float  alpha,
float *  rgb 
) [static]

Definition at line 908 of file interface_icons.c.

References IconTexture::id, IconTexture::invh, and IconTexture::invw.

Referenced by icon_draw_size().

static void icon_set_image ( bContext C,
ID id,
PreviewImage prv_img,
enum eIconSizes  size 
) [static]
static void init_brush_icons ( void  ) [static]

Definition at line 462 of file interface_icons.c.

References add(), addon::engine::draw(), INIT_BRUSH_ICON, mix(), and smooth().

Referenced by UI_icons_init().

static void init_iconfile_list ( struct ListBase list) [static]
static void init_internal_icons ( void  ) [static]
static int preview_render_size ( enum eIconSizes  size) [static]
void UI_icon_draw ( float  x,
float  y,
int  icon_id 
)
void UI_icon_draw_aspect ( float  x,
float  y,
int  icon_id,
float  aspect,
float  alpha 
)
void UI_icon_draw_aspect_color ( float  x,
float  y,
int  icon_id,
float  aspect,
float *  rgb 
)

Definition at line 1139 of file interface_icons.c.

References FALSE, get_draw_size(), icon_draw_size(), and ICON_SIZE_ICON.

Referenced by widget_draw_icon().

void UI_icon_draw_preview ( float  x,
float  y,
int  icon_id 
)

Definition at line 1155 of file interface_icons.c.

References icon_draw_at_size(), and ICON_SIZE_PREVIEW.

void UI_icon_draw_preview_aspect ( float  x,
float  y,
int  icon_id,
float  aspect 
)

Definition at line 1160 of file interface_icons.c.

References icon_draw_at_size(), and ICON_SIZE_PREVIEW.

void UI_icon_draw_preview_aspect_size ( float  x,
float  y,
int  icon_id,
float  aspect,
int  size 
)

Definition at line 1165 of file interface_icons.c.

References FALSE, icon_draw_size(), ICON_SIZE_PREVIEW, NULL, and TRUE.

Referenced by widget_draw_preview().

void UI_icon_draw_size ( float  x,
float  y,
int  size,
int  icon_id,
float  alpha 
)

Definition at line 1150 of file interface_icons.c.

References FALSE, icon_draw_size(), ICON_SIZE_ICON, NULL, and TRUE.

int UI_icon_get_height ( int  icon_id)
int UI_icon_get_width ( int  icon_id)
int UI_iconfile_get_index ( const char *  filename)
ListBase* UI_iconfile_list ( void  ) [read]

Definition at line 698 of file interface_icons.c.

References iconfilelist.

void UI_icons_free ( void  )

Definition at line 706 of file interface_icons.c.

References BKE_icons_free(), free_iconfile_list(), and IconTexture::id.

Referenced by ui_resources_free().

void UI_icons_free_drawinfo ( void *  drawinfo)
void UI_icons_init ( int  first_dyn_id)
static int ui_id_brush_get_icon ( bContext C,
ID id 
) [static]
static void ui_id_brush_render ( bContext C,
ID id 
) [static]
int ui_id_icon_get ( bContext C,
ID id,
int  big 
)
static void ui_id_icon_render ( bContext C,
ID id,
int  big 
) [static]
static void vicon_disclosure_tri_down_draw ( int  x,
int  y,
int  w,
int   UNUSEDh,
float  alpha 
) [static]
static void vicon_disclosure_tri_right_draw ( int  x,
int  y,
int  w,
int   UNUSEDh,
float  alpha 
) [static]
static void vicon_edit_draw ( int  x,
int  y,
int  w,
int  h,
float  alpha 
) [static]
static void vicon_editmode_dehlt_draw ( int  x,
int  y,
int  w,
int  h,
float   UNUSEDalpha 
) [static]
static void vicon_editmode_hlt_draw ( int  x,
int  y,
int  w,
int  h,
float  alpha 
) [static]
static void vicon_move_down_draw ( int  x,
int  y,
int  w,
int  h,
float   UNUSEDalpha 
) [static]

Definition at line 443 of file interface_icons.c.

References simple_enum_gen::d.

Referenced by init_internal_icons().

static void vicon_move_up_draw ( int  x,
int  y,
int  w,
int  h,
float   UNUSEDalpha 
) [static]

Definition at line 425 of file interface_icons.c.

References simple_enum_gen::d.

Referenced by init_internal_icons().

static void vicon_small_tri_right_draw ( int  x,
int  y,
int  w,
int   UNUSEDh,
float  alpha 
) [static]

Definition at line 378 of file interface_icons.c.

References simple_enum_gen::d, and viconutil_set_point().

Referenced by init_internal_icons().

static void vicon_view3d_draw ( int  x,
int  y,
int  w,
int  h,
float  alpha 
) [static]

Definition at line 276 of file interface_icons.c.

References simple_enum_gen::d, and MAX2.

Referenced by init_internal_icons().

static void vicon_x_draw ( int  x,
int  y,
int  w,
int  h,
float  alpha 
) [static]

Definition at line 252 of file interface_icons.c.

Referenced by init_internal_icons().

static void viconutil_draw_lineloop ( GLint(*)  pts[2],
int  numPoints 
) [static]

Definition at line 216 of file interface_icons.c.

References i.

Referenced by vicon_edit_draw(), and viconutil_draw_lineloop_smooth().

static void viconutil_draw_lineloop_smooth ( GLint(*)  pts[2],
int  numPoints 
) [static]
static void viconutil_draw_points ( GLint(*)  pts[2],
int  numPoints,
int  pointSize 
) [static]

Definition at line 234 of file interface_icons.c.

References i.

Referenced by vicon_edit_draw(), vicon_editmode_dehlt_draw(), and vicon_editmode_hlt_draw().

static void viconutil_draw_tri ( GLint(*)  pts[2]) [static]

Definition at line 207 of file interface_icons.c.

Referenced by vicon_editmode_hlt_draw().

static void viconutil_set_point ( GLint  pt[2],
int  x,
int  y 
) [static]

Variable Documentation

struct ListBase iconfilelist = {NULL, NULL} [static]

Definition at line 129 of file interface_icons.c.

Referenced by UI_iconfile_get_index(), and UI_iconfile_list().

IconTexture icongltex = {0, 0, 0, 0.0f, 0.0f} [static]

Definition at line 130 of file interface_icons.c.