Dll: ImageToIcoPabloko.dll

Plugins y todo lo relacionado para Autoplay Media Studio.
Hola, el otro dia me puse con el amigo Ceone a hacer un programita C# command line para convertir imagenes (de cualquier tipo) en iconos compatibles para los putos listboxex y toda esa jaruña.

Como entre unas cosas y otras consegui exportar dlls de assamblies C# diractamente lo he metido en una dll asi que al lio:

ImageToIco(string "from", string "to", int size (0-XXX), int mode(1=mantener aspecto:0=resimensionar)):stdcall

ejemplo:
function ImageToIco(strFROM, strTORu, nNSize, copyVal)
	local DLLFile = _SourceFolder.."\\AutoPlay\\Docs\\ImageToIcoPabloko.dll";
	local arg = "\""..strFROM.."\",\""..strTORu.."\","..nNSize..","..copyVal
	
	DLL.CallFunction(DLLFile, "ImageToIco", arg, DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
end


strFROM = _SourceFolder.."\\AutoPlay\\Images\\name.bmp";
strTORu = _SourceFolder.."\\AutoPlay\\Icons\\name.ico";
ICOSize = 32;
copyVal = 1;

ImageToIco(strFROM, strTORu, nNSize, copyVal);
Descargar:
HIDE: ON
Hidebb Message Hidden Description


Or On Mediafire by abood1987 : :friends:

HIDE: ON
Hidebb Message Hidden Description


Codigo fuente de la dll:
using System;
using System.Collections.Generic;
using System.Text;
using RGiesecke.DllExport;



using System.Media;
//using System.Text;
using System.Drawing;
using System.Data;
using System.IO;
using System.Reflection;



namespace ImageToIcoPabloko
{
internal static class UnmanagedExports
{
[DllExport("ImageToIco", CallingConvention = System.Runtime.InteropServices.CallingConvention.StdCall)]
static void ImageToIco(string from, string to, int size, int copy)
{
Image im = Image.FromFile(from);

int i = size;
int ic = copy;

Icon kon;

if (ic == 1)
{
kon = MakeIcon(im, i, true);
}
else
{
kon = MakeIcon(im, i, false);
}

FileStream fs = File.Create(to);

kon.Save(fs);
fs.Flush();
kon.Dispose();
fs.Close();
fs = null;
}

static public Icon MakeIcon(Image img, int size, bool keepAspectRatio)
{
Bitmap square = new Bitmap(size, size); // create new bitmap
Graphics g = Graphics.FromImage(square); // allow drawing to it

int x, y, w, h; // dimensions for new image

if (!keepAspectRatio || img.Height == img.Width)
{
// just fill the square
x = y = 0; // set x and y to 0
w = h = size; // set width and height to size
}
else
{
// work out the aspect ratio
float r = (float)img.Width / (float)img.Height;

// set dimensions accordingly to fit inside size^2 square
if (r > 1)
{ // w is bigger, so divide h by r
w = size;
h = (int)((float)size / r);
x = 0; y = (size - h) / 2; // center the image
}
else
{ // h is bigger, so multiply w by r
w = (int)((float)size * r);
h = size;
y = 0; x = (size - w) / 2; // center the image
}
}

// make the image shrink nicely by using HighQualityBicubic mode
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
g.DrawImage(img, x, y, w, h); // draw image with specified dimensions
g.Flush(); // make sure all drawing operations complete before we get the icon

// following line would work directly on any image, but then
// it wouldn't look as nice.
return Icon.FromHandle(square.GetHicon());
}
}
}
Imagen

visionario ;) "C#" yeah^^
esto me viene muy bien, gracias
fú yeagh!
gracias
thanks 
gracias, me servirá de ayuda!
Muy bueno :D
gracias
SE ve buena XD..
Gracias
Imagen
<span style="color:#804000">WE NEED MORE THANK U
</span>

:friends:

Hello,

Can you please reupload the dll ?

Re:

jackdaniels escribió:Hello,

Can you please reupload the dll ?

THANKS bro

lo voy a checaar grasiasa

;) :) :yes: :sorry:

thanks

the Link has been Update to the Mediafire Server ;) :friends: 6/1/2014
by abood1987