Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, August 4, 2005 10:34:05 PM(UTC)

RVW  
RVW

Groups: Registered
Posts: 5


I have an app that updates the screen using double buffering, so I'm
drawing to a Lead bitmap that's the size of the visible workspace and
then using Win32 BitBlt to transfer to the screen. That works fine, but
some drawing needs to refer to the previously created pixels (transparency), and I'm finding
it's a bit slow to extract rectangular sections of a Lead bitmap with
GetRow(), especially when they get large, like 5000 x 5000 or so. So, I
tried using the TYPE_USER flag and managing the bitmap buffer memory
myself so I can have access to the bits and write my own routines to
access the Lead bits. It just didn't work - CreateLeadDC() returns NULL and
that's where I got stuck. Is there anything to be aware of regarding user-allocated bitmap memory and CreateLeadDC()? Thanks.

Dave
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Tuesday, August 9, 2005 6:32:30 AM(UTC)

Bashar  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

There is nothing special you need to do when calling CreateLeadDC(). 
Which version of LEADTOOLS are you using?  Can you post a sample test project that shows this problem so that we can test it?

Thanks,
Bashar Abdulqaiyume
LEAD Tachnologies, Inc.
 
#3 Posted : Thursday, August 11, 2005 8:44:54 PM(UTC)

RVW  
RVW

Groups: Registered
Posts: 5


OK, I created a basic MFC app with the VS.NET 2003 wizard. I'm using LeadTools Raster Pro v14.

Here's the relevant portion of a test program I wrote, part of OnDraw():
-------------------------------
    HDC hDC = pDC->m_hDC;
   
    LBitmap bm;
    int w = 500;
    int h = 500;
    int nTotalBits = w * h * 4;
    DWORD* pBits = new DWORD[w * h];
   
    int err = bm.Create(w, h, 32, ORDER_RGB, NULL, BOTTOM_LEFT, TYPE_USER, (L_UCHAR*)pBits, nTotalBits);
   
    HDC hMemDC = bm.CreateLeadDC();

    int leaderr = LBase::GetErrorFromList();

--------------------

CreateLeadDC() always returns NULL, just as in my real app. err
returns 1. leaderr returns 1.  I've loaded the core DLLs in InitInstance():

LBase::LoadLibraries(LT_KRN | LT_DIS | LT_IMG);


I tried Initialize()/Allocate() as well. It does let me Paint my
modified pixels to the screen, but hMemDC is still NULL and GDI
commands are not available. I very much want to be able to use GDI routines and access the pixels directly.

LBase::GetErrorString() returns Operation Successful.

I'm on XP SP2. Is there any connection to the video card? It's an ATI Radeon 9250.

What's going on?

Thanks for your help.

Dave


 
#4 Posted : Monday, August 15, 2005 8:51:01 AM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

Dave,
You can avoid creating a LEAD DC for the TYPE_USER image and find another way to solve your original problem.

To efficiently extract rectangular sections of a Lead bitmap, create a
secondary image (whether regular or TYPE_USER) with the desired rectangle dimensions and copy the data to it using the Combine function.

Amin Dodin

LEADTOOLS Technical Support
Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#5 Posted : Monday, August 15, 2005 12:11:35 PM(UTC)

RVW  
RVW

Groups: Registered
Posts: 5


Thanks, but this doesn't really solve my problem. I want to draw into a
bitmap using HDC functions like PolyPolygon() but also have direct
access to the bits for my own custom code. Why doesn't CreateLeadDC()
work with TYPE_USER? There's nothing in the documentation to indicate
it wouldn't' work. If there's a technical reason, tell me what it is,
so at least I understand the details. I need to minimize memory usage
with large bitmaps (6000x6000 and larger), and having direct access to
the same bits that Windows draws into is a perfect solution for me.
Also, I'm already copying large rectangles to and from the main Lead
bitmap surface and sometimes it takes nearly as long as doing my custom
operations like gradients and transparencies, thus the need to read and
write the bits directly and perform the custom operations directly on
the Lead bits, which is really my own memory. I've tried using DIB
Sections with no success,
and using TYPE_USER is better anyway since I'm ultimately writing an
image file using Lead. I just need maximum speed via minimizing bitblts and minimized memory usage. Thanks.

Dave

 
#6 Posted : Thursday, August 18, 2005 1:17:52 PM(UTC)

RVW  
RVW

Groups: Registered
Posts: 5


Please, I need a follow up to my latest reply. This issue is very important and greatly affects the performance of our application.

Dave

 
#7 Posted : Wednesday, August 24, 2005 2:04:04 PM(UTC)

Amin  
Amin

Groups: Manager, Tech Support
Posts: 367

Was thanked: 1 time(s) in 1 post(s)

I suspected this but wasn't sure about it. I checked with our
engineering department and got the reply that CreateLeadDC will NOT work with TYPE_USER bitmaps. It will also not work with tiled bitmaps.

Did you try the Combine option? It will most likely be much faster than copying data row-by-row.

Amin Dodin
LEADTOOLS Technical Support

Amin Dodin

Senior Support Engineer
LEAD Technologies, Inc.
LEAD Logo
 
#8 Posted : Wednesday, August 24, 2005 4:43:20 PM(UTC)

RVW  
RVW

Groups: Registered
Posts: 5


Actually, I got Windows DIB Sections to work, so that will do the job.

Dave

 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.095 seconds.