SRL Archive - General

Bitmap Handling Mini-problem


canadarules

2006-06-22 14:02:41

Here's my problem. I want to make a tidbit in my script where it loads a bitmap, draws a rectangle at a specific point, and saves it. Here's what I have so far:


intTempBitmap := LoadBitmap('TEMP.BMP');
MarkingCanvas:=GetBitmapCanvas(intTempBitmap);
MarkingCanvas.Brush.Color := 16777215;
MarkingCanvas.Pen.Color := 16777215;
MarkingCanvas.Rectangle(5,5,7,7);
strPath := '../Folder/screenshot.bmp';
SaveBitmap(intTempBitmap,strPath);
CopyCanvas(MarkingCanvas,DebugCanvas,0,0,765,505,0,0,765,505);
MarkingCanvas.Free;
FreeBitmap(intTempBitmap);

All variables are defined. This isn't a problem with the coding structure. It just gives me a runtime error.

Help please?

PS. The files are all there, and are loaded properly. I checked.

XxKanexX

2006-06-23 03:46:54

I wrote one and it works for me..


var C, Debug: TCanvas;
var T, Load, Load2: Integer;

begin
Load:= OpenFile(AppPath + 'V2.bmp', true);
Load2:= OpenFile(AppPath + 'V.bmp', true);
ClearDebug;
if (Load > -1) or (Load2 = -1) then
begin
if (Load > -1) then
begin
Writeln('Please Delete V2.bmp To Continue.');
Writeln('Found: ' + AppPath + 'V2.bmp');
Writeln(' ');
end;
if (Load2 = -1) then
begin
Writeln('Please Create V.bmp To Continue.');
Writeln(' ');
end;
TerminateScript;
end;
T:= LoadBitmap(AppPath + 'V.bmp');
C:= GetBitmapCanvas(T);
C.Rectangle(5, 5, 300, 300);
SaveBitmap(T, Apppath + 'V2.bmp');
DisplayDebugImgWindow(305, 305);
Debug:= GetDebugCanvas;
CopyCanvas(C, Debug, 0, 0, 305, 305, 0, 0, 305, 305);
end.
;\