CreatePictureEx, StretchBlt, StretchBltRGB
Description
CreatePictureEx( intpicconst
, intpicflag
, intWidth
, intHeight
);
This function creates or removes additional pictures.
Parameters
Note
With this function you can create or remove the picture. The standard limit of additional pictures is 5. The pictures are handled via constants. There can be created up to 128 additional pictures. The first picture has the value PIC_OFFSET + 0, the last picture has the value PIC_OFFSET + 127. If you try to create already created picture, FALSE value will be returned. Every new created picture increases the amount of allocated memory so it can less the performance of the system. All created pictures are automatically removed at the end of the NIS-Elements session, but if you do not intend to use the created picture any more, you should remove the picture from the system.
See Also
StretchBlt
Description
int StretchBlt( intc_dest
, intc_sour
, intc_mode
, intX2
, intY2
, intwidth2
, intHeight2
, intX1
, intY1
, intwidth1
, intHeight1
, intvisible
);
This function performs copying, exchanging and rescaling on the defined pictures.
X2 parameter is the left and Y2 is the right destination rectangle coordinate.
Parameters
visible
If this parameter is greater than zero and the destination is PICTURE_CURRENT (0), the current image is shown after the operation.
Not processed components are not changed,picture is not showed. | |
Not processed components have zero value,picture is not showed. | |
Not processed components have zero value,picture is showed. | |
Not processed components are not changed,picture is showed. |
Return Values
// StretchBlt example - shows different edge detection methods in quadrants. It behaves correclty to Undo. int xs,ys,width,height; int i1,i2,x1,y1,i2_,i1_; int p_w,p_h; int qw; char oper[1024],caption[256]; dword time1,time2; Int_CreateTextWindow("API Example - StretchBlt function.",0,RGB(0,0,128),RGB_WHITE,100); SetCommandText("Working..."); Get_Size(SIZE_PICWND,&xs,&ys,&width,&height); _ImageOpen(); qw = Int_Question("API Demo","Set stretch mode:","Quick","Splines","","",1,0); if(qw == 1) SetStretchMode(STRETCH_QUICK); if(qw == 2) SetStretchMode(STRETCH_SPLINES); p_w = width / 2; p_h = height / 2; SuppressDisplay(); Int_CreateTextWindow("Original Image",0,RGB(0,0,128),RGB_WHITE,100); x1 = (p_w * i2); y1 = (p_h * i1); StretchBlt(PICTURE_OVERLAY,PICTURE_CURRENT,MODE_COPY,0,0,0,0,0,0,0,0,0); StretchBlt(PICTURE_REFERENCE,PICTURE_CURRENT,MODE_COPY,0,0,p_w,p_h,0,0,width,height,0); Int_CreateTextWindow("Morpho Gradient - Octagon 2x",0,RGB(0,0,128),RGB_WHITE,100); MorphoGradientEx(-2,4); StretchBlt(PICTURE_REFERENCE,PICTURE_CURRENT,MODE_COPY,p_w,0,p_w,p_h,0,0,width,height,0); StretchBlt(PICTURE_CURRENT,PICTURE_OVERLAY,MODE_COPY,0,0,0,0,0,0,0,0,0); Int_CreateTextWindow("Edge Detection - Sobel",0,RGB(0,0,128),RGB_WHITE,100); EdgeDetect(); StretchBlt(PICTURE_REFERENCE,PICTURE_CURRENT,MODE_COPY,0,p_h,p_w,p_h,0,0,width,height,0); StretchBlt(PICTURE_CURRENT,PICTURE_OVERLAY,MODE_COPY,0,0,0,0,0,0,0,0,0); Int_CreateTextWindow("Edge Detection - Golay",0,RGB(0,0,128),RGB_WHITE,100); GolayFilter(5,3); StretchBlt(PICTURE_REFERENCE,PICTURE_CURRENT,MODE_COPY,p_w,p_h,p_w,p_h,0,0,width,height,0); StretchBlt(PICTURE_CURRENT,PICTURE_REFERENCE,MODE_EXCHANGE,0,0,0,0,0,0,0,0,0); Int_CreateTextWindow("Inserting Descriptions",0,RGB(0,0,128),RGB_WHITE,100); InsertText(" Original ",0,0,0,0,0,"Arial",-13,1,0,0,0,0); InsertText(" Morpho Gradient Octagon 2x ",p_w,0,0,0,0,"Arial",-13,1,0,0,0,0); InsertText(" Edge Detection - Sobel ",0,p_h,0,0,0,"Arial",-13,1,0,0,0,0); InsertText(" Edge Detection - Golay ",p_w,p_h,0,0,0,"Arial",-13,1,0,0,0,0); StretchBlt(PICTURE_RESULT,PICTURE_OVERLAY,MODE_COPY,0,0,0,0,0,0,0,0,0); if(ExistProc("ViewColor")) ViewColor(); else ViewGray(); Int_CloseTextWindow();
Note
The exchanges are made only on whole pictures. You change the stretch mode manually in Preferences dialog box, Macro menu. Areas outside the pictures are clipped.
See Also
StretchBltRGB, StretchToReference
Description
int StretchBltRGB( intc_dest
, intc_sour
, intc_mode
, intX2
, intY2
, intwidth2
, intHeight2
, intX1
, intY1
, intwidth1
, intHeight1
, intcol_to
, intcol_from
, intvisible
);
This function performs copying, exchanging and rescaling on defined pictures. This function respects color components and can be used only in the application.
X2 parameter is the left and Y2 is the right destination rectangle coordinate.
Parameters
visible
If this parameter is greater than zero and the destination is PICTURE_CURRENT (0), the current image is shown after the operation.
Not processed components are not changed,picture is not showed. | |
Not processed components have zero value,picture is not showed. | |
Not processed components have zero value,picture is showed. | |
Not processed components are not changed,picture is showed. |
Return Values
// StretchBltRGB example - shows how to use the StretchBltRGB function. int qw,flg_from,flg_to; char caption[256]; int xs,ys,width,height; int x1,y1,w1,h1,x2,y2,w2,h2; int f_comp,t_comp,visi; strcpy(caption,"API Example - StretchBltRGB function."); _ImageOpen(); Int_CreateTextWindow(caption,0,RGB(0,0,128),RGB_WHITE,100); SetCommandText("Working..."); StretchBlt(PICTURE_OVERLAY,PICTURE_CURRENT,MODE_COPY,0,0,0,0,0,0,0,0,0); StretchBlt(PICTURE_REFERENCE,PICTURE_CURRENT,MODE_COPY,0,0,0,0,0,0,0,0,0); Get_Size(SIZE_PICWND,&xs,&ys,&width,&height); qw = Int_Question("API Example","From:","Whole screen","Define...","","",1,0); if(qw==BUTTON_1) { x1=0; y1=0; w1=width; h1=height; } if(qw==BUTTON_2) { Int_DrawRectangle(RECT_HOLLOW, RGB_DEFAULT, &x1, &y1, &w1, &h1, FALSE); } qw = Int_Question("API Demo","To:","Whole screen","Define...","","",1,0); if(qw==BUTTON_1) { x2=0; y2=0; w2=width; h2=height; } if(qw==BUTTON_2) { Int_DrawRectangle(RECT_HOLLOW, RGB_DEFAULT, &x2, &y2, &w2, &h2, FALSE); } qw = Int_Question("API Demo","From component:","Red","Green","Blue","",1,0); if(qw==BUTTON_1) { f_comp=RED_COMP; } if(qw==BUTTON_2) { f_comp=GREEN_COMP; } if(qw==BUTTON_3) { f_comp=BLUE_COMP; } qw = Int_Question("API Demo","To component:","Single","Multiple","All","",1,0); if(qw==1) { qw = Int_Question("API Demo","To component:","Red","Green","Blue","",1,0); if(qw==BUTTON_1) { t_comp=RED_COMP; } if(qw==BUTTON_2) { t_comp=GREEN_COMP } if(qw==BUTTON_3) { t_comp=BLUE_COMP; } goto again; } if(qw==2) { qw = Int_Question("API Demo","To components:","Red and Green","Red and Blue","Blue and Green","",1,0); if(qw==BUTTON_1) { t_comp=RED_COMP|GREEN_COMP; } if(qw==BUTTON_2) { t_comp=RED_COMP|BLUE_COMP; } if(qw==BUTTON_3) { t_comp=BLUE_COMP|GREEN_COMP; } goto again; } if(qw==BUTTON_3) { t_comp=RED_COMP|GREEN_COMP|BLUE_COMP; } again: qw = Int_Question("API Demo","Affect other components?","Yes","No","","",1,0); if(qw==BUTTON_1) { visi=CHANGE_SHOW; } if(qw==BUTTON_2) { visi=NOCHANGE_SHOW; } // Copying reference image to the current image. StretchBltRGB(PICTURE_CURRENT,PICTURE_REFERENCE,MODE_COPY,x2,y2,w2,h2,x1,y1,w1,h1,t_comp,f_comp,visi); // Copying original image to Undo image. StretchBlt(PICTURE_RESULT,PICTURE_OVERLAY,MODE_COPY,0,0,0,0,0,0,0,0,0); Int_CloseTextWindow();
Note
The exchanges are made only on whole pictures. You change the stretch mode either by calling SetStretchMode function or manually in Preferences dialog box, Macro menu. Areas outside the pictures are clipped.
See Also
StretchBlt