BitBlt好像也不行吧?
我需要一个像素一个像素的绘图.而且每个像素的值是三张图片进行Alpha通道处理后得到的.
我计算出该点的RGB后就pset.但如果用bitblt,那么我用什么作为源设备呢?

解决方案 »

  1.   

    不好意思,我的機器不能回你的短信:
        按你上邊的操作 用bitblt 是行不同的,因為bitblt是從內存中讀出圖形信息,然後復制到目標的
        那我想想,我回家查查api 的書看有沒有,明天給你答復
      

  2.   

    SetPixel
    The SetPixel function sets the pixel at the specified coordinates to the specified color. COLORREF SetPixel(
      HDC hdc,           // handle to DC
      int X,             // x-coordinate of pixel
      int Y,             // y-coordinate of pixel
      COLORREF crColor   // pixel color
    );
    Parameters
    hdc 
    [in] Handle to the device context. 

    [in] Specifies the x-coordinate, in logical units, of the point to be set. 

    [in] Specifies the y-coordinate, in logical units, of the point to be set. 
    crColor 
    [in] Specifies the color to be used to paint the point. To create a COLORREF color value, use the RGB macro. 
    Return Values
    If the function succeeds, the return value is the RGB value that the function sets the pixel to. This value may differ from the color specified by crColor; that occurs when an exact match for the specified color cannot be found.
      

  3.   

    crColor是怎么算出来的呀?
    为什么crColor>32767时就会报错呀?
    难道SetPixel只支持16位色?
    有没有办法可以支持24位呀?
      

  4.   

    你是怎么算的?crColor是一个32位整形,对应VB6中的Long
    SetPixelV VB声明 
    Declare Function SetPixelV Lib "gdi32" Alias "SetPixelV" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal crColor As Long) As Long 
    说明 
    在指定的设备场景中设置一个像素的RGB值 
    返回值 
    Long,非零表示成功,零表示失败。会设置GetLastError 
    参数表 
    参数 类型及说明 
    hdc Long,一个设备场景的句柄 
    x,y Long,要设置的点,用逻辑坐标表示 
    crColor Long,指定像素的新RGB颜色值 
    注解 
    这个函数比SetPixel快一些,但不会返回设置的实际颜色。可用GetDeviceCaps判断设备是否支持这个函数
     
    SetPixelV hDC, x, y, RGB(R, G, B)
      

  5.   

    SetPixelV也很低效应该直接对位图所在内存进行操作
    这比SetPixelV快100倍以上
    我写的快速的图像处理程序:http://www.csdn.net/expert/topic/879/879364.xml?temp=.2010004
      

  6.   

    是呀,setpixel 要返回其先前的象述值,而 setpixelv 不返回,所以setpixlev 要快的多了