⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dll_simple.cpp

📁 ActiveSkin 4.3 VB zhi zuo piao lang de pi fu !!!!!!
💻 CPP
字号:
// dll_simple.cpp 
// This DLL is an example of accessing SkinImage bits directly, 
// without using GDI functions and SkinImage built-in graphics functions.
// The purpose of this DLL is to create locator-like effect 
// (see Locator demo for details).
// The main idea is to have 2 images -
// foreground (highlighted by locator) static image, 
// and temporary image buffer, containing the pixels from the highlighted image, 
// premultiplied with the alpha.
// At each rendering iteration, a single green front line is painted in the image buffer
// (with DrawRotation subroutine), and dll FadeAlpha function is called
// FadeAlpha function performs these operations:
// 1) Detects the front line and sets the Alpha to 255 (opaque front of sector)
// 2) slowly decreases the alpha channel value
// 3) uses this modified Alpha as a weight to alpha-blend the contents of the temporary image buffer.
// 4) Alpha-blends the temporary image buffer over the background.

#include "stdafx.h"
#include "dll_simple.h"

// Replace this path with the valid location of ActiveSkin ocx file
#import "ACTSKN43.OCX" no_implementation raw_interfaces_only raw_native_types no_namespace

BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    return TRUE;
}

extern "C" long DLL_SIMPLE_API WINAPI FadeAlpha(SkinImageInfo * pInfoBuffer, SkinImageInfo * pInfoHighLight)
{
        // Iterates through all pixels in the bitmaps.
        for (int y = 0; y < pInfoBuffer->Height; y++)
        {
                // typecast lpImage to SkinARGB color values. lpImage type is "long" for VB-users.
                SkinARGB * pSampleBuffer = (SkinARGB*)(pInfoBuffer->lpImage + y * pInfoBuffer->Pitch);
                SkinARGB * pSampleHighlight = (SkinARGB*)(pInfoHighLight->lpImage + y * pInfoHighLight->Pitch);
                for ( int x = 0; x < pInfoBuffer->Width; x++)
                {
                        if (pSampleBuffer->Alpha <= 1)
                                pSampleBuffer->Alpha = pSampleBuffer->Green; // DrawLine GDI function clears the Alpha byte, so it's the front of locator line
                        else
                                pSampleBuffer->Alpha -= 2; // Decreases the rest of Alpha values, clearing the highlight area

                        // Premultiplies the highlighted image with the modified alpha.
                        pSampleBuffer->Blue = ((pSampleHighlight->Blue * pSampleBuffer->Alpha))>> 8;
                        pSampleBuffer->Green = ((pSampleHighlight->Green * pSampleBuffer->Alpha))>> 8;
                        pSampleBuffer->Red = ((pSampleHighlight->Red * pSampleBuffer->Alpha))>> 8;

                        pSampleBuffer++;
                        pSampleHighlight++;
                }
        }
        return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -