📄 fad.utils.c
字号:
/** * libFAD - Flash Animation Decode library * Copyright (C) 2005-2006 VGSystem Technologies, Inc. * * libFAD is the legal property of its developers, whose names are too numerous * to list here. Please refer to the COPYRIGHT file distributed with this * source distribution. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: fad.utils.c,v 1.9 2006/03/08 07:39:12 wrxzzj Exp $ */#include "fad.types.h"s32_t fad_point_in_rect(rect_t *rt, s32_t x, s32_t y) { return (x>rt->x0 && x<rt->x1 && y>rt->y0 && y<rt->y1);}void fad_rect_do_matrix(rect_t *rt, cairo_matrix_t *mx) { rect_t new; s32_t x0 = mx->x0*20, y0 = mx->y0*20; new.x0 = rt->x0*mx->xx + rt->y0*mx->xy + x0; new.y0 = rt->x0*mx->yx + rt->y0*mx->yy + y0; new.x1 = rt->x1*mx->xx + rt->y1*mx->xy + x0; new.y1 = rt->x1*mx->yx + rt->y1*mx->yy + y0; *rt = new;}void fad_rect_do_merge(rect_t *dirty, rect_t *rt) { if(dirty->x0 > rt->x0) dirty->x0 = rt->x0; if(dirty->x1 < rt->x1) dirty->x1 = rt->x1; if(dirty->y0 > rt->y0) dirty->y0 = rt->y0; if(dirty->y1 < rt->y1) dirty->y1 = rt->y1;}/**check IF static rectangle over dynamic rectangle*/s32_t fad_rect_check_over(rect_t *srt, rect_t *drt) { s32_t bx = FAD_FALSE, by = FAD_FALSE; if((drt->x0-srt->x0>0 && drt->x0-srt->x1<0)||(drt->x1-srt->x0>0 && drt->x1-srt->x1<0)) bx = FAD_TRUE; if((drt->y0-srt->y0>0 && drt->y0-srt->y1<0)||(drt->y1-srt->y0>0 && drt->y1-srt->y1<0)) by = FAD_TRUE; return bx&&by;}const char* fad_frame_stastr(u32_t sta) { const char* str = NULL; switch(sta) { case FAD_STA_INIT: str = "STATUS-INIT"; break; case FAD_STA_DOTAG: str = "STATUS-DOTAG"; break; case FAD_STA_DORENDER: str = "STATUS-DORENDER"; break; case FAD_STA_FINISH: str = "STATUS-FINISH"; break; } return str;}const char* fad_stream_errstr(u32_t err) { const char* str = NULL; switch(err) { case FAD_ERROR_MEM: str = "ERROR-MEMORY"; break; case FAD_ERROR_BUFLEN: str = "ERROR-BUFFER-LENGTH"; break; case FAD_ERROR_FORMAT: str = "ERROR-SWF-FORMAT"; break; case FAD_ERROR_IO: str = "ERROR-IO-FILE"; break; case FAD_ERROR_ZLIB: str = "ERROR-ZLIB"; break; case FAD_ERROR_TAG: str = "ERROR-UNKNOWN-TAG"; break; } return str;}const char* fad_object_type_to_string(u8_t type) { const char* str = NULL; switch(type) { case FO_TYPE_BITMAP: str = "BITMAP"; break; case FO_TYPE_JPEG: str = "JPEG"; break; case FO_TYPE_GLYPHFONT: str = "GLYPH FONT"; break; case FO_TYPE_STYLESHAPE: str = "STYLE SHAPE"; break; case FO_TYPE_MORPHSHAPE: str = "MORPHING SHAPE"; break; case FO_TYPE_BUTTON: str = "BUTTON"; break; case FO_TYPE_SPRITE: str = "SPRITE"; break; case FO_TYPE_STATICTEXT: str = "STATIC TEXT"; break; default: str = "??????"; break; } return str;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -