PDA

View Full Version : * Free * : Dynamic Masking Tool v2



clueless
02-01-2008, 06:45 PM
Overview
This is a Version2 tool for dynamic mixing of background masks in AMS to give the illusion of an extending 'Draw or Draws' on the side of the main program window. file size 24kb .It can be set up for multiple draws extending to many levels.
Info on the orig version/concept can be found here: http://www.indigorose.com/forums/sho...&highlight=dmt
http://www.fataloverdose.copperstream.co.uk/files/programming_tools/dmt/dmt_examplepic_web.gif
This version is using Direct Memory Access to perform the pixel operations and is at least 13x faster than V1
Using the DMT
This is a Command Line Tool so its an .EXE file that has to have 3 bits of data passed to it to mix the masks. Note : all filenames have to be passed as 'short filenames' to avoid extra spaces in the command line.
Syntax


[MainPic] [Action] [Draw]

[MainPic] :A mask image of the program window with all the draws open
[Action] : Either 'Add' or 'Sub' to add or remove a draw from the main Mask image
[Draw] : A Mask image of a draw in the open position

Example:


CommandLine = MainPic.." ".."Sub".." "..ADrawPicLocation;
File.Run("AutoPlay\\Prg\\DMT.exe", CommandLine, "", SW_SHOWNORMAL, true);

Global Functions example:


function OpenDraw(ADrawPicLocation)
RunDMT (MainPic.." ".."Add".." "..ADrawPicLocation);
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Keys.ogg", true, false);
return true
end
----------------------------------------------------------------------------------------------------------------
function ShutDraw(ADrawPicLocation)
RunDMT (MainPic.." ".."Sub".." "..ADrawPicLocation);
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Knocker.ogg", true, false);
return false
end

Download
This prog is free for you to use in your own projects. A small note of credit would be appeciated in anything you use it for.
Heres a quick example of how to use the DMT, its a demo prog with a few random functions in it.
Download DMT_AMS6_Clueless.rar (http://www.fataloverdose.copperstream.co.uk/files/programming_tools/DMT_AMS6_Clueless.rar)
Next ill be converting this and whole bunch of other image/picture functions into a DLL file which i that I may charge a small fee for.

mindstitchdr
02-01-2008, 06:53 PM
Thank you!

gambit
02-01-2008, 09:35 PM
nice one clueless :yes:yes:yes

big help for a newbee like me...is it possible the drawer opens a bit slower???

Thanks!!!

clueless
02-01-2008, 10:03 PM
The draw on that example has only 2 states Open or Closed its not animated. It may be possible to get some kind of animation between the two states, it would depend on the size of the mask image (may be better to use a small one and stretch it) the speed of the pixel operations and the processing time for the redrawing of the window by AMS.
By having an instant open and close you dont have to worry about moving any objects in that draw as it opens.


dynamic mixing of background masks in AMS to give the illusion of an extending 'Draw or Draws'

TimeSurfer
02-02-2008, 05:15 PM
awesome clueless ,

i've been needing something like this.

great work m8

qwerty
02-16-2008, 04:42 AM
handy looking tool, cheers :)

clueless
02-23-2008, 10:28 PM
Thanks for the support guys :yes

Heres the final version of the DMT with some optional optimization.
Filesize : 112kb :cool

Standard Drawing Mode-(v2 method) The DMT scans every pixel of the 'draw' image and add's or subbtracts the picture to the main mask.

Optimized Drawing mode -You can 'pre-calculate' the area of the draw image so that only the horizontal lines of pixels that contain white get scanned to the main mask image. This can be up to 3 times faster to process than the old method.

PreCalc Tool-Because of the way bitmaps are stored for fast direct memory access it takes a certain amount of calculation based on the width of the pic x (the bytes per pixel and the spacers in between each pixel) etc..to get the two numbers needed (startPixel,EndPixel) to make the optimization work. So to make this less stressful ive added a function to the DMT to do the maths for you :D. You dont have to run this every time you want to open the draws you just run it one time for each draw you have to find the magic numbers and then use them in your code -

StartPixel,EndPixel-Doubble click the DMT in windows(no commandline) to open up the 'Pre-Calc' tool then select a 'draw' (you will have to do this once for each draw, but not the main mask) image and the program will give you the start and end pixel numbers needed to speed the drawing process up.

CommandLine Syntax
So the DMT is multi-functional now it can be used 3 ways ;-

Standard Drawing Mode:- [ImgMain] [Method] [imgDraw]

Optimized Drawing mode:- [ImgMain] [Method] [imgDraw] [startpixel] [EndPixel]

DMT PreCalc Tool:
- Just doubble click DMT.exe in windows.
- Select Draw
- add the numbers to the end of the commandline.

Note: all filanames have to be 'short filenames' to avoid extra spaces in the commandline ;)

Example changes to the existing open and close functions to get the optimisation to work;

function OpenDraw(ADrawPicLocation,StartP,EndP)
local cLine = "";
cLine = MainPic.." ".."Add".." "..ADrawPicLocation;
if StartP and EndP then
cLine = cLine.." "..StartP.." "..EndP
end
RunDMT (cLine);
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Keys.ogg", true, false);
return true
end
----------------------------------------------------------------------------------------------------------------
function ShutDraw(ADrawPicLocation,StartP,EndP)
local cLine = "";
cLine = MainPic.." ".."Sub".." "..ADrawPicLocation;
if StartP and EndP then
cLine = cLine.." "..StartP.." "..EndP
end
RunDMT (cLine);
Audio.Load(CHANNEL_NARRATION, "AutoPlay\\Audio\\Knocker.ogg", true, false);
return false
end
----------------------------------------------------------------------------------------------------------------
function ShutAll()
if bDraw1Open == true then
bDraw1Open = ShutDraw(Draw1,282633,844985);
end

if bDraw2Open == true then
bDraw2Open = ShutDraw(Draw2,1084549,1459129);
end

if bDraw3Open == true then
bDraw3Open = ShutDraw(Draw3,285513,847869);
end
end

Intrigued
02-24-2008, 02:36 PM
Mirroed on amsuser.com:

http://www.amsuser.com/ams/examples/DMT-AMS7-clueless.rar

Thanks clueless.

rexzooly
03-26-2008, 05:07 PM
Also i have added you to my new mirror service :)


Link:
http://jonny6.pap3rback.net/AMS/?page=clueless

Hope you like.

clueless
03-27-2008, 04:54 AM
Looking good :yes

rexzooly
03-27-2008, 05:45 AM
Looking good :yes

thanks :yes

i know people have done alot more then i have set in the mirror portfolios
but i test everything make sure it works and then i screen shot it and then
upload it its slower then lets say razershare but its aimed to only AMS members
projects so this way it keeps things cleaner.