• 博客(0)
  • 资源 (37)

空空如也

libfat32&16.tar.gz fat读写库

libfat32&16.tar.gz fat读写库

2010-03-04

USB atmeg8 ISP_源码.rar

USB atmeg8 ISP_源码.rar /* Name: main.c * Project: AVR-Doper * Author: Christian Starkjohann <[email protected]> * Creation Date: 2006-06-21 * Tabsize: 4 * Copyright: (c) 2006 by Christian Starkjohann, all rights reserved. * License: Proprietary, see documentation. * Revision: $Id: main.c 223 2006-07-18 09:28:13Z cs $ */ /* General Description: 本模块实现硬件初始化和USB接口 */ #include "hardware.h" #include <avr/io.h> #include <avr/interrupt.h> #include <avr/pgmspace.h> #include <avr/wdt.h> #include <util/delay.h> #include <string.h> #include <avr/eeprom.h> #include "utils.h" #include "usbdrv.h" #include "oddebug.h" #include "stk500protocol.h" #include "vreg.h" #include "serial.h" /* ------------------------------------------------------------------------- */ extern unsigned char eeprom_sckDuration; extern void timerMsDelay(unsigned char ms); extern unsigned char sckDuration; /*---------- CDC class requests: --------------*/ enum { SEND_ENCAPSULATED_COMMAND = 0, GET_ENCAPSULATED_RESPONSE, SET_COMM_FEATURE, GET_COMM_FEATURE, CLEAR_COMM_FEATURE, SET_LINE_CODING = 0x20, GET_LINE_CODING, SET_CONTROL_LINE_STATE, SEND_BREAK }; /* defines for 'requestType' */ #define REQUEST_TYPE_LINE_CODING 0 /* CDC GET/SET_LINE_CODING */ #define REQUEST_TYPE_HID_FIRST 1 /* first block of HID reporting */ #define REQUEST_TYPE_HID_SUBSEQUENT 2 /* subsequent block of HID reporting */ #define REQUEST_TYPE_HID_DEBUGDATA 3 /* read/write data from/to debug interface */ #define REQUEST_TYPE_VENDOR 4 /* vendor request for get/set debug data */ /* ------------------------------------------------------------------------- */ #if ENABLE_CDC_INTERFACE static uchar modeBuffer[7] = {0x80, 0x25, 0, 0, 0, 0, 8}; /* default: 9600 bps, 8n1 */ #endif static uchar requestType; #if ENABLE_CDC_INTERFACE static PROGMEM char deviceDescrCDC[] = { /* USB 设备描述符 */ 18, /* sizeof(usbDescriptorDevice): 描述符长度 */ USBDESCR_DEVICE, /* 描述答类型 */ 0x01, 0x01, /* USB 版本 */ 0x02, /* 设备类型: CDC */ 0, /* 子类型 */ 0, /* 协议 */ 8, /* 最大包长 */ USB_CFG_VENDOR_ID, /* 2 bytes */ 0xe1, 0x05, /* 2 bytes: shared PID for CDC-ACM devices */ USB_CFG_DEVICE_VERSION, /* 2 bytes */ 1, /* 制造商字符串 index */ 2, /* 生产字符串 index */ 0, /* 序列号字符串 index */ 1, /* 配置字数量 */ }; static PROGMEM char configDescrCDC[] = { /* USB 配置描述符 */ 9, /* sizeof(usbDescriptorConfiguration): 描述符长度 */ USBDESCR_CONFIG, /* 描述答类型 */ 67, 0, /* total length of data returned (including inlined descriptors) */ 2, /* number of interfaces in this configuration */ 1, /* index of this configuration */ 0, /* configuration name string index */ #if USB_CFG_IS_SELF_POWERED USBATTR_SELFPOWER, /* attributes */ #else USBATTR_BUSPOWER, /* attributes */ #endif USB_CFG_MAX_BUS_POWER/2, /* max USB current in 2mA units */ /* interface descriptors follow inline: */ /* Interface Descriptor for CDC-ACM Control */ 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ USBDESCR_INTERFACE, /* descriptor type */ 0, /* index of this interface */ 0, /* alternate setting for this interface */ 1, /* endpoints excl 0: number of endpoint descriptors to follow */ USB_CFG_INTERFACE_CLASS, /* see usbconfig.h */ USB_CFG_INTERFACE_SUBCLASS, USB_CFG_INTERFACE_PROTOCOL, 0, /* string index for interface */ /* CDC Class-Specific descriptors */ 5, /* sizeof(usbDescrCDC_HeaderFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 0, /* Subtype: header functional descriptor */ 0x10, 0x01, /* CDC spec release number in BCD */ 4, /* sizeof(usbDescrCDC_AcmFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 2, /* Subtype: abstract control management functional descriptor */ 0x02, /* capabilities: SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE */ 5, /* sizeof(usbDescrCDC_UnionFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 6, /* Subtype: union functional descriptor */ 0, /* CDC_COMM_INTF_ID: master interface (control) */ 1, /* CDC_DATA_INTF_ID: slave interface (data) */ 5, /* sizeof(usbDescrCDC_CallMgtFn): length of descriptor in bytes */ 0x24, /* descriptor type */ 1, /* Subtype: call management functional descriptor */ 0x03, /* capabilities: allows management on data interface, handles call management by itself */ 1, /* CDC_DATA_INTF_ID: interface used for call management */ /* Endpoint Descriptor */ 7, /* sizeof(usbDescrEndpoint) */ USBDESCR_ENDPOINT, /* descriptor type = endpoint */ 0x83, /* IN endpoint number 3 */ 0x03, /* attrib: Interrupt endpoint */ 8, 0, /* maximum packet size */ 100, /* in ms */ /* Interface Descriptor for CDC-ACM Data */ 9, /* sizeof(usbDescrInterface): length of descriptor in bytes */ USBDESCR_INTERFACE, /* descriptor type */ 1, /* index of this interface */ 0, /* alternate setting for this interface */ 2, /* endpoints excl 0: number of endpoint descriptors to follow */ 0x0a, /* Data Interface Class Codes */ 0, /* interface subclass */ 0, /* Data Interface Class Protocol Codes */ 0, /* string index for interface */ /* Endpoint Descriptor */ 7, /* sizeof(usbDescrEndpoint) */ USBDESCR_ENDPOINT, /* descriptor type = endpoint */ 0x01, /* OUT endpoint number 1 */ 0x02, /* attrib: Bulk endpoint */ 8, 0, /* maximum packet size */ 0, /* in ms */ /* Endpoint Descriptor */ 7, /* sizeof(usbDescrEndpoint) */ USBDESCR_ENDPOINT, /* descriptor type = endpoint */ 0x81, /* IN endpoint number 1 */ 0x02, /* attrib: Bulk endpoint */ 8, 0, /* maximum packet size */ 0, /* in ms */ }; #endif /* ENABLE_CDC_INTERFACE */ /* ------------------------------------------------------------------------- */ uchar usbFunctionDescriptor(usbRequest_t *rq) { uchar *p = NULL, len = 0 ; #if ENABLE_CDC_INTERFACE if(rq->wValue.bytes[1] == USBDESCR_DEVICE){ p = (uchar *)deviceDescrCDC; len = sizeof(deviceDescrCDC); }else{ /* must be config descriptor */ p = (uchar *)configDescrCDC; len = sizeof(configDescrCDC); } #endif usbMsgPtr = p; return len; } /* ------------------------------------------------------------------------- */ /* ----------------------------- USB interface ----------------------------- */ /* ------------------------------------------------------------------------- */ uchar usbFunctionSetup(uchar data[8]) { usbRequest_t *rq = (void *)data; uchar rqType = rq->bmRequestType & USBRQ_TYPE_MASK; if(rqType == USBRQ_TYPE_CLASS) { /* class request type */ #if ENABLE_CDC_INTERFACE if(rq->bRequest == GET_LINE_CODING || rq->bRequest == SET_LINE_CODING){ requestType = REQUEST_TYPE_LINE_CODING; return 0xff; } #endif } return 0; } uchar usbFunctionRead(uchar *data, uchar len) { if(requestType == REQUEST_TYPE_LINE_CODING) { #if ENABLE_CDC_INTERFACE /* return the "virtual" configuration */ memcpy(data, modeBuffer, 7); return 7; #endif } return 0; /* error -> terminate transfer */ } uchar usbFunctionWrite(uchar *data, uchar len) { if(requestType == REQUEST_TYPE_LINE_CODING) { #if ENABLE_CDC_INTERFACE /* Don't know why data toggling is reset when line coding is changed, but it is... */ usbTxPacketCnt1 = 1; /* enforce DATA0 token for next transfer */ /* store the line configuration so that we can return it on request */ memcpy(modeBuffer, data, 7); return 1; #endif } return 1; /* error -> accept everything until end */ } void usbFunctionWriteOut(uchar *data, uchar len) { #if ENABLE_CDC_INTERFACE do{ /* len must be at least 1 character, the driver discards zero sized packets */ stkSetRxChar(*data++); }while(--len); #endif } /* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */ /*********************************************************** 20 脚 HVSP / PP 连接器: 1 .... GND 2 .... Vtarget 3 .... HVSP SCI 4 .... RESET 16 ... HVSP SDO 18 ... HVSP SII 20 ... HVSP SDI * Timer 用途: * Timer 0 [8 bit]: * 1/64 prescaler for timer interrupt * Timer 1 [16 bit]: * PWM 用于高压产生 -> fastPWM mode * f = 23.4 kHz -> prescaler = 1, 9 bit * Timer 2 [8 bit]: * 为目标板提供时钟 **************************************************************/ static void hardwareInit(void) { unsigned char i, j; //------------------------------------------------------------------------------------- // SCK MISO MOSI ISP_RST SMPS_OUT HVSP_SUPPLY PORTB= 0x10;// 0 1 0 0 0 0 DDRB = 0x28;// 1 0 1 0 0 0 //------------------------------------------------------------------------------------- // ISP_RESET _HVSP_HVRESET _HVSP_SCI LED ADC_VTARGET ADC_SMPS PORTC= 0x00;// 0 0 0 0 0 0 DDRC = 0x3C;// 1 1 1 1 0 0 //------------------------------------------------------------------------------------- // HVSP_SDO HVSP_SDI HVSP_SII JUMPER USB_D- USB_D+ TXD(ISP_RXD) RXD(ISP_TXD) PORTD= 0x10;// 0 0 0 1 0 0 1 1 DDRD = 0x0C;// 0 0 0 0 1 1 0 1 //------------------------------------------------------------------------------------------ j = 0; while(--j){ /* USB Reset by device only required on Watchdog Reset */ i = 0; while(--i); /* delay >10ms for USB reset */ } DDRD &=~( (1<<_USB_DPLUS)|(1<<_USB_DMINUS) ); /*-------------- T0 配置: ~ 1.365 ms interrupt -----------------*/ TCCR0 = 3; // 1/64 分频 TIMSK = (1 << TOIE0); // 使能 timer0 溢出中断 /*-------------- T1 配置: ~23.4 kHz PWM (9 bit) ----------------*/ TCCR1A = UTIL_BIN8(1000, 0010); // OC1A = PWM, OC1B disconnected, 9 bit TCCR1B = UTIL_BIN8(0000, 1001); // 9 bit, prescaler=1 OCR1A = 1; // 设占空比为最小 /*-------------- T2 配置 ---------------------------------------*/ TCCR2 = UTIL_BIN8(0000, 1001); // OC2 disconnected, prescaler=1 OCR2 = 0; // 产生 3 MHz 时钟 } int main(void) { wdt_enable(WDTO_1S); odDebugInit(); hardwareInit(); vregInit(); usbInit(); sckDuration=eeprom_read_byte(&eeprom_sckDuration); if(sckDuration==0xFF) sckDuration=3; sei(); //--------------------------- PORTC |= (1<<PC2); // 亮灯 timerMsDelay(250); PORTC &=~(1<<PC2); // 灭灯 //--------------------------- for(;;){ /* main event loop */ wdt_reset(); usbPoll(); #if ENABLE_CDC_INTERFACE if( usbInterruptIsReady()){ static uchar sendEmptyFrame = 1, buffer[8]; // 开始用空帧是因为主机吃掉了第一个包 -- don't know why... int c; uchar i = 0; while(i < 8 && (c = stkGetTxByte()) >= 0) { buffer[i++] = c; } if(i > 0 || sendEmptyFrame){ sendEmptyFrame = i; /* send an empty block after last data block to indicate transfer end */ usbSetInterrupt(buffer, i); } } #endif } return 0; }

2010-02-22

Windows+Xp+DDK开发usb驱动程序实例.rar

Windows+Xp+DDK开发usb驱动程序实例.rar USB开发实例下载,收藏一下

2010-01-18

VC AT+CMGR短信收发(PDU格式)程序包括PDU编解码

VC AT+CMGR短信收发(PDU格式)程序包括PDU编解码

2010-01-07

用户自定义USB HID设备下位机固件源代码包

用户自定义USB HID设备下位机固件源代码包

2009-12-16

多媒体USB键盘源代码包

多媒体USB键盘源代码包 多媒体USB键盘源代码包

2009-12-16

带鼠标功能的USB键盘双报文

带鼠标功能的USB键盘双报文 #include &quot;Key.h&quot; #include &quot;MyType.h&quot; #include &quot;config.h&quot; volatile uint8 idata KeyCurrent,KeyOld,KeyNoChangedTime; volatile uint8 idata KeyPress; volatile uint8 idata KeyDown,KeyUp,KeyLast; volatile uint8 KeyCanChange;

2009-12-16

D21_USB鼠标源代码+驱动

1、压缩包中包含了由盛唐公司研制的USB_D12开发评估板实现USB鼠标的全部源代码 2、源代码中的U_Mouse.C文件实现了数据通讯的协议,Chap_9.C含有鼠标枚举所需的各种描述符。 3、上述文件实为USB接口芯片D12开发的经典参考资料及制作USB鼠标的极佳参考原型。 4、阅读源程序前务必先阅读开发评估板的使用说明书各评估板的电路原理图,方能快速理解源程序。 5、需要USB鼠标的底层驱动程序的开发者请与作者联系。

2009-12-16

h.264视频编解码源代码.rar

h.264视频编解码源代码.rar 详细说明:h.264标准代码,用于视频编码!可以实现各种视频的编码和解码,可以在这个代码的基础上进行各种开发,比如算法的优化,转码技术,实现各种分辨了的转码-h.264 standard code, uses in the video frequency code! May realize each kind of video frequency code and the decoding, may carry on each kind of development in this code foundation, for instance the algorithm optimization, transfers the code technology, realizes each kind has distinguished extension code 文件列表: jm73 ....\JM ....\..\bin ....\..\...\decoder.cfg ....\..\...\encoder.cfg ....\..\...\lencod.exe ....\..\...\lencod.map ....\..\...\lencod.pdb ....\..\CHANGES.TXT ....\..\Changes_detail.txt ....\..\copyright.txt ....\..\disclaimer.txt ....\..\doc ....\..\...\coding_style.doc ....\..\...\doxygen.txt ....\..\...\h26l.css ....\..\...\ldecod.dox ....\..\...\lencod.dox ....\..\encoder.cfg ....\..\foreman_part_qcif.yuv ....\..\ldecod ....\..\......\inc ....\..\......\...\annexb.h ....\..\......\...\biaridecod.h ....\..\......\...\block.h ....\..\......\...\cabac.h ....\..\......\...\context_ini.h ....\..\......\...\contributors.h ....\..\......\...\ctx_tables.h ....\..\......\...\defines.h ....\..\......\...\elements.h ....\..\......\...\erc_api.h ....\..\......\...\erc_do.h ....\..\......\...\erc_globals.h ....\..\......\...\errorconcealment.h ....\..\......\...\fmo.h ....\..\......\...\global.h ....\..\......\...\header.h ....\..\......\...\image.h ....\..\......\...\leaky_bucket.h ....\..\......\...\macroblock.h ....\..\......\...\mbuffer.h ....\..\......\...\mb_access.h ....\..\......\...\memalloc.h ....\..\......\...\nalu.h ....\..\......\...\nalucommon.h ....\..\......\...\output.h ....\..\......\...\parset.h ....\..\......\...\parsetcommon.h ....\..\......\...\rtp.h ....\..\......\...\sei.h ....\..\......\...\vlc.h ....\..\......\Makefile ....\..\......\src ....\..\......\...\annexb.c ....\..\......\...\biaridecod.c ....\..\......\...\block.c ....\..\......\...\cabac.c ....\..\......\...\context_ini.c ....\..\......\...\erc_api.c ....\..\......\...\erc_do_i.c ....\..\......\...\erc_do_p.c ....\..\......\...\errorconcealment.c ....\..\......\...\filehandle.c ....\..\......\...\fmo.c ....\..\......\...\header.c ....\..\......\...\image.c ....\..\......\...\ldecod.c ....\..\......\...\leaky_bucket.c ....\..\......\...\loopFilter.c ....\..\......\...\macroblock.c ....\..\......\...\mbuffer.c ....\..\......\...\mb_access.c ....\..\......\...\memalloc.c ....\..\......\...\nal.c ....\..\......\...\nalu.c ....\..\......\...\nalucommon.c ....\..\......\...\nal_part.c ....\..\......\...\output.c ....\..\......\...\parset.c ....\..\......\...\parsetcommon.c ....\..\......\...\rtp.c ....\..\......\...\sei.c ....\..\......\...\vlc.c ....\..\ldecod.dsp ....\..\ldecod.dsw ... ...

2009-06-30

cximage600.rar包括VC版,WInCE版,应用实例,源码

cximage600.rar包括VC版,WInCE版,应用实例,源码 cximage600_ce.7z cximage600_demo.zip cximage600_full.7z 可以读取jpg,jpeg,png,bmp,gif,tiff,等文件,可以实现各种滤镜,带源码

2009-02-26

cximage600_demo.zip CxImage CxImageRAW

cximage600_demo.zip 别人写的 Preface Years after the previous version, I can tell that the article has survived its author, and even if my opinion on the limits of this library has not changed, an update was really necessary. Thank you very much to all the people that gave their contribution to this new release, with hundreds of small and big enhancements, my role was mainly to put all the pieces together. Introduction & License CxImage is a C++ class that can load, save, display, and transform images in a very simple and fast way. The class CxImage is free; as for the TIFF, JPEG, PNG and ZLIB libraries : "If you use this source code in a product, acknowledgement is not required but would be appreciated." CxImage is open source and licensed under the zlib license . In a nutshell, this means that you can use the code however you wish, as long as you don't claim it as your own. What's New in Version 6.00 The complete list of bugfixes and enhancements is reported in the documentation, (see \doc\cximage_history.htm, or this link). Here I will highlight some of the new features. An application written with CxImage version 5.99 should work also with the new version; the interface of few methods is different, normally because of new parameters, but the default behaviour is the same. The applications linked with the old DLL will not work with the new one; but if necessary you can edit the declarations, or add new overloads, and revert to the old interface for the DLL. An issue to take care is ENUM_CXIMAGE_FORMATS: in the old version the CXIMAGE_FORMAT_... can change the value, depending on the supported formats enabled by the corresponding CXIMAGE_SUPPORT_... switch. In the new version, CXIMAGE_FORMAT_... are assigned to unique values. Static methods like GetNumTypes, GetTypeIdFromName, GetTypeIdFromIndex, GetTypeIndexFromId will help the application to manage the new policy. File Formats & Linked C Libraries CxImage works with the latest version of these libraries: Zlib (1.2.3), Jasper ( 1.900.1), LibMNG (1.0.10), LibPNG (1.2.24). LibTIFF 3.8.2 can be linked with CxImage, but the version included in the CxImage distribution (3.5.7, patched) can read images with OJPEG compression, or with non standard bit per samples. The choice is up to you. The j2k library (now openjpeg), and the associated class CxImageJ2K, have been removed from the project. JPEG2000 images are supported through Jasper and CxImageJAS. CxImage 6.00 includes a new class (CxImageRAW) and a new library (LibDCR) to read RAW images from digital cameras; common file extension are: RAW, CRW, NEF, CR2, DNG, ORF, ARW, ERF, 3FR, DCR, X3F, MEF, RAF, MRW, PEF, SR2. LibDCR is based on Dave Coffin's dcraw.c; and offers the same features of the original dcraw application (see the "dcr.dsw" project included in the \raw directory). The restricted features under the GPL Version 2 are disabled; please read the license terms in "libdcr.h" before enabling the restricted code. CxImageRAW implements the basic functions to decode the image, the only available option controlled by SetCodecOption, is about the interpolation quality (DECODE_QUALITY_LIN=0, DECODE_QUALITY_VNG=1, DECODE_QUALITY_PPG=2, DECODE_QUALITY_AHD=3). CxImagePNG has been improved to read and write all of the PNG_COLOR_TYPE_... combinations. PNGs with a "pixel depth" more that 8 bits per channel will be converted down to 8 bits, this is the major limit in CxImage. CxImageGIF: better support for reading animated GIF, now can decode all frames in a single pass, if enabled with SetRetreiveAllFrames. The CxImage demo implements this option, and shows how to play an animated GIF (when the program asks "File with N images. Read all?", select "Cancel"). CxImageBMP: reads and writes 32 bit images (with alpha layer). CxImageICO: reads and writes Vista (PNG) icons; and added support for writing multipage icons. CxImageMNG: reads MNGs with alpha layer. CxImageSKA: new class for SKA image format, used in some video rental application. CxImageJPG: new options for the JPEG format subsampling (ENCODE_SUBSAMPLE_422, ENCODE_SUBSAMPLE_444), default is 4:1:1 (high), can be set to 4:2:2 (medium) or 4:4:4 (none). The next table shows the different amount of artifacts in the compressed image, using to different subsampling. 4:4:4 subsampling is useful in images with sharp edges, to reduce the typical blurring effect of the JPG compression. original image JPG image and artefacts, quality 75, subsampling 4:1:1 JPG image and artefacts, quality 75, subsampling 4:4:4

2009-02-26

arm-mp3-源代码。.zip

arm-mp3-源代码。.zip arm-mp3-源代码。.zip arm-mp3-源代码。.zip

2009-02-05

内部资料——蓝牙处理技术.zip

内部资料——蓝牙处理技术.zip 内部资料——蓝牙处理技术.zip

2009-02-05

MTK+6227原理图.pdf

MTK+6227原理图.pdf MTK+6227原理图.pdf

2009-02-05

MTK6226__CPU原理角位图.rar

MTK6226__CPU原理角位图.rar MTK6226__CPU原理角位图.rar

2009-02-05

MTK6228_方案的完整原理图.rar

MTK6228_方案的完整原理图.rar MTK6228_方案的完整原理图.rar

2009-02-05

MTK升级线USB驱动程序.rar

MTK升级线USB驱动程序.rar MTK升级线USB驱动程序.rar

2009-02-05

MTK方案套片datasheet-MTK6227手册.pdf

MTK方案套片datasheet-MTK6227手册.pdf MTK方案套片datasheet-MTK6227手册.pdf MTK方案套片datasheet-MTK6227手册.pdf

2009-02-05

GSM移动终端的at指令.pdf

GSM移动终端的at指令.pdf GSM移动终端的at指令.pdf

2009-02-05

071022@52RD_MTK入门导读.doc

071022@52RD_MTK入门导读.doc

2009-02-05

MTK开发平台MTK资料整合大全

MTK开发平台,MTK资料整合大全,MTK6228 MTK开发板资料,MTK217

2009-02-05

c++bitmap图片处理类CBitmapEx

这是一个用于C++ MFC开发的Bitmap图片操作类,在文件中叫CBitmapEx,可用于放大,缩小,翻转,过渡和其他有用的功能,有兴趣的朋友可以下载看看。 部分public method: // // void Create(long width, long height); // void Create(CBitmapEx& bitmapEx); // void Load(LPTSTR lpszBitmapFile); // void Save(LPTSTR lpszBitmapFile); // void Scale(long horizontalPercent=100, long verticalPercent=100); // void Rotate(long degrees=0, _PIXEL bgColor=_RGB(0,0,0)); // void FlipHorizontal(); // void FlipVertical(); // void MirrorLeft(); // void MirrorRight(); // void MirrorTop(); // void MirrorBottom(); // void Clear(_PIXEL clearColor=_RGB(0,0,0)); // void Negative(); // void Grayscale(); // void Sepia(long depth=34); // void Emboss(); // void Engrave(); // void Pixelize(long size=4); // void Draw(HDC hDC); // void Draw(long dstX, long dstY, long width, long height, // CBitmapEx& bitmapEx, long srcX, long srcY); // void Draw(long dstX, long dstY, long width, long height, // CBitmapEx& bitmapEx, long srcX, long srcY, long alpha); // void Draw(long dstX, long dstY, long dstWidth, long dstHeight, // CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight); // void Draw(long dstX, long dstY, long dstWidth, long dstHeight, CBitmapEx& bitmapEx, // long srcX, long srcY, long srcWidth, long srcHeight, long alpha); // void DrawTransparent(long dstX, long dstY, long width, long height, // CBitmapEx& bitmapEx, long srcX, long srcY, _PIXEL transparentColor=_RGB(0,0,0)); // void DrawTransparent(long dstX, long dstY, long width, long height, // CBitmapEx& bitmapEx, long srcX, long srcY, long alpha, // _PIXEL transparentColor=_RGB(0,0,0)); // void DrawTransparent(long dstX, long dstY, long dstWidth, long dstHeight, // CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, // _PIXEL transparentColor=_RGB(0,0,0)); // void DrawTransparent(long dstX, long dstY, long dstWidth, long dstHeight, // CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, // long alpha, _PIXEL transparentColor=_RGB(0,0,0)); // LPBITMAPFILEHEADER GetFileInfo() {return &m_bfh;} // LPBITMAPINFOHEADER GetInfo() {return &m_bih;} // long GetWidth() {return m_bih.biWidth;} // long GetHeight() {return m_bih.biHeight;} // long GetPitch() {return m_iPitch;} // long GetBpp() {return m_iBpp;} // long GetPaletteEntries() {return m_iPaletteEntries;} // LPRGBQUAD GetPalette() {return m_lpPalette;} // DWORD GetSize() {return m_dwSize;} // LPBYTE GetData() {return m_lpData;} // void SetResampleMode(RESAMPLE_MODE mode=RM_NEARESTNEIGHBOUR) {m_ResampleMode = mode;} // RESAMPLE_MODE GetResampleMode() {return m_ResampleMode;} // BOOL IsValid() {return (m_lpData != NULL);} // _PIXEL GetPixel(long x, long y); // void SetPixel(long x, long y, _PIXEL pixel); // 这篇文章介绍了一个叫CBitmapEx的简单的C++位图操作类。很多次我面对这样一个事实:MFC库只能提供一个只带有有限特征的C++位图操作类CBitmap。我需要诸如比例尺、旋转角度、应用不同滤波等等特征,但是CBitmap并不具有。另一个类CDC (设备上下文)提供了诸如拉伸度、透明性和透明混色等更多的选项,但它运行得太慢(被很多人很多次所证实)。 所以,我决定去写另一个(是的,另一个)不依赖MFC的位图操作类,并且提供一些目前在原来MFC没有实现的特性。这个类能加载任何8位、16位、24位和32位的位图,但在里面是和32位位图运行的。能够将结果图像保存24位位图到硬盘,或者它能够在设备上下文中画出位图。 背景 在Code Project有很多文章讨论过这个话题,所以你可以随意翻阅它们并将它们的最终结果和我的实现作比较。 代码用法 使用这个类非常简单,请看下面: #include "BitmapEx.h" // 装载位图 CBitmapEx bitmapEx; bitmapEx.Load(_T("Enter bitmap source file path here...")); // Do whatever you need to do here bitmapEx.Rotate(45); bitmapEx.Sepia(); bitmapEx.Scale(50, 50); // 在屏幕上绘制位图(首先在别的地方得到设备句柄) bitmapEx.Draw(hDC); // 保存位图 bitmapEx.Save(_T("Enter bitmap destination file path here...")); 这儿有很多的公共的方法。请看下面: 创建位图/加载位图/保存位图 你能使用这个类去加载磁盘或者内存字节流上任何8位到32位的位图。这个类将把它转化为内部的32位位图。之后进行保存操作,位图将被再次转化为24位位图并且被保存在磁盘或内存。你能通过提供的方法来创建空白位图。 使用如下方法,可以在磁盘或内存中创建、加载和保存位图: void Create(long width, long height); void Create(CBitmapEx& bitmapEx); void Load(LPTSTR lpszBitmapFile); void Load(LPBYTE lpBitmapData); void Save(LPTSTR lpszBitmapFile); void Save(LPBYTE lpBitmapData); 一般的变换方法 这个类提供了一些诸如缩放、旋转和镜像等一般的变换方法。在缩放和旋转操作中位图的细节信息将会掉失,所以实现了三种插值方法: 最近邻插值(插值速度最快,无修改信息,图像质量低) 双线性插值法(插值速度快,图像质量较好) 三次B样条(插值速度慢,图像质量最好) 你可以使用SetResampleMode()函数来确定使用哪种插值方法。下面是变换方法列表: void Scale(long horizontalPercent=100, long verticalPercent=100); void Rotate(long degrees=0, _PIXEL bgColor=_RGB(0,0,0)); void FlipHorizontal(); void FlipVertical(); void MirrorLeft(); void MirrorRight(); void MirrorTop(); void MirrorBottom(); 你可以围绕x轴或y轴进行缩放位图,从0度到360度进行旋转位图,或者对位图进行倒立和镜像。当你对位图进行倒立或镜像,不要求你指定插值方式因为你没有改变位图尺寸。 当你旋转位图时你可以设置背景颜色,默认背景颜色是黑色。 简单的位图过滤 这儿实现了6种简单的滤波方法(将来会实现更多)来做一个简单的位图卷积过滤。Clear()方法可以使用你指定的颜色来填充位图。 void Clear(_PIXEL clearColor=_RGB(0,0,0)); void Negative(); void Grayscale(); void Sepia(long depth=34); void Emboss(); void Engrave(); void Pixelize(long size=4); 对一些滤波,比如Sepia() 和 Pixelize(),你可以通过改变输入参数来得到不同的输出结果。 绘制位图 下面是CBitmapEx类的核心函数列表: void Draw(HDC hDC); void Draw(HDC hDC, long dstX, long dstY); void Draw(long dstX, long dstY, long width, long height, CBitmapEx& bitmapEx, long srcX, long srcY); void Draw(long dstX, long dstY, long width, long height, CBitmapEx& bitmapEx, long srcX, long srcY, long alpha); void Draw(long dstX, long dstY, long dstWidth, long dstHeight, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight); void Draw(long dstX, long dstY, long dstWidth, long dstHeight, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, long alpha); void Draw(_QUAD dstQuad, CBitmapEx& bitmapEx); void Draw(_QUAD dstQuad, CBitmapEx& bitmapEx, long alpha); void Draw(_QUAD dstQuad, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight); void Draw(_QUAD dstQuad, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, long alpha); void DrawTransparent(long dstX, long dstY, long width, long height, CBitmapEx& bitmapEx, long srcX, long srcY, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(long dstX, long dstY, long width, long height, CBitmapEx& bitmapEx, long srcX, long srcY, long alpha, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(long dstX, long dstY, long dstWidth, long dstHeight, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(long dstX, long dstY, long dstWidth, long dstHeight, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, long alpha, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(_QUAD dstQuad, CBitmapEx& bitmapEx, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(_QUAD dstQuad, CBitmapEx& bitmapEx, long alpha, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(_QUAD dstQuad, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, _PIXEL transparentColor=_RGB(0,0,0)); void DrawTransparent(_QUAD dstQuad, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, long alpha, _PIXEL transparentColor=_RGB(0,0,0)); void DrawBlended(long dstX, long dstY, long width, long height, CBitmapEx& bitmapEx, long srcX, long srcY, long startAlpha, long endAlpha, DWORD mode=GM_NONE); void DrawBlended(long dstX, long dstY, long dstWidth, long dstHeight, CBitmapEx& bitmapEx, long srcX, long srcY, long srcWidth, long srcHeight, long startAlpha, long endAlpha, DWORD mode=GM_NONE); 你可以看到这儿有很多不同的位图绘制方法。指定原尺寸和目标尺寸能够以不同的比例显示位图。最终的图像质量和显示速度取决你选择的插值方法。在大多数的情况下,双线性插值法是平衡显示速度和图像质量的一种比较好的方法。它类似于GDI的StretchBlt()函数。 除了一般的显示方法,这儿还有特别的显示方法。使用Draw()函数通过设置_QUAD参数你可以在你指定的四个角顶点的多边形绘制位图。它类似于GDI的PlgBlt()函数,只是它提供了更多的自由,那就是,它能做投影变化同时不仅仅是仿射位图变换。一些人将会发现这个非常有用。 另一组可用的位图绘制方法是DrawTransparent()函数组。它所能做就是:它能在原位图中指定一种透明颜色。另外,它能显示位图的投影变化。 所有的位图绘制函数能够提供一个不透明性参数只要它在绘制操作中能被应用。这个类似于使用GDI的AlphaBlend()函数。 通过结合不同的位图绘制方法,能够出现一些很酷的显示效果。 为了使用前面两种函数在屏幕上显示位图或者其它设备环境,需要一个设备句柄作为输入参数。 位图信息函数 下面是一些可用的获取位图信息的函数: LPBITMAPFILEHEADER GetFileInfo() {return &m_bfh;} LPBITMAPINFOHEADER GetInfo() {return &m_bih;} long GetWidth() {return m_bih.biWidth;} long GetHeight() {return m_bih.biHeight;} long GetPitch() {return m_iPitch;} long GetBpp() {return m_iBpp;} long GetPaletteEntries() {return m_iPaletteEntries;} LPRGBQUAD GetPalette() {return m_lpPalette;} DWORD GetSize() {return m_dwSize;} LPBYTE GetData() {return m_lpData;} void SetResampleMode(RESAMPLE_MODE mode=RM_NEARESTNEIGHBOUR) {m_ResampleMode = mode;} RESAMPLE_MODE GetResampleMode() {return m_ResampleMode;} BOOL IsValid() {return (m_lpData != NULL);} 直接的像素访问函数 这方面也提供了一些重要的函数,请看下面: _PIXEL GetPixel(long x, long y); void SetPixel(long x, long y, _PIXEL pixel); 这些方法然而比一般的直接内存访问要慢。你可以通过使用GetData()成员函数来得到位图内存缓冲。使用这个位图内存缓冲你能做任何你设想为位图实时处理。对有测试性质的意图这种方法比直接的像素访问要安全。 使用CBitmapEx类的注意事项: 使用所有这些方法你能做任何类型你需要的绘制和变换。对,几乎是所有。而且更多的滤波将被添加进来,更多的变换将得到应用。 还有,读者的评论对于源码更新非常有用。新的函数,比如从内存流中加载和保存已经添加,同时添加的函数还有通过插入点在客户设备绘制位图。 原来许多的绘制函数现在已改由内置的汇编函数实现来获取更高的速度。源码已经添加注释以助于更好的理解。所有关于汇编程序的优化都是欢迎的(因为我并非这方面的专家)。 关于示例工程 工程中的CEffectorBuilder类是一个特别的类,仅仅是作为一个示例去创建动画。这个类使用CBitmapEx类去加载位图文件并对它们作各种变换。上面的截图显示示例工程的屏幕输出。这儿有很多可用绘制和变换的效果你可以自由去体验。最终结果看起来很好! 有趣的地方 使用这个类我已经很多次发现一种完美的图形加速方法。它就是使用固定点运算。它被应用于CBitmapEx类的每个角落,几乎在每个单独的浮点乘法和除法。所以,不要对你仅仅使用这个类就能取得实时的动画速度感到惊奇。看看使用CBitmapEx类的示例工程所取得的实时动画速度。

2009-02-03

dotfuscator4.3 软件下载

dotfuscator4.3 软件下载

2008-12-22

ViewDLL2.0.rar查看DLL函数定义工具

ViewDLL2.0.rar查看DLL函数定义工具

2008-09-25

OleView.rar 查看DLL方法,CLID的好工具

OleView.rar 查看DLL方法,CLID的好工具

2008-09-25

GB28181平台简单测试软件

GB28181平台简单测试软件 windows 平台软件 测试工具软件

2016-07-04

GB28181国标视频测试工具

GB28181国标视频测试工具 国标安防监控测试工具 GB28181认证之前自测工具

2016-07-04

Rational+AppScan破解.rar

破解方法: 1.屏蔽所有防病毒软件 2.将patch.exe拷贝到appscan的安装目录下,运行 3.运行keygen.exe,会产生licence.lic文件 4.在appscan的许可证界面,点击“旧许可证”,导入licence.lic文件即可。

2013-07-11

JavaScrip脚本解释源代码下载

JavaScrip脚本解释源代码下载 支持汇编执行

2012-11-23

skn皮肤-里面包含120个不同软件皮肤

skn皮肤,skin,软件皮肤,皮肤打包下载

2012-10-24

C语言教程讲义(谭浩强).pdf

C语言教程讲义(谭浩强) 最经典的电子书,很不错,共享一下.

2011-12-09

freetype-2.4.6.tar.bz2 undefined reference to `FT_Library_SetLcdFilter'

/opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so:-1: 错误:undefined reference to `FT_Library_SetLcdFilter'

2011-10-06

fontconfig-2.8.0.tar.gz qt编译出现 FcFreeTypeQueryFace

/opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so:-1: 错误:undefined reference to `FcFreeTypeQueryFace' /opt/QtSDK/Desktop/Qt/474/gcc/lib/libQtGui.so:-1: 错误:undefined reference to `FT_Library_SetLcdFilter'

2011-10-06

libstdc++.so.6.0.13 安装 Qt_SDK_Lin32_offline_v1_1_3_en.run 所须

libstdc++.so.6.0.13 安装 Qt_SDK_Lin32_offline_v1_1_3_en.run 所须

2011-10-06

vc图象处理.rar

34467bmplib的读取和各种经典图片变化处理算法的比较.rar ImageProcessing\Debug ImageProcessing\Release ImageProcessing\res\ImageProcessing.ico ImageProcessing\res\ImageProcessing.rc2 ImageProcessing\res\ImageProcessingDoc.ico ImageProcessing\res\Toolbar.bmp ImageProcessing\res ImageProcessing\~VC265.tmp ImageProcessing\cdib.cpp ImageProcessing\cdib.h ImageProcessing\ChildFrm.cpp ImageProcessing\ChildFrm.h ImageProcessing\ColorTable.h ImageProcessing\Default.SUP ImageProcessing\DIBPrcs.cpp ImageProcessing\DibShow.cpp ImageProcessing\DlgAftReg.cpp ImageProcessing\DlgAftReg.h ImageProcessing\DlgArith.cpp ImageProcessing\DlgBitPlane.cpp ImageProcessing\DlgCoding.h ImageProcessing\DlgCodingHuffman.cpp ImageProcessing\DlgEhnLinTrans.cpp ImageProcessing\DlgEhnLinTrans.h ImageProcessing\DlgEnhColor.cpp ImageProcessing\DlgEnhColor.h ImageProcessing\DlgHistShow.cpp ImageProcessing\DlgHistShow.h ImageProcessing\DlgHistShow1.cpp ImageProcessing\DlgHistShow1.h ImageProcessing\DlgHuffman.cpp ImageProcessing\DlgMedian.cpp ImageProcessing\DlgMedian.h ImageProcessing\DlgRecMatch.cpp ImageProcessing\DlgRecMatch.h ImageProcessing\DlgReg.cpp ImageProcessing\DlgReg.h ImageProcessing\DlgShannon.cpp ImageProcessing\DlgSmooth.cpp ImageProcessing\DlgSmooth.h ImageProcessing\DWT.CPP ImageProcessing\Enhance.cpp ImageProcessing\FreTrans.cpp ImageProcessing\GlobalApi.h ImageProcessing\ImageAnalysis.cpp ImageProcessing\ImageCoding.cpp ImageProcessing\ImageProcessing.aps ImageProcessing\ImageProcessing.clw ImageProcessing\ImageProcessing.cpp ImageProcessing\ImageProcessing.dsp ImageProcessing\ImageProcessing.dsw ImageProcessing\ImageProcessing.h ImageProcessing\ImageProcessing.ncb ImageProcessing\ImageProcessing.plg ImageProcessing\ImageProcessing.rc ImageProcessing\ImageProcessingDoc.cpp ImageProcessing\ImageProcessingDoc.h ImageProcessing\ImageProcessingView.cpp ImageProcessing\ImageProcessingView.h ImageProcessing\ImageView.cpp ImageProcessing\MainFrm.cpp ImageProcessing\MainFrm.h ImageProcessing\Motion.cpp ImageProcessing\ReadMe.txt ImageProcessing\Recog.asp ImageProcessing\Recog.cpp ImageProcessing\resource.h ImageProcessing\restore.cpp ImageProcessing\SegApi.cpp ImageProcessing\StdAfx.cpp ImageProcessing\StdAfx.h ImageProcessing\ImageProcessing.opt ImageProcessing result\第10章\Thumbs.db result\第10章\边界提取_原图.bmp result\第10章\骨架提取.bmp result\第10章\骨架提取后.bmp result\第10章\骨架提取后复员.bmp result\第10章\空穴阈值面积检出.bmp result\第10章\轮廓提取.bmp result\第10章\市街区距离.bmp result\第10章\市街区距离变换.bmp result\第10章\消去阈值面积空穴.bmp result\第10章 result\第11章\canny算子分割.bmp result\第11章\laplacian算子分割.bmp result\第11章\prewitt算子分割.bmp result\第11章\robert算子分割.bmp result\第11章\sobel算子分割.bmp result\第11章\Thumbs.db result\第11章\边界跟踪原图.bmp result\第11章\边界跟踪运行结果.bmp result\第11章\固定阈值分割原图.BMP result\第11章\固定阈值分割运行结果.bmp result\第11章\区域生长原图.BMP result\第11章\区域生长运行结果.bmp result\第11章\自适应阈值分割原图.BMP result\第11章\自适应阈值分割运行结果.bmp result\第11章 result\第12章\Thumbs.db result\第12章\模板.bmp result\第12章\图象识别运行结果gray.bmp result\第12章\原图.bmp result\第12章 result\第3章\Baye_lena.bmp result\第3章\Couple 方法1.bmp result\第3章\Couple 方法2.bmp result\第3章\Couple.bmp result\第3章\Floyd-Steinberg_lena.bmp result\第3章\lena.bmp result\第3章\Thumbs.db result\第3章 result\第4章\Butterworth低通滤波运行结果.bmp result\第4章\Butterworth高通滤波运行结果.bmp result\第4章\lena原图.bmp result\第4章\理想低通滤波运行结果.bmp result\第4章\理想高通滤波运行结果.bmp result\第4章\图象灰度变换运行结果.bmp result\第4章\图象平滑运行结果.bmp result\第4章\图象锐化运行结果.bmp result\第4章\图象伪彩色编码运行结果.bmp result\第4章\图象中值滤波运行结果.bmp result\第4章\直方图均衡运行结果.bmp result\第4章\直方图显示结果.bmp result\第4章\Thumbs.db result\第4章 result\第5章\lena.bmp result\第5章\motion_fuzzy_lena.bmp result\第5章\motion_restore_lena.bmp result\第5章\Thumbs.db result\第5章\加噪模糊lena.bmp result\第5章\加噪退化lena.bmp result\第5章\逆滤波复原lena.bmp result\第5章\逆滤波退化lena.bmp result\第5章\维纳滤波lena.bmp result\第5章 result\第6章\lena.bmp result\第6章\lena_256沃尔什变换.bmp result\第6章\lena_256余弦变换.BMP result\第6章\lenna_DWT_1.bmp result\第6章\lenna_DWT_2.bmp result\第6章\rec.bmp result\第6章\rec_Hotelling.bmp result\第6章\rec2.bmp result\第6章\rec2傅立叶变换.bmp result\第6章\Thumbs.db result\第6章 result\第7章\lena.bmp result\第7章\lena_256平面1.BMP result\第7章\lena_256平面2.BMP result\第7章\lena_256平面3.BMP result\第7章\lena_256平面4.BMP result\第7章\lena_256平面6.BMP result\第7章\lena_256平面7.BMP result\第7章\lena_256平面8.BMP result\第7章\Thumbs.db result\第7章 result\第8章\Thumbs.db result\第8章\配准结果.bmp result\第8章\图1.bmp result\第8章\图2.bmp result\第8章 result\第9章\Sequence\TestImg001.bmp result\第9章\Sequence\TestImg002.bmp result\第9章\Sequence\TestImg003.bmp result\第9章\Sequence\TestImg004.bmp result\第9章\Sequence\TestImg005.bmp result\第9章\Sequence\TestImg006.bmp result\第9章\Sequence\TestImg007.bmp result\第9章\Sequence\TestImg008.bmp result\第9章\Sequence\TestImg009.bmp result\第9章\Sequence\TestImg010.bmp result\第9章\Sequence\TestImg011.bmp result\第9章\Sequence\TestImg012.bmp result\第9章\Sequence\TestImg013.bmp result\第9章\Sequence\TestImg014.bmp result\第9章\Sequence\TestImg015.bmp result\第9章\Sequence\TestImg016.bmp result\第9章\Sequence\TestImg017.bmp result\第9章\Sequence\TestImg018.bmp result\第9章\Sequence\TestImg019.bmp result\第9章\Sequence\TestImg020.bmp result\第9章\Sequence\Thumbs.db result\第9章\Sequence result\第9章\background.bmp result\第9章\Thumbs.db result\第9章 result

2010-05-27

51单片机 fat sd卡 读写U盘的源程序+原理图

51+sl811读写U盘的源程序+原理图 spi fat sd卡读写程序 51单片机

2010-03-04

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除