OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Alex

Conversation Between Alex and Pav
Showing Visitor Messages 1 to 1 of 1
  1. Pav
    18-01-2009 16:47
    Hi Alex,
    I need to draw about 100000 bezier's in a form including 3D rotation. I've tried to do this with yours Extension Library but it works too slow. I've done a DLL in C++ which rotating the points and draw everything as one using GDI PolyDraw function, data struture is done in VBA ones and after that the pointer and rotation values are passed to DLL. The speed is very good vhen I'm testing this just to draw in new created window in C++ but when I'm trying to save this as BMP file to put back in VBA form, the save operation works very slow. I can see that your library doing this very well. I've start lerning c++ two months ago just to sort this one drawing DLL. I've tried to do this using 'CreateFile' and 'fopen' but both of them works slow. I'm a beginner in c++ and this could be maybe some silly thing with a flag or something. Could you please tell what is wrong in this code and how to do this faster? I will be very appreciative.

    BOOL SaveBitmap(HDC hDC,HBITMAP hBitmap)
    FILE * fp= NULL;
    fp = fopen("l:/Sample.bmp","wb");
    if(fp == NULL)
    return false;
    BITMAP Bm;
    ZeroMemory(&BitInfo, sizeof(BITMAPINFO));
    BitInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
    BitInfo.bmiHeader.biBitCount = 0;
    if(!GetDIBits(hDC, hBitmap, 0, 0, NULL, &BitInfo, DIB_RGB_COLORS))
    return (false);
    Bm.bmHeight = BitInfo.bmiHeader.biHeight;
    Bm.bmWidth = BitInfo.bmiHeader.biWidth;
    BmHdr.bfType = 0x4d42; // 'BM' WINDOWS_BITMAP_SIGNATURE
    BmHdr.bfSize = (((3 * Bm.bmWidth + 3) & ~3) * Bm.bmHeight) + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
    BmHdr.bfReserved1 = BmHdr.bfReserved2 = 0;
    BmHdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
    BitInfo.bmiHeader.biCompression = 0;
    fwrite(&BmHdr,sizeof(BITMAPFILEHEADER),1,fp); // Writing Bitmap File Header ////
    BYTE *pData = new BYTE [BitInfo.bmiHeader.biSizeImage];
    if(!GetDIBits(hDC, hBitmap, 0, Bm.bmHeight, pData, &BitInfo, DIB_RGB_COLORS))
    return (false);
    if(pData != NULL)
    delete (pData);
    return (true);

    int _tmain(int argc, _TCHAR* argv[])
    HDC pulpit = GetDC(NULL);
    HDC kontPam = CreateCompatibleDC(pulpit);
    HBITMAP hBitmap = CreateCompatibleBitmap(pulpit, 160, 132);
    HBITMAP hbmpStara = (HBITMAP) SelectObject(kontPam, hBitmap);
    DeleteObject (hBitmap);

    HBRUSH FillBrush = CreateSolidBrush(0xf0f0f0);
    RECT FillArea = {0, 0, 120, 90};
    FillRect(kontPam, &FillArea, FillBrush);

    SaveBitmap(kontPam, hBitmap);
    return 0;


All times are GMT -5. The time now is 07:23.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com