1/* 2 * Copyright 2012, Gerasim Troeglazov, 3dEyes@gmail.com. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 6#ifndef ICNS_LOADER_H 7#define ICNS_LOADER_H 8 9#include <stdlib.h> 10#include <stdio.h> 11#include <string.h> 12 13#include <Translator.h> 14#include <TranslatorFormats.h> 15#include <TranslationDefs.h> 16#include <GraphicsDefs.h> 17#include <InterfaceDefs.h> 18#include <DataIO.h> 19#include <File.h> 20#include <ByteOrder.h> 21#include <List.h> 22 23extern "C" { 24#include "icns.h" 25} 26 27#define IS_SPUPPORTED_TYPE(type) ((type) == ICNS_1024x1024_32BIT_ARGB_DATA || \ 28 (type) == ICNS_512x512_32BIT_ARGB_DATA || \ 29 (type) == ICNS_256x256_32BIT_ARGB_DATA || \ 30 (type) == ICNS_128X128_32BIT_DATA || \ 31 (type) == ICNS_48x48_32BIT_DATA || \ 32 (type) == ICNS_32x32_32BIT_DATA || \ 33 (type) == ICNS_16x16_32BIT_DATA) 34 35icns_type_t ICNSFormat(float width, float height, color_space colors); 36 37class ICNSLoader { 38public: 39 ICNSLoader(BPositionIO *stream); 40 ~ICNSLoader(); 41 42 int IconsCount(void); 43 int GetIcon(BPositionIO *target, int index); 44 bool IsLoaded(void); 45private: 46 icns_family_t* fIconFamily; 47 int fIconsCount; 48 size_t fStreamSize; 49 BList fFormatList; 50 bool fLoaded; 51}; 52 53class ICNSSaver { 54public: 55 ICNSSaver(BPositionIO *stream, uint32 rowBytes, 56 icns_type_t type); 57 ~ICNSSaver(); 58 59 int SaveData(BPositionIO *target); 60 bool IsCreated(void); 61private: 62 icns_family_t* fIconFamily; 63 bool fCreated; 64 65}; 66 67 68#endif /* ICNS_LOADER_H */ 69