Yes... It's a black canvas...with a square.
Search This Blog
Monday, November 5, 2018
WebGL Tutorial: Adding 2D content to a WebGL context
Yes... It's a black canvas...with a square.
IE Custom Search Add-ins
http://www.enhanceie.com/ie/searchbuilder.asp
I find this custom search addin tool to be useful, but even so, some sites have special search interfaces
I find this custom search addin tool to be useful, but even so, some sites have special search interfaces
WebGL Tutorial: Getting started with WebGL
Yes... It's a black canvas.
Wednesday, October 10, 2018
Java SVG Maker
Sick again at home and I decided to do the same program in Java!
Got to my last post for some background: Powershell SVG Maker
Here's the code...
Here's the run line...
java SVGMaker LesleyatHonda.12.Dither.Part.White.png LesleyatHonda.12.Dither.Part.White.svg
Producing...
Got to my last post for some background: Powershell SVG Maker
Here's the code...
import java.io.IOException;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.awt.image.BufferedImage;
public class SVGMaker {
public static void main(String[] args) {
String inFilePath = args[0]; //
"LesleyatHonda.12.Dither.Part.White.png";
String outFilePath = args[1]; //"LesleyatHonda.12.Dither.Part.White.svg";
int SVGScale = 10;
String newLine = System.lineSeparator();
try {
BufferedImage image = ImageIO.read(new File(inFilePath));
File outFile = new File(outFilePath);
FileOutputStream OutFOS = new FileOutputStream(outFile);
OutputStreamWriter outOSW = new OutputStreamWriter(OutFOS,"UTF-8");
outOSW.write("<xml version\"1.0\" encoding=\"UTF-8\"?>");outOSW.write(newLine);
outOSW.write("<svg version\"1.1\" baseProfile=\"full\" width=\""+(image.getWidth()*SVGScale)+"\" height=\""+(image.getHeight()*SVGScale)+"\" xmlns=\"http://www.w3.org/2000/svg\">");outOSW.write(newLine);
for (int ypos = 0 ; ypos < image.getHeight() ; ypos++ ) {
for (int xpos = 0 ; xpos < image.getWidth() ; xpos++ ) {
int pixel = image.getRGB(xpos,ypos);
int pAlpha = (pixel>>24) & 0xff;
int pRed = (pixel>>16) & 0xff;
int pGreen = (pixel>>8) & 0xff;
int pBlue = pixel & 0xff;
outOSW.write("<rect Fill\"#"+String.format("%02X",pRed)+String.format("%02X",pGreen)+String.format("%02X",pBlue)+"\" x=\""+(xpos*SVGScale)+"\" y=\""+(ypos*SVGScale)+"\" width=\""+SVGScale+"\" height=\""+SVGScale+"\"/>");outOSW.write(newLine);
}
}
outOSW.write("</svg>"");outOSW.write(newLine);
outOSW.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Here's the run line...
java SVGMaker LesleyatHonda.12.Dither.Part.White.png LesleyatHonda.12.Dither.Part.White.svg
Producing...
Tuesday, October 9, 2018
Powershell SVG Maker
I was going to sit around ill at hone and make an SVG one little square at a time in Inkscape of this image I use...


However, after 4 dots I got bored.
I know that an SVG file is an XML based descriptor of images and shapes and know that I can use minimal information to make a test file that is similar to the following 2x2 block...
<rect fill="#000000" x="0" y="0" width="10" height="10"/>
<rect fill="#000000" x="10" y="0" width="10" height="10"/>
<rect fill="#ffffff" x="0" y="10" width="10" height="10"/>
<rect fill="#000000" x="10" y="10" width="10" height="10"/>
</svg >
<xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" baseProfile="full" width="20" height="20" xmlns="http://www.w3.org/2000/svg">
<svg version="1.1" baseProfile="full" width="20" height="20" xmlns="http://www.w3.org/2000/svg">
</svg
So... by grabbing the image, and looping through the pixels we can create all the rects we need. we can even keep the original color of the pixels. This routine also has a scaling factor in it.
$FilePath = 'LesleyatHonda.12.Dither.Part.White.png'
$Image = [System.Drawing.Image]::FromFile($filePath)
# Simple dirty UTF-8 outfile << THIS IS MPORTANT!!
$OutFilePath = 'LesleyatHonda.svg'
$SVGScale = 10
'<?xml version="1.0" encoding="UTF-8"?>' | Out-File $OutFilePath -Encoding utf8
'<svg version="1.1" baseProfile="full" width="'+($Image.Width*$SVGScale)+'" height="'+($Image.Width*$SVGScale)+'" xmlns="http://www.w3.org/2000/svg">' | Out-File $OutFilePath -Append -Encoding utf8
For($ypos=0;$ypos -lt $Image.Height;$ypos++){
For($xpos=0;$xpos -lt $Image.Width;$xpos++){
$Pixel = $Image.GetPixel($xpos,$ypos)
'<rect fill="#'+($Pixel.Name.substring(2,6))+'" x="'+($xpos*$SVGScale)+'" y="'+($ypos*$SVGScale)+'" width="'+$SVGScale+'" height="'+$SVGScale+'"/>' | Out-File $OutFilePath -Append -Encoding utf8
}
};
'</svg>' | Out-File $OutFilePath -Append -Encoding utf8
Thursday, October 4, 2018
Notes View Exporter
Modify the variables at the top and let'r rip!
## Notes View Exporter in Powershell
Set-Location 'C:\Program
Files (x86)\IBM\Notes' ## Notes Program Dir
$dominoServiceName = 'Appsrv001/MyCompany'
$dbName = 'names.nsf'
$viewName = 'Groups'
$session = $null; $session
= New-Object
-ComObject Lotus.NotesSession;
$session.Initialize();
'Notes version: '+$session.NotesVersion
$db = $null; $db = $session.GetDatabase($DominoServiceName, $dbName, 1);'DB Title: '+$db.Title
$view = $null; $view
= $db.GetView($viewName);'Entry Count: '+$view.EntryCount
$oOut=@();
$count =
0; $dtStart = (get-date)
if($view.EntryCount -gt
0){
$doc = $view.getFirstDocument();
$viewcolumns
= $view
| select -ExpandProperty Columns
While ($doc -ne $null){
if
(($count/100) -eq [int]($count/100)){$dtCurr = (get-date); 'Count: '+$count+' of '+$view.EntryCount+': '+$dtCurr.Hour.ToString('#0')+':'+$dtCurr.Minute.ToString('#0')+':'+$dtCurr.Second.ToString('#0')+'.'+$dtCurr.Millisecond.ToString('###0')}
$oItem
= $null;
$oItem =
New-Object PSObject
for
($i=0;$i-lt$viewcolumns.count;$i++){
$val=$null;$val=if($viewcolumns[$i].Formula -gt
''){$viewcolumns[$i].Formula}else{$viewcolumns[$i].Itemname};
$oItem
= $oItem
| Add-Member
@{(''+$i+'. '+$viewcolumns[$i].title)=[string]''+($session.Evaluate($val,$doc))} -PassThru
};
$oOut
+= $oItem
$doc=$view.GetNextDocument($doc);
$count++
}
}
$YYYYMMDDhhmmss = $dtStart.year.ToString('###0')+$dtStart.Month.ToString('#0')+$dtCurr.Day.ToString('#0')+$dtCurr.Hour.ToString('#0')+$dtCurr.Minute.ToString('#0')+$dtCurr.Second.ToString('#0')
$oOut | export-csv ('c:\data\notesviewexport'+$YYYYMMDDhhmmss+'.csv')
$oOut | Export-Clixml ('c:\data\notesviewexport'+$YYYYMMDDhhmmss+'.xml')
Subscribe to:
Posts (Atom)

