Asp組件進階入門與精通系列之一

來源:互聯網
上載者:User
進階  

很久沒有寫這個系列了,最近一直在忙其他的東西

進階的組件話題我們將討論一些比較難實現的,複雜的東西

前段時間我寫了一個龍捲風縮圖浮水印組件,感覺效果還不錯,由於是vb寫的,有一些難度,大家一起來看看

這裡有文章:http://community.csdn.net/Expert/topic/4115/4115767.xml?temp=.9513056

功能如下:

龍捲風縮圖浮水印組件1.0版
功能特點:
1.支援從bmp位元影像,jpeg,gif匯入
2.僅支援產生jpeg格式
3.文字浮水印,支援自訂字型,旋轉角度,顏色,字型寬度和高度
4.圖片浮水印,支援透明度
5.暫時不支援直接將檔案流寫入瀏覽器
6.消耗系統資源少
7.每個例子都有詳細的注釋


龍捲風縮圖浮水印組件0.9版
功能特點:
1.僅僅支援從bmp位元影像匯入
2.僅僅支援產生jpeg格式
3.消耗系統資源少

版本曆史
龍捲風縮圖浮水印組件1.0版
時間:2005-02-13
增加了對jpg,gif映像匯入的支援
時間:2005-02-12
功能:增加了圖片浮水印功能
時間:2005-02-11
功能:增加了文字浮水印功能

龍捲風縮圖浮水印組件0.9版
時間:2005-02-10
功能:僅支援bmp位元影像匯入功能,支援產生jpeg功能,只有縮減功能


可以免費使用,無任何限制
如有問題,希望提出,以便我改進
我的email:yyg19780718@163.com

代碼如下:

模組1:

Option Explicit
'有部分代碼不需要,以後可能會用到

Public Const LR_LOADFROMFILE = &H10
Public Const IMAGE_BITMAP = 0
Public Const IMAGE_ICON = 1
Public Const IMAGE_CURSOR = 2
Public Const IMAGE_ENHMETAFILE = 3

Public Const SRCCOPY           As Long = &HCC0020
Public Const BI_RGB = 0&
Public Const DIB_RGB_COLORS = 0 '結構BITMAPINFO中包含了RGB值的數組RGBQUAD
Public Const STRETCH_HALFTONE  As Long = &H4&

Public Type BITMAPINFOHEADER '40 位元組位元影像檔案頭
        biSize As Long          '結構所需位元組數
        biWidth As Long         '映像寬度
        biHeight As Long        '映像高度
        biPlanes As Integer     '必須為1,不用考慮
        biBitCount As Integer   '顏色位元
        biCompression As Long   '指定是否壓縮,一般取BI_RGB
        biSizeImage As Long     '實際的位元影像佔據的位元組數,=biWidth'(必須是4的整數〕*biHeight
        biXPelsPerMeter As Long '水平解析度
        biYPelsPerMeter As Long '垂直解析度
        biClrUsed As Long       '本映像用到的實際實際顏色數
        biClrImportant As Long  '本映像中重要的顏色數,為0,則認為所有的映像都是重要的
End Type

Public Type RGBQUAD
        rgbBlue As Byte         '該顏色的藍色分量
        rgbGreen As Byte        '該顏色的綠色分量
        rgbRed As Byte          '該顏色的紅色分量
        rgbReserved As Byte     '保留值
End Type

Public Type Bitmap
    bmType As Long
    bmWidth As Long
    bmHeight As Long
    bmWidthBytes As Long
    bmPlanes As Integer
    bmBitsPixel As Integer
    bmBits As Long
End Type

Public Type BitmapInfo
        bmiHeader As BITMAPINFOHEADER
        bmiColors As RGBQUAD
End Type

Public Type BITMAPFILEHEADER
    bfType(1 To 2) As Byte
    bfSize As Long
    bfReserved1 As Integer
    bfReserved2 As Integer
    bfOffBits As Long
End Type


Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function CreateDIBSection Lib "gdi32" (ByVal hdc As Long, pBitmapInfo As BitmapInfo, ByVal un As Long, ByVal lplpVoid As Long, ByVal handle As Long, ByVal dw As Long) As Long
Public Declare Function GetDIBits Lib "gdi32" (ByVal aHDC As Long, ByVal hBitmap As Long, ByVal nStartScan As Long, ByVal nNumScans As Long, lpBits As Any, lpBI As BitmapInfo, ByVal wUsage As Long) As Long
Public Declare Function SetDIBitsToDevice Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, Bits As Any, BitsInfo As BitmapInfo, ByVal wUsage As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Public Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long
Public Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Public Declare Function Bi



相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。