awtk/tools/theme_gen/xml_theme_gen.cc

44 lines
1.2 KiB
C++
Raw Normal View History

2018-02-21 19:36:38 +08:00
/**
* File: xml_gen.c
2018-05-15 09:31:58 +08:00
* Author: AWTK Develop Team
2018-02-21 19:36:38 +08:00
* Brief: generate theme date from xml
*
2020-01-01 11:27:36 +08:00
* Copyright (c) 2018 - 2020 Guangzhou ZHIYUAN Electronics Co.,Ltd.
2018-02-21 19:36:38 +08:00
*
* 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
* License file for more details.
*
*/
/**
* History:
* ================================================================
* 2018-01-19 Li XianJing <xianjimli@hotmail.com> adapted from ftk.
*
*/
2022-05-02 16:54:00 +08:00
#include "tkc/fs.h"
#include "base/theme_xml.h"
#include "tkc/asset_info.h"
2018-02-21 19:36:38 +08:00
#include "common/utils.h"
2020-03-23 12:16:07 +08:00
bool xml_gen(const char* input_file, const char* output_file, const char* theme,
bool_t output_bin) {
2018-02-21 19:36:38 +08:00
return_value_if_fail(input_file != NULL && output_file != NULL, false);
2022-05-02 16:54:00 +08:00
char* xml = (char*)file_read(input_file, NULL);
return_value_if_fail(xml != NULL, false);
uint32_t size = 0;
uint8_t* data = theme_xml_gen(xml, &size);
return_value_if_fail(data != NULL, false);
if (output_bin) {
write_file(output_file, data, size);
} else {
output_res_c_source(output_file, theme, ASSET_TYPE_STYLE, 0, data, size);
}
2018-02-21 19:36:38 +08:00
return true;
}