Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiles Info PLIST and option to skip transparent tiles & CMDLineTool #4

Open
wants to merge 42 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
aaa244b
Added tilesInfo to TileOperation.
psineur Apr 25, 2011
9a4c068
Added allTilesInfo, that holds info about all tiles from last save.
psineur Apr 25, 2011
6b02814
Added autosaving plist file. A lot of duplicates now.
psineur Apr 25, 2011
44cac0f
Fixed duplicates in Plist file.
psineur Apr 25, 2011
7020f53
Fixed PLIST output size for any source Image Sizes.
psineur Apr 26, 2011
04f443f
Added 'Skip Transparent Tiles' checkbox to main View.
psineur Apr 26, 2011
b14320b
Added skipTransparentTiles property to tile Operation.
psineur Apr 26, 2011
24de796
Fixed skip checkbox binding.
psineur Apr 26, 2011
3c939cd
Added isAbsoluteTransparent method to NSBitmapImageRep
psineur Apr 26, 2011
e211bde
Added transparent tiles analyzed save if skipTransparentTiles is set
psineur Apr 26, 2011
aa2efb7
Added source image info to the Plist output.
psineur Apr 27, 2011
758b8e2
Added commandLine tool target
psineur Apr 28, 2011
83693bc
Moved Tiling Logics to TileCutterCore
psineur Apr 28, 2011
0d19983
Moved more stuff to TileCutterCore. AppDelegate compiles OK
psineur Apr 28, 2011
6b207ff
Fixed compiler errors & warnings
psineur Apr 28, 2011
1b7e674
Added outputSuffix to tileOperation
psineur Apr 28, 2011
3ff3b51
Fixed possible memory leaks.
psineur Apr 28, 2011
1d35922
Added TileCutterCore use to cmdLineTool
psineur Apr 28, 2011
05dfdb7
Moved fileFormat enum to TileCutterSettings.h
psineur Apr 28, 2011
71f2b54
Assigned needed *.m files for cmd tool target. Builds OK
psineur Apr 28, 2011
5ad3b12
Little Usage Output fixes.
psineur Apr 28, 2011
bfe4cf9
Moved threadSafety from TileOperation to TileCutterCore
psineur Apr 28, 2011
2a5f3b2
Added suffix to PLIST filename.
psineur Apr 28, 2011
1f18eed
Updated README
psineur Apr 28, 2011
b948c37
Merge branch 'commandLineTool' into develop
psineur Apr 28, 2011
c9bec8f
Added AggregateTarget for both GUI app & cmdLine tool
psineur Apr 28, 2011
7b00139
Fix "(null)" suffix in plist filename, if suffix isn't set
psineur Apr 30, 2011
0d17269
Performance & Mem Optimization: Serial queue with shared ImageRep
psineur May 1, 2011
9b5ffa6
Added zero-out for non-image zone pixels
psineur May 3, 2011
fb9c1ef
Added rigidSize attribute to subImage method.
psineur May 3, 2011
c5cd177
Added rigidTiles property to Operation and Core
psineur May 3, 2011
fbcc4ab
Added --rigidTilesSize option to cmdLine tool
psineur May 3, 2011
1414d82
Updated README
psineur May 3, 2011
11628db
Merge branch 'infrangibleTiles' into develop
psineur May 3, 2011
d69c7a7
Added info about flags to cmdLine tool usage output.
psineur May 8, 2011
db067cf
Added contentScale option to cmdLine Tool
psineur May 9, 2011
4ec1e29
Added usage output for --contentScaleFactor
psineur May 9, 2011
a61e7e9
Implemented scaleFactor in Core & grouped saving plist in one method
psineur May 9, 2011
5710ebc
Fixed compiler errors
psineur May 9, 2011
40ca402
Fixed "mutated while being enumerated" crashes
psineur May 9, 2011
86b5b43
Added file existence check in cmdLine Tool
psineur May 9, 2011
b5dbc5b
Added --roundTileSizeToPOT option flag. Closes #5
psineur Jul 25, 2011
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
708 changes: 681 additions & 27 deletions English.lproj/MainMenu.xib

Large diffs are not rendered by default.

28 changes: 27 additions & 1 deletion NSBitmapImageRep-Tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,33 @@


@interface NSBitmapImageRep(Tile)
-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth tileHeight:(CGFloat)tileHeight column:(NSUInteger)column row:(NSUInteger)row;

-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth
tileHeight:(CGFloat)tileHeight
column:(NSUInteger)column
row:(NSUInteger)row;

// Same as previous, but if rigid = YES - adds black pixels to fill
// all tileWidthxtileHeight zone, if there's no enough pixels in image
-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth
tileHeight:(CGFloat)tileHeight
column:(NSUInteger)column
row:(NSUInteger)row
rigidSize:(BOOL) rigid;

/** Designated method.
*
* @param potSize If YES - tile width & height will be rounded to nearest POT value, larger then existing.
* potSize have no effect if rigidSize is YES.
*
*/
-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth
tileHeight:(CGFloat)tileHeight
column:(NSUInteger)column
row:(NSUInteger)row
rigidSize:(BOOL) rigid
POTSize:(BOOL) potSize;

-(NSUInteger)columnsWithTileWidth:(CGFloat)tileWidth;
-(NSUInteger)rowsWithTileHeight:(CGFloat)tileHeight;

Expand Down
50 changes: 44 additions & 6 deletions NSBitmapImageRep-Tile.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,29 @@


@implementation NSBitmapImageRep(Tile)
-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth tileHeight:(CGFloat)tileHeight column:(NSUInteger)column row:(NSUInteger)row
-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth
tileHeight:(CGFloat)tileHeight
column:(NSUInteger)column
row:(NSUInteger)row
{
return [self subImageWithTileWidth:tileWidth tileHeight:tileHeight column: column row:row rigidSize: NO POTSize: NO];
}

-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth
tileHeight:(CGFloat)tileHeight
column:(NSUInteger)column
row:(NSUInteger)row
rigidSize:(BOOL) rigid
{
return [self subImageWithTileWidth:tileWidth tileHeight:tileHeight column: column row:row rigidSize: NO POTSize: NO];
}

-(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth
tileHeight:(CGFloat)tileHeight
column:(NSUInteger)column
row:(NSUInteger)row
rigidSize:(BOOL) rigid
POTSize:(BOOL) potSize
{
int width = [self pixelsWide];
int height = [self pixelsHigh];
Expand All @@ -25,10 +47,13 @@ -(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth tileHeight:(CGFloat)tileHei
int lastCol;
int outputWidth;

if (theCol + tileWidth > width) // last column, not full size
if ( !rigid && (theCol + tileWidth > width) ) // last column, not full size
{
lastCol = width;
outputWidth = (width - theCol);

if (potSize)
outputWidth = (int)pow( 2, ceil(log2((double)outputWidth)));
}
else
{
Expand All @@ -37,11 +62,13 @@ -(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth tileHeight:(CGFloat)tileHei
}

int lastRow, outputHeight;
if (theRow + tileHeight > height)
if ( !rigid && (theRow + tileHeight > height) )
{
lastRow = height;
outputHeight = (height - theRow);


if (potSize)
outputHeight = (int)pow( 2, ceil(log2((double)outputHeight)));
}
else
{
Expand Down Expand Up @@ -74,8 +101,19 @@ -(NSImage *)subImageWithTileWidth:(CGFloat)tileWidth tileHeight:(CGFloat)tileHei
{
p1 = srcData + bytesPerPixel * (y * width + x);
p2 = destData + bytesPerPixel * ((y - theRow) * width + (x - theCol));
for (i = 0; i < bytesPerPixel; i++)
p2[i] = p1[i];

if ( x >= width || y >= height)
{
// fill with zeroes pixels outside self.size
for (i = 0; i < bytesPerPixel; i++)
p2[i] = 0;
}
else
{
// copy pixels as usual
for (i = 0; i < bytesPerPixel; i++)
p2[i] = p1[i];
}
}
}

Expand Down
1 change: 0 additions & 1 deletion README

This file was deleted.

28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Tile-Cutter (by Jeff LaMarche)
=================

Tile Cutter is an open source under the non-viral MIT license.
Tile Cutter will take a large image and split it up into smaller tiles. I created this for use in a CATiledLayer-backed view for an iPad application, but it could be used for a number of other purposes.


This Fork (by Stepan Generalov)
================

In this fork of Tile Cutter there was added some things:

1. Plist file, that have info about tiles position and source image size.
2. Skipping of absolutely transparent tiles
3. Command Line Tool
4. Rigid Tile Size (can be useful if you need fixed tile size, even if image don't fit)


There's some minor issues in this fork, that i probably will not fix, cause everything is working fine for me now:

1. You can't choose other than PNG file type in commandLine tool.
2. You can't set suffix in GUI.
3. There's no progressBar in commandLine tool. Here's a link, that maybe can help you with implementing non-duplicating progress bar: http://en.wikipedia.org/wiki/ANSI_escape_code
4. rigidTilesSize option is available only in commandLine tool. (It allows you to have all tiles with equal size with black pixels that is out of image area)

If you're using Tile-Cutter and experiencing some issues - feel free to open new Issues or Pull Requests in this Repo.


Loading