1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-05 17:05:19 -05:00
Simba/Tests/PS/Several bitmap operations.mufa
Raymond ffb90926b6 Added SetTargetBitmap, and made CallThreadSafe work, hell yeah!
OnDestroy event for bitmaps..
Added PosterizeBitmap
Added window.inc
Added FormTest.mufa

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@141 3f818213-9676-44b0-a9b4-5e4c4e03d09d
2009-10-18 20:11:47 +00:00

160 lines
9.2 KiB
Plaintext

program new;
const
SaveDir = 'C:\';
var
Bmpz : integer;
Bmp2 : integer;
w,h : integer;
begin
Bmpz := BitmapFromString(166, 73, 'beNq9Xf2PVeURtv+Jv' +
'zeKSYvZaNlc2/S4N22tmtoYE0NsLdYQQoiClpgNQaSUUpRSpFhC/a' +
'yIX0QCVaOtxn/MYWd39rnPM/Pecz/OJm82994958z7vjPvfM+c1ZW' +
'f/+RHOtZWd9vwD/T7eLT7Fz+9z/7G17g+LrYfbdC99ks3mvil2/jF' +
'nxDP8YfbX/8Q/8WB/wro9KM/wQbOKmau42f33W0Dv6aXLTgcCu6Dz' +
'6cbreDqYi3+tRttbm8nk9/YwxVcFG07ogORopitNieQjo/y22/jdH' +
'XF1+W/2GSqDcSlxTPxK2IWf8Tf/bE+W7rXL/NpBDbjXzGlWMsD994' +
'V0/av9//4h36N345LCFKfSjb+1bYlZuJoInTE8mPgj3qmcA8JOym+' +
'cN8aBKm3IyycA36mVeMpUyaAvCJWFxfghPHk4i/+nDjODiKwr8tJ9' +
'6RappMBnan2EdYdwPXG79Vp8pl3gKBuch+QVXZbn4OQKozjw5Gpxv' +
'Lj7LR5VEp46XEYC1U7cnFRSNXdJBuvzjiNlAD0PBIx0PRo2ElvnIV' +
'YqX2wK20YkTxw7z1KKr5efxohTlGGHM9/jzl3k1JVT73OdvuYrK7E' +
'mcJjiA8h5l8h/Y47fmCD7rVV2MLxmUFIKrDiAJIUoyuJ//sHh07iA' +
'DnG2mgXbmyAQ25PqCGCj4MWk4wH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3j3a' +
'Po+8BCV1cWQ==');
SaveBitmap(bmpz,SaveDir + 'original.bmp');
GetBitmapSize(bmpz,w,h);
SetBitmapName(bmpz,'Invetory Bitmap');
Writeln('Bitmap size: ('+inttostr(w) + ',' + inttostr(h) + ')');
Bmp2 := CopyBitmap(bmpz);
SetBitmapSize(Bmp2,w div 2, h div 2);
SaveBitmap(bmp2,SaveDir + 'cut.bmp');
StretchBitmapResize(Bmpz,w*2,h*2);
SaveBitmap(bmpz,savedir + 'stretched.bmp');
FreeBitmap(bmp2);
Bmp2 := CopyBitmap(bmpz);
StretchBitmapResize(bmp2,w div 2, h div 2);
SaveBitmap(bmp2,savedir + 'stretchedSmall.bmp');
SaveBitmap(ContrastBitmap(bmpz,50),savedir + 'Contrast.bmp');
SaveBitmap(BrightnessBitmap(bmpz,150),savedir + 'Brightness.bmp');
SaveBitmap(GreyScaleBitmap(bmpz),savedir + 'GreyScale.bmp');
InvertBitmap(bmpz);
SaveBitmap(bmpz,savedir + 'inverted.bmp');
Invertbitmap(bmpz);//Invert back
SaveBitmap(DesaturateBitmap(Bmpz),savedir + 'desaturate.bmp');
SaveBitmap(RotateBitmap(Bmpz,0.30*pi),savedir + 'rotated.bmp');
SaveBitmap(PosterizeBitmap(Bmpz,75),savedir + 'posterized.bmp');
end.