Strict Standards: Only variables should be passed by reference in /home/abeall/public_html/fireworks/download.php on line 28

Warning: Cannot modify header information - headers already sent by (output started at /home/abeall/public_html/fireworks/download.php:28) in /home/abeall/public_html/fireworks/download.php on line 44
// Fireworks JavaScript Command // Converts strokes to fills, like Flash // Install by copying to Fireworks/Configuration/Commands/ // Run in Fireworks via the Commands menu // Aaron Beall 2008-2011 - http://abeall.com // Version 1.1 /* BUGS - resulting stroke-paths are not in same layer depth as original path. this is because convertMarqueeToPath does not respect layer depth -- restoring layer depth is tedius - [FIXED] if the stroke is too light (ie ink amount) the operation fails, but a blank path is still left over. solution: set ink amount to 100 then use old ink amount as opacity on resulting path - [FIXED] brush texture causes overly complex results, because of the scale up routine. solution: don't scale up when texture is active - [FIXED-v1.1] for..in loop conflicts with prototypes */ var dom = fw.getDocumentDOM(); var sel = [].concat(fw.selection); function StrokeToFill(){ // require active document if (!dom) return false; // validate selection var paths = [], strokedPaths = []; for(var s in sel){ if(sel[s] == '[object Path]' || sel[s] == '[object RectanglePrimitive]'){ paths.push(sel[s]); if(sel[s].pathAttributes.brush) strokedPaths.push(sel[s]); } } if(!paths.length) return alert("This command requires a selection of at least one path."); if(!strokedPaths.length) return alert("Your path"+(paths.length>1?"s":"")+" must have "+(paths.length>1?"strokes":"a stroke")+" to complete this command."); // convert strokes to paths paths = strokedPaths; var strokePaths = [], fillPaths = [], opacity, strokeColor, inkAmount, blendMode, scaleUp, scaleUpAfterFlatten, SCALE_AMOUNT = 4, MIN_STROKE_SIZE = 50, MIN_OBJECT_SIZE = Math.max(dom.width,dom.height); var p = paths.length; while(p--){ fw.selection = [paths[p]]; dom.ungroup(); strokeColor = fw.selection[0].pathAttributes.brushColor; // if path cotains fill, separate stroke and keep path with fill if(fw.selection[0].pathAttributes.fill){ var originalPath = fw.selection[0]; dom.cloneSelection(); var tempPath = fw.selection[0]; fw.selection = [originalPath]; dom.setBrush(null); fillPaths.push(fw.selection[0]); fw.selection = [tempPath]; dom.setFill(null); } // scale up in below threshold size, larger bitmaps will create more accurate path conversion scaleUp = scaleUpAfterFlatten = false; if((fw.selection[0].width < MIN_OBJECT_SIZE || fw.selection[0].height < MIN_OBJECT_SIZE) && fw.selection[0].pathAttributes.brush.diameter < MIN_STROKE_SIZE){ scaleUp = true; if(fw.selection[0].pathAttributes.brush.textureBlend > 50){ scaleUpAfterFlatten = true; }else{ dom.scaleSelection(SCALE_AMOUNT,SCALE_AMOUNT,"autoTrimImages transformAttributes"); } } // set opacity amount to maximum so conversion picks it up opacity = fw.selection[0].opacity; dom.setOpacity(100); inkAmount = 100; if(fw.selection[0].pathAttributes.brush.concentration!=100){ inkAmount = fw.selection[0].pathAttributes.brush.concentration; fw.selection[0].pathAttributes.brush.concentration = 100; } blendMode = fw.selection[0].blendMode; dom.setBlendMode("normal"); // flatten and convert to path dom.flattenSelection(); if(scaleUpAfterFlatten) dom.scaleSelection(SCALE_AMOUNT,SCALE_AMOUNT,"autoTrimImages transformAttributes"); var tempBitmap = "__STROKE_TO_FILL_TEMP_BITMAP__"+(new Date()).toString(); fw.selection[0].name = tempBitmap; dom.enterPaintMode(); dom.selectAll(); dom.moveSelectionBy({x:0, y:0}, false, true); // forces Select All to become only opaque pixels dom.convertMarqueeToPath(); // scale back down if scaled up if(scaleUp) dom.scaleSelection(1/SCALE_AMOUNT,1/SCALE_AMOUNT,"autoTrimImages transformAttributes"); // set styles dom.setBrush(null); dom.setFill(new Fill()); fw.selection[0].pathAttributes.fillColor = strokeColor; dom.setOpacity(opacity*(inkAmount/100)); dom.setBlendMode(blendMode); // add to future selection strokePaths.push(fw.selection[0]); // delete temp bitmap fw.selection = dom.findNamedElements(tempBitmap); dom.deleteSelection(false); } // select all resulting objects fw.selection = fillPaths.concat(strokePaths); } //try{ StrokeToFill(); //}catch(e){ alert([e, e.lineNumber, e.fileName].join("\n")) };