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 <String.h> 14 15 #include "BitmapExporter.h" 16 17 18 // constructor 19 BitmapSetSaver::BitmapSetSaver(const entry_ref& ref) 20 : FileSaver(ref) 21 { 22 } 23 24 25 // destructor 26 BitmapSetSaver::~BitmapSetSaver() 27 { 28 } 29 30 31 // Save 32 status_t 33 BitmapSetSaver::Save(Document* document) 34 { 35 entry_ref actualRef(fRef); 36 BString name; 37 38 int sizes[] = { 64, 32, 16 }; 39 40 for (size_t i = 0; i < B_COUNT_OF(sizes); i++) { 41 name.SetToFormat("%s_%d.png", fRef.name, sizes[i]); 42 actualRef.set_name(name.String()); 43 Exporter* exporter = new BitmapExporter(sizes[i]); 44 exporter->SetSelfDestroy(true); 45 exporter->Export(document, actualRef); 46 } 47 48 return B_OK; 49 } 50