设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1472|回复: 1
打印 上一主题 下一主题

[模块/函数] 【原创】PictureData信息解读

[复制链接]
跳转到指定楼层
1#
发表于 2005-8-7 22:34:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<DIV class=quote>

以下为EMF版(Access 2000及更高版本)的PictureData结构:

'PictureData信息头

PictureData(0-7) PictureData信息头

'EMF信息头

PictureData(8)  iType As Long

PictureData(12)  nSize As Long

PictureData(16)  rclBounds{Long,Long,Long,Long}

PictureData(32)  rclFrame{Long,Long,Long,Long}

PictureData(48)  dSignature As Long

PictureData(52)  nVersion As Long

PictureData(56)  nBytes As Long

PictureData(60)  nRecords As Long

PictureData(64)  nHandles As Integer

PictureData(66)  sReserved As Integer

PictureData(68)  nDescription As Long

PictureData(72)  offDescription As Long

PictureData(76)  nPalEntries As Long

PictureData(80)  szlDevice{Width As Long,Height As Long}

PictureData(88)  szlMillimeters{Long,Long}

PictureData(96)  cbPixelFormat As Long

PictureData(100) offPixelFormat As Long

PictureData(104) bOpenGL As Long

PictureData(108) szMicroMeters{Long,Long}

'EMF数据段

PictureData(116)~结尾

【PictureData信息头】

PictureData(0)指定整个图形的格式:

  DIB:设备无关图元(=40),文件头长度为40,其后为像素数据。

  WMF:Windows MetaFile(=3),文件头长度为8,其后为WMF。

  EMF:Enhanced MetaFile(=14),文件头长度为8,其后为EMF。

Access97及以下版本使用DIB和WMF,Access 2000及以上版本均只使用EMF。

【EMF信息头】

iType指定BMP版本:

  BMP3.0:BITMAPINFOHEADER(=40)也就是DIB

  BMP4.0:BITMAPV4HEADER(=108)

  BMP5.0:BITMAPV5HEADER(=124)

实际上,iType等价于文件头的长度,PictureData(8)~PictureData(8+iType)即图形信息头的全部内容。

【EMF数据段】

由多条EMF记录(EMR)构成,每条记录均包含EMR定义和EMR参数。(EMF信息头其实也是一条特殊的EMR,同样符合EMR格式定义)

EMR定义:

    iType As Long

    nSize As Long

EMR.iType

    EMR_HEADER                      1

    EMR_POLYBEZIER                  2

    EMR_POLYGON                     3

    EMR_POLYLINE                    4

    EMR_POLYBEZIERTO                5

    EMR_POLYLINETO                  6

    EMR_POLYPOLYLINE                7

    EMR_POLYPOLYGON                 8

    EMR_SETWINDOWEXTEX              9

    EMR_SETWINDOWORGEX              10

    EMR_SETVIEWPORTEXTEX            11

    EMR_SETVIEWPORTORGEX            12

    EMR_SETBRUSHORGEX               13

    EMR_EOF                         14

    EMR_SETPIXELV                   15

    EMR_SETMAPPERFLAGS              16

    EMR_SETMAPMODE                  17

    EMR_SETBKMODE                   18

    EMR_SETPOLYFILLMODE             19

    EMR_SETROP2                     20

    EMR_SETSTRETCHBLTMODE           21

    EMR_SETTEXTALIGN                22

    EMR_SETCOLORADJUSTMENT          23

    EMR_SETTEXTCOLOR                24

    EMR_SETBKCOLOR                  25

    EMR_OFFSETCLIPRGN               26

    EMR_MOVETOEX                    27

    EMR_SETMETARGN                  28

    EMR_EXCLUDECLIPRECT             29

    EMR_INTERSECTCLIPRECT           30

    EMR_SCALEVIEWPORTEXTEX          31

    EMR_SCALEWINDOWEXTEX            32

    EMR_SAVEDC                      33

    EMR_RESTOREDC                   34

    EMR_SETWORLDTRANSFORM           35

    EMR_MODIFYWORLDTRANSFORM        36

    EMR_SELECTOBJECT                37

    EMR_CREATEPEN                   38

    EMR_CREATEBRUSHINDIRECT         39

    EMR_DELETEOBJECT                40

    EMR_ANGLEARC                    41

    EMR_ELLIPSE                     42

    EMR_RECTANGLE                   43

    EMR_ROUNDRECT                   44

    EMR_ARC                         45

    EMR_CHORD                       46

    EMR_PIE                         47

    EMR_SELECTPALETTE               48

    EMR_CREATEPALETTE               49

    EMR_SETPALETTEENTRIES           50

    EMR_RESIZEPALETTE               51

    EMR_REALIZEPALETTE              52

    EMR_EXTFLOODFILL                53

    EMR_LINETO                      54

    EMR_ARCTO                       55

    EMR_POLYDRAW                    56

    EMR_SETARCDIRECTION             57

    EMR_SETMITERLIMIT               58

    EMR_BEGINPA
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
 楼主| 发表于 2005-8-7 22:34:00 | 只看该作者
我写的一个PictureData内容的解读程序,比较简单。可以将一个Image控件里的图片数据解读出来。

首先要自己随便创建一个窗体,里面放一个Image控件,命名为Image0,随便绑定一个图片,然后把代码复制到这个窗体里面,点击图片后输出结果在立即窗口里面。

<DIV class=quote>

Option Compare Database

Dim EMR_TYPE(120) As String

Public Sub EMR_DEFINE()

    EMR_TYPE(1) = "EMR_HEADER"

    EMR_TYPE(2) = "EMR_POLYBEZIER"

    EMR_TYPE(3) = "EMR_POLYGON"

    EMR_TYPE(4) = "EMR_POLYLINE"

    EMR_TYPE(5) = "EMR_POLYBEZIERTO"

    EMR_TYPE(6) = "EMR_POLYLINETO"

    EMR_TYPE(7) = "EMR_POLYPOLYLINE"

    EMR_TYPE(8) = "EMR_POLYPOLYGON"

    EMR_TYPE(9) = "EMR_SETWINDOWEXTEX"

    EMR_TYPE(10) = "EMR_SETWINDOWORGEX"

    EMR_TYPE(11) = "EMR_SETVIEWPORTEXTEX"

    EMR_TYPE(12) = "EMR_SETVIEWPORTORGEX"

    EMR_TYPE(13) = "EMR_SETBRUSHORGEX"

    EMR_TYPE(14) = "EMR_EOF"

    EMR_TYPE(15) = "EMR_SETPIXELV"

    EMR_TYPE(16) = "EMR_SETMAPPERFLAGS"

    EMR_TYPE(17) = "EMR_SETMAPMODE"

    EMR_TYPE(18) = "EMR_SETBKMODE"

    EMR_TYPE(19) = "EMR_SETPOLYFILLMODE"

    EMR_TYPE(20) = "EMR_SETROP2"

    EMR_TYPE(21) = "EMR_SETSTRETCHBLTMODE"

    EMR_TYPE(22) = "EMR_SETTEXTALIGN"

    EMR_TYPE(23) = "EMR_SETCOLORADJUSTMENT"

    EMR_TYPE(24) = "EMR_SETTEXTCOLOR"

    EMR_TYPE(25) = "EMR_SETBKCOLOR"

    EMR_TYPE(26) = "EMR_OFFSETCLIPRGN"

    EMR_TYPE(27) = "EMR_MOVETOEX"

    EMR_TYPE(28) = "EMR_SETMETARGN"

    EMR_TYPE(29) = "EMR_EXCLUDECLIPRECT"

    EMR_TYPE(30) = "EMR_INTERSECTCLIPRECT"

    EMR_TYPE(31) = "EMR_SCALEVIEWPORTEXTEX"

    EMR_TYPE(32) = "EMR_SCALEWINDOWEXTEX"

    EMR_TYPE(33) = "EMR_SAVEDC"

    EMR_TYPE(34) = "EMR_RESTOREDC"

    EMR_TYPE(35) = "EMR_SETWORLDTRANSFORM"

    EMR_TYPE(36) = "EMR_MODIFYWORLDTRANSFORM"

    EMR_TYPE(37) = "EMR_SELECTOBJECT"

    EMR_TYPE(38) = "EMR_CREATEPEN"

    EMR_TYPE(39) = "EMR_CREATEBRUSHINDIRECT"

    EMR_TYPE(40) = "EMR_DELETEOBJECT"

    EMR_TYPE(41) = "EMR_ANGLEARC"

    EMR_TYPE(42) = "EMR_ELLIPSE"

    EMR_TYPE(43) = "EMR_RECTANGLE"

    EMR_TYPE(44) = "EMR_ROUNDRECT"

    EMR_TYPE(45) = "EMR_ARC"

    EMR_TYPE(46) = "EMR_CHORD"

    EMR_TYPE(47) = "EMR_PIE"

    EMR_TYPE(48) = "EMR_SELECTPALETTE"

    EMR_TYPE(49) = "EMR_CREATEPALETTE"

    EMR_TYPE(50) = "EMR_SETPALETTEENTRIES"

    EMR_TYPE(51) = "EMR_RESIZEPALETTE"

    EMR_TYPE(52) = "EMR_REALIZEPALETTE"

    EMR_TYPE(53) = "EMR_EXTFLOODFILL"

    EMR_TYPE(54) = "EMR_LINETO"

    EMR_TYPE(55) = "EMR_ARCTO"

    EMR_TYPE(56) = "EMR_POLYDRAW"

    EMR_TYPE(57) = "EMR_SETARCDIRECTION"

    EMR_TYPE(58) = "EMR_SETMITERLIMIT"

    EMR_TYPE(59) = "EMR_BEGINPATH"

    EMR_TYPE(60) = "EMR_ENDPATH"

    EMR_TYPE(61) = "EMR_CLOSEFIGURE"

    EMR_TYPE(62) = "EMR_FILLPATH"

    EMR_TYPE(63) = "EMR_STROKEANDFILLPATH"

    EMR_TYPE(64) = "EMR_STROKEPATH"

    EMR_TYPE(65) = "EMR_FLATTENPATH"

    EMR_TYPE(66) = "EMR_WIDENPATH"

    EMR_TYPE(67) = "EMR_SELECTC LIPPATH"

    EMR_TYPE(68) = "EMR_ABORTPATH"

    EMR_TYPE(70) = "EMR_GDICOMMENT"

    EMR_TYPE(71) = "EMR_FILLRGN"

    EMR_TYPE(72) = "EMR_FRAMERGN"

    EMR_TYPE(73) = "EMR_INVERTRGN"

    EMR_TYPE(74) = "EMR_PAINTRGN"

    EMR_TYPE(75) = "EMR_EXTSELECTCLIPRGN"

    EMR_TYPE(76) = "EMR_BITBLT"

    EMR_TYPE(77) = "EMR_STRETCHBLT"

    EMR_TYPE(78) = "EMR_MASKBLT"

    EMR_TYPE(79) = "EMR_PLGBLT"

    EMR_TYPE(80) = "EMR_SETDIBITSTODEVICE"

    EMR_TYPE(81) = "EMR_STRETCHDIBITS"

    EMR_TYPE(82) = "EMR_EXTCREATEFONTINDIRECTW"

    EMR_TYPE(83) = "EMR_EXTTEXTOUTA"

    EMR_TYPE(84) = "EMR_EXTTEXTOUTW"

    EMR_TYPE(85) = "EMR_POLYBEZIER16"

    EMR_TYPE(86) = "EMR_POLYGON16"

    EMR_TYPE(87) = "EMR_POLYLINE16"

    EMR_TYPE(88) = "EMR_POLYBEZIERTO16"

    EMR_TYPE(89) = "EMR_POLYLINETO16"

    EMR_TYPE(90) = "EMR_POLYPOLYLINE16"

    EMR_TYPE(91) = "EMR_POLYPOLYGON16"

    EMR_TYPE(92) = "EMR_POLYDRAW16"

    EMR_TYPE(93) = "EMR_CREATEMONOBRUSH"

    EMR_TYPE(94) = "EMR_CREATEDIBPATTERNBRUSHPT"

    EMR_TYPE(95) = "EMR_EXTCREATEPEN"

    EMR_TYPE(96) = "EMR_POLYTEXTOUTA"

    EMR_TYPE(97) = "EMR_POLYTEXTOUTW"

    EMR_TYPE(98) = "EMR_SETICMMODE"

    EMR_TYPE(99)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-11-14 13:21 , Processed in 0.088635 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表