SRL Archive - SRL Suggestions

PaintSmart additions


Cstrike

2010-11-30 23:42:55

I feel awkward leaving my name in there, I made these functions for another project, and figured people wouldn't mind having them as well? You can remove my name from the credits if you want since they're one line procedures AND the procedure inside isn't really mine. I just cut and pasted it from my other thing for quickness. Sorry.

Reason I'm proposing this addition:
You can't find these commands in the include menu. In fact, I searched honestly high and low and struggled to find these. IIRC from my past experience I couldn't find them anywhere on the forums because you need to know the function name (SmartSetDebug…) to search it unless you can guess it with some luck. If it wasn't for RM, I'd never have found them.
This would allow people unfamiliar with it to be able to start using paint. It's an awesome tool.

If they're already in the include, lock/delete please. Thanks.
{*******************************************************************************
procedure SMART_EnableSmartCanvas;
by: Cstrike
Description: Enables canvas for drawing on.
*******************************************************************************}
procedure SMART_EnableSmartCanvas;
begin
SmartSetDebug(true);
end;

{*******************************************************************************
procedure SMART_DisableSmartCanvas;
by: Cstrike
Description: Disables canvas.
*******************************************************************************}
procedure SMART_DisableSmartCanvas;
begin
SmartSetDebug(false);
end;

{*******************************************************************************
procedure SMART_ClearSmartCanvas;
by: Cstrike
Description: Clears canvas.
*******************************************************************************}
procedure SMART_ClearSmartCanvas;
begin
SMART_DrawTextEx(true, 1, 1, StatChars, ' ', clRed);
end;
The last one would need to be placed after SMART_DrawTextEx or something like that, or find another way to free the canvas other than my crap method. I really suck with canvases though.

mormonman

2010-12-01 00:16:47

http://villavu.com/forum/showthread.php?t=60019&highlight=clearing+smart+canvas

They showed you a better method in this thread :S

Edit: http://villavu.com/forum/showpost.php?p=662462&postcount=4
another one ^

Cstrike

2010-12-01 00:18:34

Then… obviously the answer is now

{*******************************************************************************
procedure SMART_ClearSmartCanvas;
by: Shuttleu
Description: Clears canvas.
*******************************************************************************}
procedure SMART_ClearSmartCanvas;
begin
var
drawing : TBitmap;
begin
drawing := TBitmap.Create;
drawing.canvas.handle := SmartGetDebugDC;

ClearRSCanvas(drawing.canvas);

try
FreeBitmap(drawing);
except end;
end;

mormonman

2010-12-01 00:53:40

From: cstrike
Then… obviously the answer is now

{*******************************************************************************
procedure SMART_ClearSmartCanvas;
by: Shuttleu
Description: Clears canvas.
*******************************************************************************}
procedure SMART_ClearSmartCanvas;
begin
var
drawing : TBitmap;
begin
drawing := TBitmap.Create;
drawing.canvas.handle := SmartGetDebugDC;

ClearRSCanvas(drawing.canvas);

try
FreeBitmap(drawing);
except end;
end;


:D me likey!

Sir R. M8gic1an

2010-12-01 05:25:19

Stuck it so I don't lose track of the thread :p

~RM

Cstrike

2010-12-01 11:14:06

Paintsmart is uber beautiful, I would pay for this to be committed :D
Plus mormonman's update is better than mine, and can be thrown at the start.