| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1693 人关注过本帖
标题:网上找到一老师的代码。如何改成左右拼接?谢谢
只看楼主 加入收藏
bzdm
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2020-5-7
结帖率:0
收藏
已结贴  问题点数:20 回复次数:2 
网上找到一老师的代码。如何改成左右拼接?谢谢
p1 = NewObject('gpBitmap', Home(1)+'ffc\_gdiplus')
 p1.CreateFromFile(GetPict('', '底图图片(&N):'))
 p2 = NewObject('gpBitmap', Home(1)+'ffc\_gdiplus')
 p2.CreateFromFile(GetPict('', '叠加图片(&N):'))
 og = NewObject('gpGraphics', Home(1)+'ffc\_gdiplus')
 og.CreateFromImage(p1)
 og.DrawImageAt(p2, Max(0,p1.imagewidth-p2.imagewidth)/2, Max(0,p1.imageheight-p2.imageheight)/2)
 p1.SaveToFile(Putfile('保存为(&N):','合成的图片','bmp'),"image/bmp")
搜索更多相关主题的帖子: Home 图片 左右 网上 代码 
2020-05-30 20:56
gs2536785678
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:45
帖 子:610
专家分:1784
注 册:2017-7-16
收藏
得分:10 
没有办法
2020-05-31 06:31
schtg
Rank: 12Rank: 12Rank: 12
来 自:Usa
等 级:贵宾
威 望:67
帖 子:1790
专家分:3389
注 册:2012-2-29
收藏
得分:10 
【转oldbb的方法,供你参考】
**
** 图片拼接(左右)
**
DECLARE LONG GetDC IN user32 LONG
DECLARE LONG ReleaseDC IN user32 LONG, LONG
DECLARE LONG GdiplusStartup IN gdiplus LONG@, STRING@, LONG
DECLARE LONG GdiplusShutdown IN gdiplus LONG
DECLARE LONG GdipCreateBitmapFromScan0 IN gdiplus LONG, LONG, LONG, LONG, STRING@, LONG@
DECLARE LONG GdipGetImageGraphicsContext IN gdiplus LONG, LONG@
DECLARE LONG GdipCreateFromHDC IN gdiplus LONG, LONG@
DECLARE LONG GdipLoadImageFromFile IN gdiplus STRING@, LONG@
DECLARE LONG GdipGetImageWidth IN gdiplus LONG, LONG@
DECLARE LONG GdipGetImageHeight IN gdiplus LONG, LONG@
DECLARE LONG GdipSaveImageToFile IN gdiplus LONG, STRING@, STRING@, LONG
DECLARE LONG GdipDrawImageRectI IN gdiplus LONG, LONG, LONG, LONG, LONG, LONG
DECLARE LONG GdipDisposeImage IN gdiplus LONG
DECLARE LONG GdipDeleteGraphics IN gdiplus LONG
inFile1 = GETPICT("", "左边图片(&N):")
inFile2 = GETPICT("", "右边图片(&N):")
outFile = PUTFILE("保存为(&N):", "合成的图片", "bmp")
IF !FILE(inFile1) OR !FILE(inFile2) OR EMPTY(outFile)
    RETURN
ENDIF
stGSI = 0h01000000000000000000000000000000
pGDI = 0
GdiplusStartup(@pGDI, @stGSI, 0)
pImage1 = 0
GdipLoadImageFromFile(STRCONV(inFile1+0h00,5), @pImage1)
nWidth1 = 0
GdipGetImageWidth(pImage1, @nWidth1)
nHeight1 = 0
GdipGetImageHeight(pImage1, @nHeight1)
pImage2 = 0
GdipLoadImageFromFile(STRCONV(inFile2+0h00,5), @pImage2)
nWidth2 = 0
GdipGetImageWidth(pImage2, @nWidth2)
nHeight2 = 0
GdipGetImageHeight(pImage2, @nHeight2)
nWidth = nWidth1 + nWidth2
nHeight = MAX(nHeight1, nHeight2)
PixelFormat_32bppARGB = 0x26200A
pBitmap = 0
GdipCreateBitmapFromScan0(nWidth, nHeight, 0, PixelFormat_32bppARGB, 0, @pBitmap)
pGraphics = 0
GdipGetImageGraphicsContext(pBitmap, @pGraphics)
GdipDrawImageRectI(pGraphics, pImage1, 0, 0, nWidth1, nHeight1)
GdipDrawImageRectI(pGraphics, pImage2, nWidth1, 0, nWidth2, nHeight2)
CLSID_BMP = 0h00F47C55041AD3119A730000F81EF32E
**CLSID_PNG = 0h06F47C55041AD3119A730000F81EF32E
GdipSaveImageToFile(pBitmap, STRCONV(outFile+0h00,5), CLSID_BMP, 0)
GdipDisposeImage(pImage1)
GdipDisposeImage(pImage2)
GdipDeleteGraphics(pGraphics)
GdipDisposeImage(pBitmap)
GdiplusShutdown(pGDI)
CLEAR
DrawImageWindowFromFile(_screen.hWnd, 10, 10, 500, 500*nHeight/nWidth, outFile)
CLEAR ALL
RETURN

FUNCTION DrawImageWindowFromFile(hWnd, nX, nY, nWidth, nHeight, cFileName)
    LOCAL hDC, pImage, pGraphics
    pImage = 0
    GdipLoadImageFromFile(STRCONV(cFileName+0h00,5), @pImage)
    hDC = GetDC(hWnd)
    pGraphics = 0
    GdipCreateFromHDC(hDC, @pGraphics)
    GdipDrawImageRectI(pGraphics, pImage, nX, nY, nWidth, nHeight)
    GdipDisposeImage(pImage)
    GdipDeleteGraphics(pGraphics)
    ReleaseDC(hWnd, hDC)
ENDFUNC
2020-05-31 07:08
快速回复:网上找到一老师的代码。如何改成左右拼接?谢谢
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.035510 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved