54
Chapter21-ImageDisplayFunctions
CIMG_display_bitmap_transp()
ThisfunctiondisplaystransparentGIFimages.Itonlydrawstheforegroundcolorwhen
displaying,notthebackgroundcolor.
Thisfunctioncompareseachpixeltothebackgroundcolorpassedinanddoesnotdraw
foregroundpixelsthatareidentical.Togetthebackgroundcolorfromanimage,usethe
CIMGLOW_get_transp_color()function.SeeCIMGLOW_
get_
transp_
color
()
formore
information.
Syntax
int SNBDAPI CIMG_display_bitmap_transp(Graphics *g, int xpos, int
ypos, int width, int height, int tcolor);
Remark
Table21.4:CIMG_display_bitmap_transpFunctionVariables
Variable
Description
g
Graphicsobject
xpos
StartingXcoordinatefordisplayofimage
ypos
StartingYcoordinatefordisplayofimage
width
Horizontalwidthtodisplayimage
height
Verticalheighttodisplayimage
tcolor
Backgroundcolorofimagetoignore
Returns
ReturnsthestatusofthedisplaybitmaptranparentGIFoperation.Anyvaluelessthanzeroisa
Snowbounderrorcode.SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMG_display_ddb()
ThisfunctiondisplaysaDDBobtainedfromCIMG_dib_to_ddb()oranyotherDDBdesired.
Thismaydisplay4and8-bitimagesfasteronsomedisplayadapters.SeeCIMG_
dib_
to_
ddb
()
formoreinformation.
Syntax
int SNBDAPI CIMG_display_ddb(bitmap* pBitmap, Graphics *g, int
xpos, int ypos);
Remark
Table21.5:CIMG_display_ddbFunctionVariables
123
51
Chapter21-ImageDisplayFunctions
Variable
Description
Bitmap
GDI+Bitmapobject
g
Graphicsobject
xpos
StartingXpositiontodisplayimage
ypos
StartingYpositiontodisplayimage
Returns
Returnsthestatusofthedevicedependentbitmap(DDB)displayoperation.Anyvalueless
thanzeroisaSnowbounderrorcode.SeeAppendix
H,
Snowbound
Error
Codes
foralistof
errorcodes.
Example21.1CIMG_display_ddb
C#:Bitmap Bmp = simage.CIMG_create_bitmap_class
(picDisplay.Width, picDisplay.Height);
simage.CIMG_display_ddb(bmp,e.Graphics,0,0);
CIMG_display_fit_to_height()
Thisfunctiondisplaysthefullheightoftheimageverticallyscalingittofit.Itcropstheimage
horizontallyforaspectratiocorrectionandenablesthescrollbars.
YoucanfindthesamplesforusingthisfunctioninthefollowingdirectoryC:\Program
Files\Snowbound Software\RasterMaster® .NET Evaluation\Net\Samples.
Thisfunctionisusedinthefollowingsamples:
l
Animate
l
Merge
Image
Syntax
int SNBDAPI CIMG_display_fit_to_height(Graphics *g, Control *win_
control, int xs, int ys, int width, int height);
Remark
Table21.6:CIMG_display_fit_to_heightFunctionVariables
Variable
Description
g
Graphicsobject
win_control
Windowformcontrolobject
xs
Xstartingpositiontodisplay
ys
Ystartingpositiontodisplay
124
55
Chapter21-ImageDisplayFunctions
Variable
Description
width
widthtodisplay
height
heighttodisplay
Returns
Returnsthestatusofthedisplayfittoheightoperation.Avalueof0indicatessuccess.Any
valuelessthanzeroisaSnowbounderrorcode.SeeAppendix
H,
Snowbound
Error
Codes
for
alistoferrorcodes.
CIMG_display_fit_to_width()
Thisfunctiondisplaysthefullwidthoftheimagehorizontallyscalingittofit.Itcropstheimage
verticallyforaspectratiocorrectionandenablesthescrollbars.
YoucanfindthesamplesforusingthisfunctioninthefollowingdirectoryC:\Program
Files\Snowbound Software\RasterMaster® .NET Evaluation\Net\Samples.
ThisfunctionisusedintheAnimate
sample.
Syntax
int SNBDAPI CIMG_display_fit_to_width(Graphics *g, Control *win_
control, int xs, int ys, int width, int height);
Remark
Table21.7:CIMG_display_fit_to_widthFunctionVariables
Variable
Description
g
Graphicsobject
win_control
Windowformcontrolobject
xs
Xstartingpositiontodisplay
ys
Ystartingpositiontodisplay
width
widthtodisplay
height
heighttodisplay
Returns
Returnsthestatusofthedisplayfittowidthoperation.Avalueof0indicatessuccess.Any
valuelessthanzeroisaSnowbounderrorcode.SeeAppendix
H,
Snowbound
Error
Codes
for
alistoferrorcodes.
CIMG_set_croprect()
Thisfunctionsetsthecurrentcroprectangle.Afterdecompressionthedefaultcropping
rectangleistheentiresizeoftheimage.
125
How to C#: Preview Document Content Using XDoc.excel How to C#: Preview Document Content Using XDoc.Excel. Get Preview From File. You may get document preview image from an existing Excel file in C#.net.
acrobat remove text from pdf; remove text from pdf acrobat
49
Chapter21-ImageDisplayFunctions
YoucanfindthesamplesforusingthisfunctioninthefollowingdirectoryC:\Program
Files\Snowbound Software\RasterMaster® .NET Evaluation\Net\Samples.
ThisfunctionisusedinthePanning
sample.
Note:
Thecroppingrectanglesizecannotbebiggerthantheheightorthewidthoftheimage.
Syntax
int SNBDAPI CIMG_set_croprect(CIMG_RECT *rect);
Remark
Table21.8:CIMG_set_croprectFunctionVariables
Variable
Description
rect
Rectangletosetnewsizetocrop.Formoreinformation,
seepublic
class
CIMG_
RECT
.
Returns
Returnsthecurrentcroprectanglefortheimagehandle.Anyvaluelessthanzeroisa
Snowbounderrorcode.SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMG_set_croprect_scroll()
Thisfunctionsetsthecroppingrectanglefortheimage.Italsoturnsonoroffthescrollbarsto
enablescrolling.
Ifaspectissetto1,theaspectratioiscorrected.Thisslightlychangesthecroppingrectangle
intheXorYdirection.
Syntax
int SNBDAPI CIMG_set_croprect_scroll(Control *win_control, int
xpos, int ypos, int scr_width, int scr_height, int aspect);
Remark
Table21.9:CIMG_set_croprect_scrollFunctionVariables
Variable
Description
win_control
Windowformcontrolobject
xpos
StartingXcoordinateforcroppingrectangle
ypos
StartingYcoordinateforcroppingrectangle
scr_width
Widthofcroppingrectangle
126
50
Chapter21-ImageDisplayFunctions
Variable
Description
scr_height
Heightofcroppingrectangle
aspect
1orTrue=aspectratioon
0=aspectratiooff
Returns
Returnsthestandardlibraryimagehandle.AnyvaluelessthanzeroisaSnowbounderrorcode.
SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMG_zoom_bitmap()
Thisfunctionisthestandardlibraryzoomfunction.Azoomvalueof100tellsthefunctionto
displaythewholeimageatthecoordinatesintheCIMG_display_bitmap()call.Anyvalue
greaterthan100cropstheimagesoitisnotfullydisplayedinthecurrentwindow.
Syntax
int SNBDAPI CIMG_zoom_bitmap(Control *win_ctrl, int zoom_factor);
Remark
Table21.10:CIMG_zoom_bitmapFunctionVariables
Variable
Description
win_ctrl
Windowformcontrolobject.
zoom_factor
Amounttozoom.
Returns
Returnsthestandardlibraryimagehandle.AnyvaluelessthanzeroisaSnowbounderrorcode.
SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMG_zoom_bitmap_1_to_1()
Thisfunctionisusedtodisplayimageswithaone-to-onepixelcorrespondence.Azoomvalue
of100tellsthefunctiontodisplayeachpixeloftheimageforonepixelonthescreen.
int SNBDAPI CIMG_zoom_bitmap_1_to_1(Control *win_control, int zoom_
level, int center_flag);
Remark
Table21.11:CIMG_zoom_bitmap_1_to_1FunctionVariables
Variable
Description
win_control
Windowformcontrolobject.
127
52
Chapter21-ImageDisplayFunctions
Variable
Description
zoom_level
Amounttozoom.
center_flag
Re-centersimageifsetto1.
Returns
Returnsthestandardlibraryimagehandle.AnyvaluelessthanzeroisaSnowbounderrorcode.
SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMG_zoom_bitmap_rect()
Thisfunctionismosteffectiveforresizingawindow.Callafterthezoomeventhasbeen
processedwhenrepaintingtheimagewithCIMG_display_bitmap().Thescaledimage
coordinatesandsizearereturnedforyouruse.ACIMG_RECTisthesameasaRect,except
theelementsofthestructurearelong,notshort.
Syntax
int SNBDAPI CIMG_zoom_bitmap_rect(Control *win_control, CIMG_RECT
*pRTZoom, CIMG_RECT *pRTClient, int mode);
Remark
Table21.12:CIMG_zoom_bitmap_rectFunctionVariables
Variable
Description
win_control
Windowformcontrolobject
pRTZoom
CIMG_
RECT
structure,rectangleinimagetozoom
mode
Usingimageorscreencoordinates
0=ScreenCoordinates
1=ImageCoordinates
Returns
Returnsthestandardlibraryimagehandle.AnyvaluelessthanzeroisaSnowbounderrorcode.
SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMGLOW_map_image_to_wnd()
Thisfunctiontranslatestheimagecoordinatespassedintoreflectthewindowcoordinatesfor
thedisplayedimage.Ittakesintoaccountscalingandcroppingoftheimageonscreen.
Syntax
int SNBDAPI CIMGLOW_map_image_to_wnd(Control *win_control, Int *px,
Int *py);
128
54
Chapter21-ImageDisplayFunctions
Remark
Table21.13:CIMGLOW_map_image_to_wndFunctionVariables
Variable
Description
win_control
Windowformcontrolobject
px
PointertoanintegerofanXcoordinatetoconvert
py
PointertoanintegerofaYcoordinatetoconvert
Returns
Returnsthestandardlibraryimagehandle.AnyvaluelessthanzeroisaSnowbounderrorcode.
SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
CIMGLOW_map_wnd_to_image()
Thisfunctiontranslateswindowcoordinatestoimagecoordinatesforthedisplayedimage.This
isusefulforpassingcoordinatestothecropfunctions.UseCIMG_set_croprect_scroll
()todisplayanareaoftheimageandenablescrolling.SeeCIMG_
set_
croprect_
scroll
()
for
moreinformation.
Syntax
int SNBDAPI CIMGLOW_map_wnd_to_image(Control *win_control, int *px,
int *py);
Remark
Table21.14:CIMGLOW_map_wnd_to_imageFunctionVariables
Variable
Description
win_control
Windowformcontrolobject
px
PointertoanintegerofanXcoordinatetoconvert
py
PointertoanintegerofaYcoordinatetoconvert
Returns
Returnsthestandardlibraryimagehandle.AnyvaluelessthanzeroisaSnowbounderrorcode.
SeeAppendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
double calcAspectZoom()
ThisfunctionallowsyoutoretrievetheASPECT_ZOOMvalueforeachoftheaspecttype
properties.
129
44
Chapter21-ImageDisplayFunctions
Syntax
double calcAspectZoom(CIMG_RECT *view, double zoom, int type);
Remark
Table21.15:double calcAspectZoomVariables
Variable
Description
view
Thedisplayareaofinterest
doublezoom
Zoomfactor:
0=fittowindowiftype=aspectdefault
100=displaypixelsonetooneiftype=aspectdefault
type
Returnsthezoomvalueoftheparticulartag.Returnsthe
zoomvalueasanASPECT_
ZOOM
.
Example21.2doublecalcAspectZoom
snowPanel1.Type = ZOOM_TYPE.ASPECT_DEFAULT;
snowPanel1.Zoom = 0;
CIMG_display_bitmap_aspect
(?,?,?,?,?,snowPanel1.Zoom,snowPanel1.Type);
EQUALS:
CIMG_RECT view = new
CIMG_RECT
(snowPanel1.Left,snowPanel1.Top,snowPanel1.Right,snowPanel1.
Bottom);
double aspectzoom =
snowPanel1.calcAspectZoom
(view,snowPanel1.Zoom,snowPanel1.Type);
CIMG_display_bitmap_aspect(?,?,?,?,?,aspectzoom,ZOOM_
TYPE.ASPECT_ZOOM)
Returns
ReturnstheASPECT_ZOOMvalue.AnyvaluelessthanzeroisaSnowbounderrorcode.See
Appendix
H,
Snowbound
Error
Codes
foralistoferrorcodes.
removeScrollbars()
Thisfunctionremovesscrollbarsfromthegivencontrol.
130
Documents you may be interested
Documents you may be interested