• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 819
  • Last Modified:

Help DrawImage in System.Drawing Namespace

In the past when coding using VB6 I frequently use to use BitBlt to transfer images to the visible screen. One function this offered was the ability to "AND" the source image, with the destination image. I cannot find a way to do this in VB.Net. Does anyone know if it is possible using the System.Drawing namespace ? or is there a different way to product this function ? or should I stay with BitBlt (and is API Bitblt still supported in Vista?)


 
0
Blackninja2007
Asked:
Blackninja2007
  • 3
  • 3
2 Solutions
 
Luis PérezSoftware Architect in .NetCommented:
Well... I don't know what type of operation you can do with that "AND" operation... but for sure that BitBlt (that in the past I used often, too) IS supported in Vista, at least in 32bit versions.
0
 
Blackninja2007Author Commented:
What I can do with "AND" is create a grey scale bitmap for something like a SevenSEG Display, then when I blit it in if the desitination is cleared to red first the SevenSEG display appears Red LED, if the destination is cleared to green the SevenSEG display appears Green LED, and with a little bit of maniulation you can also generate a sevenSEG display that looks like LCD or BackLit LCD all from a single bit map.

Is BitBlt still accepted as good/acceptable programming structure then for this kind of function ?



0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
You can still BitBlt in .Net.  Just change your API declarations so that "Long" becomes "Integer"...don't forget to change variables in code as well.

For window handles you can use "IntPtr" instead of "Integer".
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
Blackninja2007Author Commented:
Thanks for you assist, I guess confirmation for me to use bitblt, as .NET does not provide this functionality. Thanks again.
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
If I understand correctly you can do this in .Net...I ~think~ you want something like this:

        Dim bmp As New Bitmap(someWidth, someHeight)
        Dim G As Graphics = Graphics.FromImage(bmp)
        G.Clear(Color.Green) ' fill it with green

        ' ...draw on it somehow...
        ' Manually:
        G.DrawLine(Pens.Black, 0, 0, 100, 100)

        ' Draw another Image on top:
        G.DrawImage(someMemoryImageHere, New Point(0, 0))

        G.Dispose()
        ' ...do something with "bmp"...
0
 
Blackninja2007Author Commented:
Hi Idle I have attached an image showig a sample of what I mean.
Image1.jpg
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Ok...so more of an alpha blend image then?

That is also possible to do in .Net:
http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/Q_21302112.html#13228503
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now