PDA

View Full Version : [Update] SRL: Jan. 10th, 2012 ~ Paint SMART Additions & FTab



Coh3n
01-11-2012, 02:48 AM
Some nice additions in today's update. :)

Cohen Adair (Coh3n) (9):
Mormonman's paintsmart.simba additions
Added a variation of Flight's DrawTextMulti
Removed unnecessary 1-liners (won't break scripts) and fixed Y positioning in DrawTextMulti
Added SMART_ClearCanvasArea and removed ClearRSCanvas/ClearCanvas
Added SMART_DrawBitmap
Added documentation to paintsmart.simba
Added paintsmart.simba to doc

Merlijn Wajer (Wizzup?) (1):
Add Skill doc for magic.

Nathan Hartung (Narcle) (2):
Added FTab (faster way to switch to major tabs using F keys)
Changed a wait in FlagEx
Commits can be found here (https://github.com/SRL/SRL-5/commits/master).

New functions:

FTab in gametab.simba (uses the F keys to navigate through game tabs)
SMART_DrawTextMulti
SMART_DrawDot
SMART_DrawPolygons
SMART_DrawCircle
SMART_DrawBoxes
SMART_DrawBitmap
SMART_DrawLine
SMART_ClearCanvasArea
SMART_ClearCanvas
If you want to know more about these functions, check out SRL/SRL/misc/paintsmart.simba (https://github.com/SRL/SRL-5/blob/master/srl/misc/paintsmart.simba) or SRL's documentation (http://docs.villavu.com/srl-5/srlref.html).

Other:

DrawDotsMulti has been renamed to SMART_DrawDotsMulti.
ClearCanvas has been removed.
ClearRSCanvas has been removed, use SMART_ClearCanvas instead.


Enjoy,
The SRL Team

YoHoJo
01-11-2012, 02:50 AM
Holy shit awesome smart debug stuff, I'm going to wait until Flight figures them all out and makes a tutorial, these will look really sexy I bet oh man!

Someone should implement these and make a short video!

E: Oh SHIT! Debug TPA/ATPA onto SMART! WOWOOW

Main
01-11-2012, 02:53 AM
yayaya clear area!!!@#!@

Brandon
01-11-2012, 03:13 AM
:c I was hoping to see a function that turns an array of integer colours into TPoints Or bitmaps. Either way Nice updates I actually just tested the clearareacanvas :D

nickrules
01-11-2012, 03:19 AM
:c I was hoping to see a function that turns an array of integer colours into TPoints Or bitmaps. Either way Nice updates I actually just tested the clearareacanvas :D

like this?
{************************************************* ******************************
Procedure SMART_DrawDots(Dots: TPointArray);
Contributors: Sir R. Magician
Description: Draws a TPA onto the SMART Debug canvas
************************************************** *****************************}
procedure SMART_DrawDots(Dots: TPointArray);


Regardless, this is pretty cool :) Can't wait to try and test these out on the script I'm working on

Brandon
01-11-2012, 03:42 AM
like this?
SImba tags are messed up..


Regardless, this is pretty cool :) Can't wait to try and test these out on the script I'm working on

Nah not like that.. I'll actually attempt to write it..

Sorta like this:

function TIntToBMP(T: TIntegerArray; Size_X, Size_Y: Integer): TBitmap;
begin
For I:= 0 To High(Size_Y) do
For J:= 0 To High(Size_X) do
WriteToBMP(T[I][J])
end;


something like that.. See the idea I have in my head is that for every colour in the array, that represents ONE pixel.. Specify the size of the bitmap and write each pixel to it going across then down 1, across again.. down 1.. across again.. repeat until I & J Match Size_Y & Size_X respectively..

I just can't figure out how to write it to the bitmap.. I'm going to guess it's the complete opposite of GetBitmapAreaColors.

Coh3n
01-11-2012, 03:44 AM
YoHoJo: The ATPA/TPA debugging has been there forever. That's what MSI uses. ;)

tls
01-11-2012, 04:30 AM
Did anyone ever look into testing Drawing TPA/ATPA's onto a bitmap then copying bmp to the smart canvas?

KingKong
01-11-2012, 04:33 AM
Did anyone ever look into testing Drawing TPA/ATPA's onto a bitmap then copying bmp to the smart canvas?

Isn't that less efficient than directly changing the colors of the SMART canvas? Because you have to make a bitmap, then copy the whole bitmap which contains points that the TPA doesn't.

Coh3n
01-11-2012, 05:42 AM
Did anyone ever look into testing Drawing TPA/ATPA's onto a bitmap then copying bmp to the smart canvas?Flight does that in his original DrawTextMulti function. I changed it to draw to the SMART canvas so it would work with the rest of the methods.

If you want, you could draw (A)TPAs to a bitmap then call SMART_DrawBitmap.

YoHoJo
01-11-2012, 07:06 AM
THIS IS REALLY cool dude oh my god I love it!!!!!!!!!
:D
God I'm going crazy this is AWESOME!

Any idea how much if any memory/lag/etc this creates? Is it negligible?

E: Can we make transparent/semi-transparent drawings on smart? If not, it owuld be an awesome feature!

E: Can you make it so instead of all of them calling SMART_ClearCanvas they have option to just SMART_ClearCanvasArea? Like what if I don't want to clear everything?

Also, what if I'm drawing two things on top of each other. I want the bottom one to always just stay drawn, but I want the top one to clear/update, how would I do that?

nickrules
01-11-2012, 09:13 PM
THIS IS REALLY cool dude oh my god I love it!!!!!!!!!
:D
God I'm going crazy this is AWESOME!

Any idea how much if any memory/lag/etc this creates? Is it negligible?

E: Can we make transparent/semi-transparent drawings on smart? If not, it owuld be an awesome feature!

E: Can you make it so instead of all of them calling SMART_ClearCanvas they have option to just SMART_ClearCanvasArea? Like what if I don't want to clear everything?

Also, what if I'm drawing two things on top of each other. I want the bottom one to always just stay drawn, but I want the top one to clear/update, how would I do that?

Lag varies depending on how much you paint and how often. However, once it is painted, I don't think it would take much at all.

@E1: Yeah, it's a bit funky. You have to do some color conversions though. And drawing over a large area was rather slow when i last tried.

@E2: Most have a parameter to clear the screen. Set it to false then call the function to clear only an area.

@E2.2: You'd have to paint the static area first, then the changing area. The only way to clear it I imagine would be to redraw the static area each time. You could also possibly do something with multiple canvases and clear just the one on top. I'm not too familiar with all that though, so I wouldn't know where to start.

Narcle
01-11-2012, 09:18 PM
I talked to Ben about the speed. Whats slow is Pascal to SMARTs buffer to paint on the canvas. So minimize the amount your drawing to the canvas. This is why I setup a background in my Fast Fighter so that its not repeatedly drawing a huge TPA array. Basically its Pascal being slow.

Coh3n
01-12-2012, 01:01 AM
YoHoJo, try using a TBitmap or TMufasaBitmap and mess with the transparency.

nickrules
01-12-2012, 01:57 AM
Alright, i knew I had this somewhere. This will create a transparent overlay in the ms.

Procedure DrawOnInv;
var
//drawing : TCanvas;
TPA: TPointArray;
Colors: TIntegerArray;
Pic, mx, my, I: Integer;
C, R, G, B: Integer;
begin
TPA := TPAFromBox(MSBox)
Colors := GetColors(TPA);
GetClientDimensions(mx,my);
Pic := BitmapFromString(mx,my,'');

Smart_DrawDotsEx(True,[],0) //clear
for i:= 0 to high(TPA) do
begin
C := Colors[i];
ColorToRGB(C, R, G, B);
R := R + 0;
G := G + 205;
B := B + 0;
C := RGBToColor(R, G, B);
FastSetPixel(Pic, TPA[i].x, TPA[i].y, C);
end;

Canvas.handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, MSX1 -4, MSY1 -4{372});
FreeBitmap(Pic)
writeln('done painting');
end;



It looks a bit funky from what I saw. But if you fiddle with the colors, search areas, search colors, etc., you can make some pretty nice looking things.


E: Not sure if this is actually what you want though :P

Flight
01-12-2012, 01:57 AM
YoHoJo, try using a TBitmap or TMufasaBitmap and mess with the transparency.

Are we able to set the transparency %/amount for a bitmap?

Coh3n
01-12-2012, 02:11 AM
Are we able to set the transparency %/amount for a bitmap?Not that I know of. There is Get/SetTransparantColor which makes be think SetTransparantPercent can be easily added to Simba's TBitmap or TMufasaBitmap.

honeyhoney
01-20-2012, 03:44 PM
Great update, I've just been messing around with the new features myself. :)

Just something I noticed... in the SRL 5 v1 documentation the example for "SMART_ClearCanvas" is


SMART_ClearCanvasArea();

I assume it should be


SMART_ClearCanvas();

superuser
01-20-2012, 05:19 PM
Not that I know of. There is Get/SetTransparantColor which makes be think SetTransparantPercent can be easily added to Simba's TBitmap or TMufasaBitmap.

I'm sure SetTransparentColor is not about setting the alpha channel...

Coh3n
01-20-2012, 07:26 PM
Great update, I've just been messing around with the new features myself. :)

Just something I noticed... in the SRL 5 v1 documentation the example for "SMART_ClearCanvas" is


SMART_ClearCanvasArea();

I assume it should be


SMART_ClearCanvas();Thanks, fixed for the next version.


I'm sure SetTransparentColor is not about setting the alpha channel...Huh? I was just saying since there's already some transparent properties exported to PS, that more can be exported.

Narcle
01-20-2012, 10:46 PM
I'm sure SetTransparentColor is not about setting the alpha channel...

You are correct. It just sets a certain color to be ignored or w/e. (bmps don't support it iirc?)

fre
02-08-2012, 03:21 PM
Very nice functions,
very helpfull for debug and very easy to use.
Good job.