Creating and Pasting a Region (ASP - JavaScript)
The following example demonstrates the creation of regions in LEADTOOLS. It uses two LEADRaster objects. It loads an image in the first one and creates an elliptical region in it. It then pastes this region onto the second LEADRaster object and displays the pasted region.
<%@ Language=JavaScript %>
<%
var SAVE_OVERWRITE = 0;
var FILE_JFIF = 10;
var L_RGN_SET = 1;
var CB_DST_0 = 32;
var CB_OP_ADD = 768;
var RasterObj = Server.CreateObject("LEADRaster.LEADRaster");
var RasterObj2 = Server.CreateObject("LEADRaster.LEADRaster");
var RasterIO = Server.CreateObject("LEADRasterIO.LEADRasterIO");
var RasterProc = Server.CreateObject("LEADRasterProcess.LEADRasterProcess");
RasterIO.Load(RasterObj, "i:\\a\\pic\\20020816demo3.jpg", 0, 0, 1);
//Create the region
RasterObj.SetRgnEllipse(0, 0, RasterObj.BitmapWidth, RasterObj.BitmapHeight / 2, L_RGN_SET);
//Create a blank bitmap so that we can "paste" the region onto it
RasterObj2.CreateBitmap(RasterObj.RgnWidth, RasterObj.RgnHeight, RasterObj.BitmapBits);
RasterProc.Fill(RasterObj2, 65535);
//Paste the region
RasterProc.Combine(RasterObj2, 0, 0, RasterObj.RgnWidth, RasterObj.RgnHeight, RasterObj, RasterObj.RgnLeft, RasterObj.RgnTop, CB_DST_0 + CB_OP_ADD);
RasterIO.Save(RasterObj2, "c:\\asp.jpg", FILE_JFIF, 0, 2, 0);
Response.Write("<IMG SRC='c:\\asp.jpg'>");
%>