Skip to content

Commit

Permalink
Preparing 1.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
agentphantom committed Aug 4, 2016
1 parent 6bc2f33 commit 8eb1a2a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ Some of the key features are:
- Generation of iOS launch screens for iPhones and iPads in Portrait and landscape modes.
- Free and open source!

To compile this application you only require a recent version of Apache Flex and Adobe AIR SDKs.
This application is based on the [Application Icons](http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d129907d2886-8000.html) article from AIR's site.

To compile this application you will require the [PNGEncoder2 library](https://github.com/cameron314/PNGEncoder2) and recent versions of Apache Flex and Adobe AIR SDKs.

[![Watch on Youtube](http://i.imgur.com/gs6kUfV.png)](https://www.youtube.com/watch?v=h70VlVhbKW8)

## Download

You can test this app by downloading it directly from GitHub. You only require to have the AIR runtime installed on your Windows or OSX machine.

[![Download](http://i.imgur.com/3C3qwtv.png)](https://github.com/PhantomAppDevelopment/icon-generator/releases/download/1.0.0/IconGenerator.air)
[![Download](http://i.imgur.com/333OC0X.png)](https://github.com/PhantomAppDevelopment/icon-generator/releases/download/1.0.0/IconGenerator.air)

## Donations

Expand Down
Binary file added libs/PNGEncoder2.swc
Binary file not shown.
2 changes: 1 addition & 1 deletion src/IconGenerator-app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Values can also be 1-part or 2-part. It is not necessary to have a 3-part value.
An updated version of application must have a versionNumber value higher than the previous version. Required for namespace >= 2.5 .
For iOS Apps, this represents build number. -->
<versionNumber>1.0.0</versionNumber>
<versionNumber>1.0.2</versionNumber>

<!-- A string value (such as "v1", "2.5", or "Alpha 1") that represents the version of the application, as it should be shown to users.
For iOS Apps, this represents application version number and format should be (<0-999>.<0-999>.<0-999>).
Expand Down
33 changes: 16 additions & 17 deletions src/views/IconView.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
<![CDATA[
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.graphics.codec.PNGEncoder;

import spark.components.CheckBox;
import spark.events.IndexChangeEvent;
Expand All @@ -22,10 +21,11 @@
[Bindable] private var preset3:Array;

private var fileRef:FileReference;
private var myEncoder:PNGEncoder;

protected function init(event:FlexEvent):void
{
PNGEncoder2.level = CompressionLevel.FAST;

AllArray = new Array(29, 36, 40, 48, 50, 57, 58, 60, 72, 75, 76, 80, 87, 96, 100, 114, 120, 144, 152, 167, 180, 192, 512, 1024);
AndroidArray = new Array(36, 48, 72, 96, 144, 192, 512);
iOSArray = new Array(29, 40, 48, 50, 57, 58, 60, 72, 75, 76, 80, 87, 100, 114, 120, 144, 152, 167, 180, 512, 1024);
Expand Down Expand Up @@ -97,18 +97,7 @@
checkBoxGroup.addElement(createCheckBox(optionsList.selectedItem.data[i]));
}
}

private function scaleIcon(iconBitmapData:BitmapData, thumbnailWidth:Number, thumbnailHeight:Number):BitmapData
{
var matrix:Matrix = new Matrix();
matrix.scale(thumbnailWidth / iconBitmapData.width, thumbnailHeight / iconBitmapData.height);

var scaledBitmapData:BitmapData = new BitmapData(thumbnailWidth, thumbnailHeight, true, 0x000000);
scaledBitmapData.draw(iconBitmapData, matrix);

return scaledBitmapData;
}


private function createCheckBox(iconSizeName:String):CheckBox
{
var checkBox:CheckBox = new CheckBox();
Expand All @@ -132,12 +121,11 @@

if(tempCheckBox.selected == true){

var tempEncoder:PNGEncoder = new PNGEncoder();
var file:File = File.desktopDirectory.resolvePath("./launchicons-"+folderName+"/icon-"+tempCheckBox.name+".png");

var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(tempEncoder.encode(scaleIcon(iconLarge.bitmapData, Number(tempCheckBox.name), Number(tempCheckBox.name))));
fileStream.writeBytes(PNGEncoder2.encode(scaleIcon(iconLarge.bitmapData, Number(tempCheckBox.name), Number(tempCheckBox.name))));
fileStream.close();
}
}
Expand All @@ -161,9 +149,20 @@
xmlFileStream.writeUTFBytes(xmlString);
xmlFileStream.close();

Alert.show("Icons successfully generated at Desktop/launchimages-" + String(folderName), "Icons Generated");
Alert.show("Icons successfully generated at Desktop/launchicons-" + String(folderName), "Icons Generated");
}

private function scaleIcon(iconBitmapData:BitmapData, thumbnailWidth:Number, thumbnailHeight:Number):BitmapData
{
var matrix:Matrix = new Matrix();
matrix.scale(thumbnailWidth / iconBitmapData.width, thumbnailHeight / iconBitmapData.height);

var scaledBitmapData:BitmapData = new BitmapData(thumbnailWidth, thumbnailHeight, true, 0x000000);
scaledBitmapData.drawWithQuality(iconBitmapData, matrix, null, null, null, true);

return scaledBitmapData;
}

]]>
</fx:Script>

Expand Down
13 changes: 6 additions & 7 deletions src/views/ImagesView.mxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import mx.controls.Alert;

import mx.events.FlexEvent;
import mx.graphics.codec.PNGEncoder;

[Bindable] private var AllArray:Array;
[Bindable] private var iPhoneAllArray:Array;
Expand All @@ -18,10 +17,11 @@
[Bindable] private var iPadLandscapeArray:Array;

private var fileRef:FileReference;
private var myEncoder:PNGEncoder;

protected function init(event:FlexEvent):void
{
PNGEncoder2.level = CompressionLevel.FAST;

AllArray = new Array(
{name:"iPhone", file:"Default~iphone.png", w:320, h:480},
{name:"iPhone 4,4s", file:"Default@2x~iphone.png", w:640, h:960},
Expand Down Expand Up @@ -145,12 +145,11 @@

for (var i:uint = 0; i<optionsList.selectedItem.data.length; i++)
{
var tempEncoder:PNGEncoder = new PNGEncoder();
var file:File = File.desktopDirectory.resolvePath("./launchimages-"+folderName+"/"+optionsList.selectedItem.data[i].file);

var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(tempEncoder.encode(scaleImage(imageLarge.bitmapData, optionsList.selectedItem.data[i].w, optionsList.selectedItem.data[i].h)));
fileStream.writeBytes(PNGEncoder2.encode(scaleImage(imageLarge.bitmapData, optionsList.selectedItem.data[i].w, optionsList.selectedItem.data[i].h)));
fileStream.close();

}
Expand All @@ -164,13 +163,13 @@
matrix.scale(thumbnailWidth / imageBitmapData.width, thumbnailHeight / imageBitmapData.height);

var scaledBitmapData:BitmapData = new BitmapData(thumbnailWidth, thumbnailHeight, true, 0x000000);
scaledBitmapData.draw(imageBitmapData, matrix);
scaledBitmapData.drawWithQuality(imageBitmapData, matrix, null, null, null, true);

return scaledBitmapData;
}

]]>
</fx:Script>

</fx:Script>

<s:states>
<s:State name="HomeState"/>
Expand Down

0 comments on commit 8eb1a2a

Please sign in to comment.