• 大小: 75KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-29
  • 语言: 其他
  • 标签: APR  

资源简介

本课程设计的目的是对网络上的ARP数据包进行解析,从而熟悉ARP数据包的结构,对ARP协议有更好的理解和认识。

资源截图

代码片段和文件信息

//------------------------------------------------------------------------------
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//------------------------------------------------------------------------------

#include “stdafx.h“
#include “ImageRenderer.h“

/// 
/// Constructor
/// 

ImageRenderer::ImageRenderer() : 
    m_hWnd(0)
    m_sourceWidth(0)
    m_sourceHeight(0)
    m_sourceStride(0)
    m_pD2DFactory(NULL) 
    m_pRenderTarget(NULL)
    m_pBitmap(0)
{
}

/// 
/// Destructor
/// 

ImageRenderer::~ImageRenderer()
{
    DiscardResources();
    SafeRelease(m_pD2DFactory);
}

/// 
/// Ensure necessary Direct2d resources are created
/// 

/// indicates success or failure
HRESULT ImageRenderer::EnsureResources()
{
    HRESULT hr = S_OK;

    if (NULL == m_pRenderTarget)
    {
        D2D1_SIZE_U size = D2D1::SizeU(m_sourceWidth m_sourceHeight);

        D2D1_RENDER_TARGET_PROPERTIES rtProps = D2D1::RenderTargetProperties();
        rtProps.pixelFormat = D2D1::PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM D2D1_ALPHA_MODE_IGNORE);
        rtProps.usage = D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE;

        // Create a hWnd render target in order to render to the window set in initialize
        hr = m_pD2DFactory->CreateHwndRenderTarget(
            rtProps
            D2D1::HwndRenderTargetProperties(m_hWnd size)
            &m_pRenderTarget
            );

        if ( FAILED(hr) )
        {
            return hr;
        }

        // Create a bitmap that we can copy image data into and then render to the target
        hr = m_pRenderTarget->CreateBitmap(
            size 
            D2D1::BitmapProperties( D2D1::PixelFormat( DXGI_FORMAT_B8G8R8A8_UNORM D2D1_ALPHA_MODE_IGNORE) )
            &m_pBitmap 
            );

        if ( FAILED(hr) )
        {
            SafeRelease(m_pRenderTarget);
            return hr;
        }
    }

    return hr;
}

/// 
/// Dispose of Direct2d resources 
/// 

void ImageRenderer::DiscardResources()
{
    SafeRelease(m_pRenderTarget);
    SafeRelease(m_pBitmap);
}

/// 
/// Set the window to draw to as well as the video format
/// Implied bits per pixel is 32
/// 

/// window to draw to
/// already created D2D factory object
/// width (in pixels) of image data to be drawn
/// height (in pixels) of image data to be drawn
/// length (in bytes) of a single scanline
/// indicates success or failure
HRESULT ImageRenderer::Initialize(HWND hWnd ID2D1Factory* pD2DFactory int sourceWidth int sourceHeight int sourceStride)
{
    

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-11-24 13:10  KinectFusionExplorer-D2D\
     目录           0  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\
     文件      152482  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\CL.read.1.tlog
     文件        2460  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\CL.write.1.tlog
     文件      299690  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\ImageRenderer.obj
     文件      977904  2014-10-19 13:23  KinectFusionExplorer-D2D\Debug\Kinect20.Fusion.dll
     文件      393728  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer-D2D.exe
     文件     1425548  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer-D2D.ilk
     文件          61  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer-D2D.lastbuildstate
     文件        2955  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer-D2D.log
     文件     4664320  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer-D2D.pdb
     文件       15788  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer-D2D.res
     文件      357332  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\KinectFusionExplorer.obj
     文件     1189868  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\KinectFusionhelper.obj
     文件      700052  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\KinectFusionProcessor.obj
     文件      296559  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\KinectFusionProcessorframe.obj
     文件       26773  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\Timer.obj
     文件        3654  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\cl.command.1.tlog
     文件           2  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link-cvtres.read.1.tlog
     文件           2  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link-cvtres.write.1.tlog
     文件           2  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link-rc.read.1.tlog
     文件           2  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link-rc.write.1.tlog
     文件        3252  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link.command.1.tlog
     文件        6858  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link.read.1.tlog
     文件        1190  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\link.write.1.tlog
     文件         616  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\rc.command.1.tlog
     文件        2220  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\rc.read.1.tlog
     文件         246  2018-11-23 13:30  KinectFusionExplorer-D2D\Debug\rc.write.1.tlog
     文件     1616896  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\vc110.idb
     文件     2265088  2018-11-23 13:29  KinectFusionExplorer-D2D\Debug\vc110.pdb
     文件        4780  2014-10-19 12:43  KinectFusionExplorer-D2D\ImageRenderer.cpp
............此处省略50个文件信息

评论

共有 条评论