Page 3 of 6 FirstFirst 123456 LastLast
Results 81 to 120 of 201

Thread: Direct2D Typelib+ for VB6

  1. #81
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Direct2D Typelib+ for VB6

    Hi Baka,

    I haven't started messing with Direct2D. But, as I'm sure you know, I managed to get a fairly substantial Direct3D project going, using The Trick's typelib.

    One of the early problems I ran into was my FPS being faster than my monitor's refresh rate. By default, Direct3D refreshes the screen at the monitor's refresh rate as the fastest it'll go.

    However, with some digging, I found the PresentationInterval item of the D3DPRESENT_PARAMETERS structure (UDT), which is used to initialize a IDirect3DDevice9 device. By default, it's PresentationInterval is set to D3DPRESENT_INTERVAL_DEFAULT, which won't go faster than the monitor's refresh rate. However, if you explicitly set PresentationInterval to D3DPRESENT_INTERVAL_IMMEDIATE, the Direct3D refresh rate becomes completely detached from the monitor's refresh rate, allowing you to render frames as fast as your CPU/GPU will do it for you. You must do this as you're instantiating your IDirect3DDevice9 device.

    That solved a huge problem for me, and allowed me to make perfect sense of my FPS.

    I don't know for certain, but I have to believe there's a similar setting in the Direct2D system.

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  2. #82

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    in D2D we got .presentOptions in the D2D1_HWND_RENDER_TARGET_PROPERTIES, where we can choose:
    NONE, IMMEDIATELY and RETAIN_CONTENTS.
    right now Im using "NONE", that seems to follow the monitor refresh rate (that is 60 for me)
    with IMMEDIATELY it will not pause at all, and that most be the same as D3DPRESENT_INTERVAL_IMMEDIATE for D3D.

    im not done with the conversion of the game, theres a lot more to do, but if i need more fps i will definitely use IMMEDIATELY and create the fps of my choosing.
    but using NONE, i think theres no need to calculate fps each second, instead i use the API i mentioned before and make the calculation one time before start (the speed factor)

    as i dont know the refresh-rate, and the only way to get it is by running 1 time and that could give me 59-61 instead of 60, i think GetDeviceCaps is quite useful.

  3. #83

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    another issue.
    i just started the project in another computer, now the aspect ratio is wrong. the same project using GDI i dont get this behavior.

    it seems that the DrawBitmap is not following pixel but DPI, and will render it incorrectly. the dimension of the target picturebox is not considered.

    so, if I set 800x600 the picturebox, DrawBitmap will render like 1000x750 (or something), going outside the boundaries.

    looking at the code, if I enter cTarget.Resize and use 1000x750 the aspect it almost correct, but the picturebox is only 800x600
    how can I let direct2d use the picturebox dimension?

  4. #84

  5. #85

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    ha. i was about to edit/post something but you where faster.
    i wanted to ask about this:

    Code:
    cTarget.GetDpi X, Y
    oSize.Width = 8 * X
    oSize.Height = 6 * Y
    cTarget.Resize oSize
    where the original size is 800x600 and X/Y will return 120/120 (in this monitor) and it seemed to work, but a faster fix as you posted is to simply:

    Code:
    cTarget.SetDpi 96, 96
    thanks!
    Last edited by baka; Jun 4th, 2018 at 12:34 PM.

  6. #86

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    another thing i would like to ask/discuss is the cleanup procedure.
    while coding and "testing" i get too often crashes.
    right now i use "set x = nothing" to cleanup for the images and everything else.
    even so sometimes when i "try again" to run, after some changes, the IDE crashes.
    i need to save everytime i run. its good practice anyway but its quite annoying that it crashes.

    so, if I run, and close, run and close, no crashes.
    but if I run, and close, add something, and run it crashes (but not always)

  7. #87
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    Re: Direct2D Typelib+ for VB6

    Was just reading through this thread for the first time, just wanted to note types can be cross-tlb compatible in almost all cases, it's almost always acceptable to simply change the UDT argument to a long and pass VarPtr(udt).

    I feel bad now for not finishing WIC last year; that's a lot of work and there's a half converted unincluded source file sitting in all the oleexp zips forever now.

  8. #88

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    would be nice to be able to remove oleexp.tbl and only use wicvb.tbl and d2dvb.tbl.
    right now oleexp.tbl is needed to run, where i move it down in the priority list and its conflicting against my custom tbl.
    if i try to copy the part needed from the oleexp.tbl to my custom tbl it doesn't work.

  9. #89
    PowerPoster
    Join Date
    Jul 2010
    Location
    NYC
    Posts
    5,651

    Re: Direct2D Typelib+ for VB6

    baka, you can get around conflicts by explicitly declaring types. Put oleexp at the bottom of the priority list, then whenever you're using something from it that's also in your custom tlb, define the module specifically; e.g. Dim var As oleexp.IWhatever -- and not just interfaces, types, enums, etc too.

  10. #90

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    thx fafalone, i knew about that i could write the typelib's name to specify which one to use, but i think that a better typelib for the wic package should be complete without the need to use the oleexp.

    another thing.
    we have D2D1_INTERPOLATION_MODE to specify the algorithm used to scale the image.
    we have:
    D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR
    D2D1_BITMAP_INTERPOLATION_MODE_LINEAR
    and its supported from 7, Vista SP2, so unfortunately no xp support.
    reading in the docs, I notice that we have more algorithms
    D2D1_INTERPOLATION_MODE_CUBIC
    D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR
    D2D1_INTERPOLATION_MODE_ANISOTROPIC
    D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC
    but are only supported from windows 8 and Platform Update for Windows 7 [desktop apps | UWP apps]
    not sure what this Platform Update is, but its nothing I have.

    maybe an update would be nice, even if Im still on windows 7 I will eventually move to 10 and to have 4 more

    another thing about this. changing the interpolation modes doesn't seem to do much. it seems to be identical.
    Last edited by baka; Sep 16th, 2018 at 03:06 PM.

  11. #91

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    so I read that
    D2D1_BITMAP_INTERPOLATION_MODE
    has 2 modes while
    D2D1_INTERPOLATION_MODE
    has 6 modes

    the latter is Direct2D 1.1 and should be available in windows 7 from a patch, but no vista/xp support.
    the second mode require ID2D1DeviceContext and its DrawBitmap and DrawImage while the one available uses ID2D1RenderTarget : DrawBitmap
    any way to add the other method?

  12. #92

  13. #93

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    fair enough, maybe its better to be compatible for now!

    a question:
    I have trouble to make the interpolation work. I know from the demo you created that it should work but not for me:

    I add inside a class:
    Dim InterPolationMode As D2D1_BITMAP_INTERPOLATION_MODE

    Sub Quality(ByVal Interpolation As D2D1_BITMAP_INTERPOLATION_MODE)
    InterPolationMode = Interpolation
    End Sub

    Code:
    the rendering loop is:
    cTarget.BeginDraw
    cTarget.Clear ClsRGB
    ----------------
    - any amount of:
    cTarget.DrawBitmap ui(index), dRect, 1, InterPolationMode, sRect
    ----------------
    cTarget.EndDraw ByVal 0&, ByVal 0&
    everything works, but no matter what Interpolation Im using its always D2D1_BITMAP_INTERPOLATION_MODE_LINEAR it seems.
    in the class_initialize It doesnt matter what I choose with in InterPolationMode, its always the same anyway.

    maybe its the dRect/sRect as Im cutting parts of the graphics into a specific position.
    they are both D2D1_RECT_F
    also, I have a "default" pixelsize in HwndRenderTargetProperties set to 800x600 (thats the default size I use)
    when I maximize the form, Im not changing anything in dRect/sRect, I let direct2d upscale. I also set cTarget.SetDpi 96, 96 so it will always use the same dpi.
    Last edited by baka; Sep 22nd, 2018 at 09:33 AM.

  14. #94

  15. #95

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    Interpolation.zip

    heres the project.
    the rendering will show:
    cut and paste, using D2D1_RECT_F
    direct rendering using SetTransform to skip D2D1_RECT_F (byval 0&)
    and SetTransform using a bit of rotation and no D2D1_RECT_F
    only when rotation is involved the interpolation works.

  16. #96

  17. #97

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    hm. in my testing I get this:
    Name:  Image2.png
Views: 1074
Size:  24.3 KB

    if I resize the window I get this (Linear up and Nearest down)
    Name:  Image3.jpg
Views: 1010
Size:  37.0 KB

    so I dont get the same as you!
    as you can see in the picture, only the "rotated" pictures show different, the other 4 pictures are identical-

    original pictures: (seems that the insert image is converting the pics)
    https://i.postimg.cc/13fJnqsh/Image2.png
    https://i.postimg.cc/Kj1Rrxzz/Image3.png

  18. #98

  19. #99

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    hm, im trying to figure out where to put CreateCompatibleRenderTarget.
    but no matter what im doing i get errors or nothing happens. the resize works, but it will not stretch the image.

    lets say the small project that i shared. what do I do to have a fixed screen (500x300) and let i stretch using interpolation with the CreateCompatibleRenderTarget.?

  20. #100
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,672

    Re: Direct2D Typelib+ for VB6

    Code:
    Option Explicit
    
    Dim mcFactory       As ID2D1Factory
    Dim mcHwndTarget    As ID2D1HwndRenderTarget
    Dim mcMemTarget     As ID2D1BitmapRenderTarget
    
    Private Sub Form_Load()
        Dim cBrush  As ID2D1SolidColorBrush
        
        Me.ScaleMode = vbPixels
        
        Set mcFactory = D2D1.CreateFactory()
        
        Set mcHwndTarget = mcFactory.CreateHwndRenderTarget(D2D1.RenderTargetProperties(D2D1.PixelFormat()), _
                                                            D2D1.HwndRenderTargetProperties( _
                                                            Me.hWnd, D2D1.SizeU(100, 100)))
        Set mcMemTarget = mcHwndTarget.CreateCompatibleRenderTarget(ByVal 0&, ByVal 0&, ByVal 0&, D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_NONE)
        
        Set cBrush = mcMemTarget.CreateSolidColorBrush(D2D1.ColorF(BurlyWood), ByVal 0&)
        
        ' // Paint to mem target
        mcMemTarget.BeginDraw
        
        mcMemTarget.DrawEllipse D2D1.Ellipse(D2D1.Point2F(30, 30), 15, 15), cBrush, 3
        mcMemTarget.DrawLine 0, 0, 80, 90, cBrush
        
        mcMemTarget.EndDraw ByVal 0&, ByVal 0&
        
    End Sub
    
    Private Sub Form_Paint()
        
        ' // Draw to hwnd
        mcHwndTarget.BeginDraw
        
        mcHwndTarget.DrawBitmap mcMemTarget.GetBitmap, D2D1.RectF(0, 0, Me.ScaleWidth, Me.ScaleHeight), _
                                , D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, ByVal 0&
        
        mcHwndTarget.EndDraw ByVal 0&, ByVal 0&
        
    End Sub
    
    Private Sub Form_Resize()
        mcHwndTarget.Resize D2D1.SizeU(Me.ScaleWidth, Me.ScaleHeight)
    End Sub

  21. #101

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    its working! thanks a lot! i didnt think that i could use a memory-bitmap, its like i do with gdi, i thought that i could do it without. i think its quite odd that they created an automatic stretch feature but didnt include interpolation.

    im doing it a bit different, without paint-event as im using a loop, but its working nevertheless.
    i just replace all DrawBitmap with the memory-bitmap and at the very end, im adding:
    Code:
    Sub RenderDC()
        cTarget.EndDraw ByVal 0&, ByVal 0&
        hTarget.BeginDraw
        hTarget.DrawBitmap cTarget.GetBitmap, oRect, 1, InterPolationMode, ByVal 0&
        hTarget.EndDraw ByVal 0&, ByVal 0&
    End Sub
    where cTarget is the memory-bitmap.
    oRect contains the width and height of the picturebox (im using that to render, as the form itself, when maximized will retain the aspect ratio)

  22. #102

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    problem with:
    Run-time Error '-2003238900 (8899000c)'
    Automation Error

    and it happens here: hTarget.EndDraw ByVal 0&, ByVal 0&
    it occurs when I use "ctrl+alt+del" in windows 7 to bring up the "login menu"
    im inside a "loop" to render animations in monitor-refresh rate.
    it happens both IDE and compiled.

    if I try with "On Error Resume Next" it will not work.
    I also tried the GetForegroundWindow to only render when the form is active, but don't work.

    any ideas?

  23. #103
    PowerPoster
    Join Date
    Feb 2015
    Posts
    2,672

    Re: Direct2D Typelib+ for VB6

    https://docs.microsoft.com/en-us/win...2d-error-codes
    D2DERR_RECREATE_TARGET
    0x8899000C
    A presentation error has occurred that may be recoverable. The caller needs to re-create the render target then attempt to render the frame again.
    https://docs.microsoft.com/en-us/win...-with-direct2d
    While your program is running, the graphics device that you are using might become unavailable. For example, the device can be lost if the display resolution changes, or if the user removes the display adapter. If the device is lost, the render target also becomes invalid, along with any device-dependent resources that were associated with the device. Direct2D signals a lost device by returning the error code D2DERR_RECREATE_TARGET from the EndDraw method. If you receive this error code, you must re-create the render target and all device-dependent resources.

    To discard a resource, simply release the interface for that resource.

  24. #104

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    ok, thanks for that info, i will try to create a function that will reset everything if that happens!

  25. #105

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    i added 1 more loop,
    do while state = 0
    do while state = 0
    - game & rendering -
    loop
    cleanup/unload
    if state=1, I do another loop waiting for GetForegroundWindow=Form.Hwnd. when, it will restart direct2d and load all resources. and set state to 0
    loop
    terminate

    in the render function Im adding a "On Error Resume Next", and CheckWindowState, if "1" D2D1_WINDOW_STATE_OCCLUDED, I know something is wrong. state is the variable I store this.
    when I exit normally, with the "x" close button, i add state=2 and it will exit both loops.

  26. #106
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    Hi, i am begginer, i not know this libraries, Direct2d, Direct3D, is open-source?
    someone know or can make a GraphicsLibary Pure VB6 like Aforge?
    the base of library with cornersDetectors, EdgeDEtectors, Thereshould, some scientifc algorithms, and next, add more features?
    the algorithms of geometry in VB6 is more easy found in web, but the base of library not.
    cheers!

  27. #107
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    duplicated

  28. #108
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Direct2D Typelib+ for VB6

    Hi xman2000,

    I took a look at the AForge library, and it looks like it would take quite a bit of work to build an interface for it for a VB6 program. However, you might be better off if you just ask for the specific functions/algorithms you want. I know that you said, "cornersDetectors, EdgeDEtectors, Thereshould, some scientifc algorithms", but maybe you could be more specific ... especially if you're trying to get some VB6 program written and need something specific. These forums are quite rich with many graphics and scientific algorithm solutions.

    Also, when asking for these things, you may do better to start your own thread (or even start your own thread when discussing AForge).

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  29. #109

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    for more info about direct2d just google and check microsoft's direct2d page.
    The trick created this "typelib", that need to be included in the "references" to work.
    The trick created samples to try so there should be enough to get started.
    theres a lot of functions to use for geometry and other things, but like any other library theres limitations so you need to create your own functions/formulas, but direct2d is enough to do any kind of graphic work and its fast, u can control dpi and it can do all the upscaling automatically. theres typelibs for directx9 as well if u want to work with 3d u can find them in this forum.
    its not open source, but the typelibs are "free" and do not require dependencies except os requirements for that directx version and should be already installed.

  30. #110
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by Elroy View Post
    Hi xman2000,

    I took a look at the AForge library, and it looks like it would take quite a bit of work to build an interface for it for a VB6 program. However, you might be better off if you just ask for the specific functions/algorithms you want. I know that you said, "cornersDetectors, EdgeDEtectors, Thereshould, some scientifc algorithms", but maybe you could be more specific ... especially if you're trying to get some VB6 program written and need something specific. These forums are quite rich with many graphics and scientific algorithm solutions.

    Also, when asking for these things, you may do better to start your own thread (or even start your own thread when discussing AForge).

    Good Luck,
    Elroy
    Hi Elroy, I'm trying to motivate people to create a ImageComputerVision in PureVB6, and know about if someone done it.
    Aforge.net is C# and a good start to make a VB6 library, but my intention is PureVB6 and not a wrapper, wrapper have in web like this:

    Professional Image Modifier 2 Dave A. Gordon
    https://code.msdn.microsoft.com/vstu...hId=1920673660

    "https://code.msdn.microsoft.com/vstudio/Professional-Image-280a2421/sourcecode?fileId=107118&pathId=1920673660"

    this example with Aforge.net use SUSAN Corners Detector and VB.NET and some examples have source-code others the compiled dll.

    Elroy you can convert Algoritms of other Languague like C#, C++ , Python, Java, Jscript or Matlab to VB6?
    i found many open-source image libraries on the web, greate alogrithms or samples, but not can convert to vb6.
    I think if you can make the basis of Libary with 2 or 4 algorithms in a free to commercial use open-source, other people can add more features.

    i am like corners detectors: SUSAN, FAST, AGAST
    edge detection: SUSAN, CANNY, SOBEL
    contour DualContour (DC) : DualContouring
    image: KNN nearest neighbor, kmeans, image segmentation, image clustering
    thereshould: otsu thereshould, diferentialThereshould, others
    i can put the list here antoher moment, the ACCORD.NET have more algorithms that AForge.net (Accord is other version of Aforge)
    if you look the source-code of ACCORD.NET you understand, but i can speak the name of most important algorithms not found in VB6 on the web.
    thanks.

  31. #111
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Direct2D Typelib+ for VB6

    Hmmm, I must be in a cantankerous mood this morning.

    But, as I see it, a hijack by any other name is still a hijack.

    And I just don't understand why you don't start your own thread. I suspect many of us have been quite motivated by trying to address clear questions in the starting post of a new thread.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  32. #112
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by Elroy View Post
    Hmmm, I must be in a cantankerous mood this morning.

    But, as I see it, a hijack by any other name is still a hijack.

    And I just don't understand why you don't start your own thread. I suspect many of us have been quite motivated by trying to address clear questions in the starting post of a new thread.
    Hi Elroy, i am not have too many knowlegde and conditions now to manage the project, but if you start a thread and start the project i am follow you or other people.
    I am not able to create the basis of a Library and not to convert of other programming languages entire algorithms, but i know many others things about image procesing an the most important algorithms, i have the vision about this.
    i am not found powerfull ImageLibrary in pure VB6 open-source like have in other languagues like C# Aforge.net.
    i think the key is create the small structured hierarchy with few algorithms and in the future add more.
    cheers!

  33. #113

  34. #114
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    Hi The Trick, i have many source-code i am collecting and yours code too.
    but some algorithms i am not found in VB6 and not able to convert to VB6, i am try but gives error like illegal words (online translator).

    i am begginer programmer, not professional, but i know many things about programming and image procesing.
    If one people make the Basis Struture with Hierarchy and few algorithms, then, other people will translate algorithms and add to library. Aforge.net the people translate to many other language programming.
    i to my personal purpose need more CornersDetectors, DualContouring and Thereshould algorithms, but, to use to more professional cases, need a more complete library.
    i am not understand the reason community of VB6 and VB.net not make a VisionLibrary like other communities.
    the big problema of VB6 is not open-source and outdated.
    then, is a greate think make the librarys open-source to make the language possible to update with new features and not outdated.
    The trick, thanks for your contibution, se i can, i will start the project next year, but if someone want, please start the thread, leader the project.
    thanks.

    edit: The trick, please a compiled exe version of this sample above?
    Last edited by xman2000; Dec 12th, 2018 at 02:50 PM.

  35. #115
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by xman2000 View Post
    Hi Elroy, I'm trying to motivate people to create a ImageComputerVision in PureVB6, and know about if someone done it.
    Aforge.net is C# and a good start to make a VB6 library, but my intention is PureVB6 and not a wrapper, wrapper have in web like this:

    Professional Image Modifier 2 Dave A. Gordon
    https://code.msdn.microsoft.com/vstu...hId=1920673660

    "https://code.msdn.microsoft.com/vstudio/Professional-Image-280a2421/sourcecode?fileId=107118&pathId=1920673660"

    this example with Aforge.net use SUSAN Corners Detector and VB.NET and some examples have source-code others the compiled dll.

    Elroy you can convert Algoritms of other Languague like C#, C++ , Python, Java, Jscript or Matlab to VB6?
    i found many open-source image libraries on the web, greate alogrithms or samples, but not can convert to vb6.
    I think if you can make the basis of Libary with 2 or 4 algorithms in a free to commercial use open-source, other people can add more features.

    i am like corners detectors: SUSAN, FAST, AGAST
    edge detection: SUSAN, CANNY, SOBEL
    contour DualContour (DC) : DualContouring
    image: KNN nearest neighbor, kmeans, image segmentation, image clustering
    thereshould: otsu thereshould, diferentialThereshould, others
    i can put the list here antoher moment, the ACCORD.NET have more algorithms that AForge.net (Accord is other version of Aforge)
    if you look the source-code of ACCORD.NET you understand, but i can speak the name of most important algorithms not found in VB6 on the web.
    thanks.
    You can take a look at my PhotoModularFX in signature. It is written in Vb6.
    Eventually I will make some effect public.
    Or I could help in translating algorithms from other languages to Vb6

  36. #116
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by reexre View Post
    You can take a look at my PhotoModularFX in signature. It is written in Vb6.
    Eventually I will make some effect public.
    Or I could help in translating algorithms from other languages to Vb6

    reexre, YES, yes !! i know your work, your software!!
    yes, please, i can send to your some algorithms, links, etc, and your translate when you have time.
    please star you the new thread if you can and like, yes, greate good news my friend!!


    edi: user reexre, you can download the sample file of Dave A Gordon Professional Image Modifier (vb.net) using AForge.net to study how make similar sample file using only pure VB6 and not AForge?
    i think this sample file have few files and only source-code and not DLLS.
    please answer to me.
    Last edited by xman2000; Dec 12th, 2018 at 03:20 PM.

  37. #117
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: Direct2D Typelib+ for VB6

    Honestly I was not going to open a new thread.
    Anyway, I saw that Elroy already did it here
    Hope to find even other people interested in this too.

  38. #118
    Lively Member
    Join Date
    Jun 2016
    Posts
    106

    Re: Direct2D Typelib+ for VB6

    Quote Originally Posted by reexre View Post
    Honestly I was not going to open a new thread.
    Anyway, I saw that Elroy already did it here
    Hope to find even other people interested in this too.
    reexre, good new, mens at work ! thanks !

  39. #119

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    im trying to figure out how to get the context of a hdc/hwnd and send it to a direct2d bitmap.
    using WIC, CreateBitmapFromHBITMAP but that require hBitmap and hPalette so its not really what i need.
    so they idea is: copy picture1.hdc to ID2D1Bitmap and render it to a direct2d RenderTarget.
    also, it would be nice to be able to take a screenshot of any hwnd/hdc and send it to a ID2D1Bitmap.
    still the examples i can find googling are based in c++.
    any idea?

  40. #120

    Thread Starter
    The Idiot
    Join Date
    Dec 2014
    Posts
    2,721

    Re: Direct2D Typelib+ for VB6

    ok i figure it out.
    so, first we create a compatiblebitmap using: getdc, createcompatibledc,createCompatibleBitmap and use selectobject (u can find tons of examples for that)
    what we need is: thisone = CreateCompatibleBitmap(hDC, width, height)

    now we use BitBlt to take the screenshot and we store it into the created compatibledc. thats it for the gdi part.

    now we use CreateBitmapFromHBITMAP to create a wicbitmap:
    Code:
    Set wicBitmap = cWICFactory.CreateBitmapFromHBITMAP(thisone, ByVal 0&, WICBitmapUsePremultipliedAlpha)
    Set cConverter = cWICFactory.CreateFormatConverter()
    cConverter.Initialize wicBitmap, WICPixelFormat32bppPBGRA, WICBitmapDitherTypeNone, Nothing, 0, WICBitmapPaletteTypeMedianCut
    and lastly we create a ID2D1Bitmap using:
    Code:
    Set hBitmap = hTarget.CreateBitmapFromWicBitmap(ByVal cConverter, ByVal 0&)
    of course to render it we use BeginDraw,DrawBitmap and EndDraw

Page 3 of 6 FirstFirst 123456 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width