1 /* 2 * Copyright 2006, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #include "BitmapSetSaver.h" 10 11 #include <stdio.h> 12 13 #include "BitmapExporter.h" 14 15 // constructor 16 BitmapSetSaver::BitmapSetSaver(const entry_ref& ref) 17 : FileSaver(ref) 18 { 19 } 20 21 // destructor 22 BitmapSetSaver::~BitmapSetSaver() 23 { 24 } 25 26 // Save 27 status_t 28 BitmapSetSaver::Save(Document* document) 29 { 30 entry_ref actualRef(fRef); 31 char name[B_OS_NAME_LENGTH]; 32 33 // 64x64 34 sprintf(name, "%s_64.png", fRef.name); 35 actualRef.set_name(name); 36 Exporter* exporter = new BitmapExporter(64); 37 exporter->SetSelfDestroy(true); 38 exporter->Export(document, actualRef); 39 40 // 16x16 41 sprintf(name, "%s_16.png", fRef.name); 42 actualRef.set_name(name); 43 exporter = new BitmapExporter(16); 44 exporter->SetSelfDestroy(true); 45 exporter->Export(document, actualRef); 46 47 // 32x32 48 sprintf(name, "%s_32.png", fRef.name); 49 actualRef.set_name(name); 50 exporter = new BitmapExporter(32); 51 exporter->SetSelfDestroy(true); 52 exporter->Export(document, actualRef); 53 54 return B_OK; 55 } 56 57