View Full Version : ImagesDLL alternative project
Lionheart008
20-11-2009, 01:53
http://community.thinbasic.com/index.php?topic=2989.msg22723;topicseen#new
more to come next days. I will build another image dll for thinbasic :)
I still have to adept all to thinbasic yet.
best regards, good night, Frank
ps: "Images.dll" and "ImagesDll_test.exe" example I saved as attachement
Petr Schreiber
20-11-2009, 09:33
Hi Frank,
how do you load the images, do you use gdiPlus or COM?
Is it targeted only at control (like hijacking explorer control to display JPG/PNG) or does your function allow retrieving width, height, number of channels and RGB(A) or BGR(A) raw sequence?
Thanks,
Petr
ErosOlmi
20-11-2009, 15:52
Frank,
yes it would be very useful to know the approach you have followed because if you have just used GDI32 API (and not GDI+ or some control tricks) it would open a lot of new possibilities.
Ciao
Eros
Lionheart008
20-11-2009, 16:14
hi, short, come back from work some minutes before...
send you both per e-mail my stuff.
I have not used GDI32 API, but "win32api.inc" and "commctrl.inc" for pb dll example.
my problem is to parse my images.dll code for thinbasic correctly.
I was yesterday evening first of all looking for an easy image loading example with powerbasic. so I take this one.
the thinbasic script example works in a certain way, but I cannot load the important dialog for image using ;(
if I know where to find more infos about gdi32 api, I will check this one ;)
best regards, frank
ps: I will delete this code examples in some hours because thinbasic script isn't ready and complete yet
ErosOlmi
20-11-2009, 17:18
:D
ok I got it. You are using the ListView trick so in reality you are not managing JPG directly using GDI but you are demanding the hard work to SysListview32
Unfortunately this is something that will not help TBGL to manage image so it is an unpractical way at the moment.
Thanks anyway.
Eros
Petr Schreiber
20-11-2009, 17:20
Hi Frank,
thanks for the code!
The problem could be in fact your TB module function has parameters - I don't think it is allowed, you should get the data in using the thinBasic_ commands exclusively.
Because you first create and SHOW MODAL the dialog, those thinbasic_ commands will never get parsed (actually yes, after destruction of the dialog).
Also you first pass pointer to xWin variable, and then some equate. What is the purpose of xWin?
Lionheart008
20-11-2009, 19:07
hi petr, eros, all.
hmh, it's a pity, I thought my example could help. I am not a powerbasic profi. this try was done by heart. I needed nearly one hour to check all and write down the scripts.
1) you are looking for this kind of "gdi32.dll" code ?
1a) qt: why it's not possible to write an own gdi32 application by c++ ? Or perhaps anywhere some code parts still exists so we can adept it to powerbasic / thinbasic ?
Dim objGraphicsSource As Graphics = PictureBox1.CreateGraphics
Dim bmpSource As New Bitmap(PictureBox1.Width, PictureBox1.Height,
objGraphicsSource)
Dim objGraphicsBmp As Graphics = Graphics.FromImage(bmpSource)
Dim hdcSource As IntPtr = objGraphicsSource.GetHdc
Dim hdcDest As IntPtr = objGraphicsBmp.GetHdc
BitBlt(hdcDest, 0, 0, 50, pbxSource.Height, hdcSource, 0, 0, 13369376)
PictureBox2.Image = bmpSource.Clone()
Declare Auto Function BitBlt Lib "GDI32.DLL" ( _
ByVal hdcDest As IntPtr, _
ByVal nXDest As Integer, _
ByVal nYDest As Integer, _
ByVal nWidth As Integer, _
ByVal nHeight As Integer, _
ByVal hdcSrc As IntPtr, _
ByVal nXSrc As Integer, _
ByVal nYSrc As Integer, _
ByVal dwRop As Int32) As Boolean
it's possible to write an own GDI32.DLL with powerbasic? I am new with these things.
Also you first pass pointer to xWin variable, and then some equate. What is the purpose of xWin?
it was only an experimental helper to start the dialog and has no closer sense for tb code.
=> I am often thinking computer make life more comfortable and easier to handle an daily life. but the other side looks like a box with one thousand doors and little red devils in it they coming out one by one if you are looking for a problem and one more door is open with one hundred more problems and the solution lives in door 999 ;)
best regards, frank (a little bit frustrated that this was not the wished solution ) ;(
ErosOlmi
20-11-2009, 21:49
Hi Frank,
thanks for your help but the point is another.
What we are trying to get is the possibility to have a small module with the capability to load JPG, PNG files in memory and read the bitmap data directly.
This can be done quite easily using GDIPlus but this will come in thinBasic 2.x version (around next year). We want to stay with GDI32 only.
It seems the library I've found can do the job using Microsoft C runtime and this can be accepted because it is installed almost in every Microsoft OS (or so).
Thanks anyway.
Ciao
Eros
Lionheart008
01-12-2009, 02:09
although there is perhaps no more need for it, I have managed to include gdi+ (gdiplus!)features in my "batmanDLL" and so you can load in two different ways images. the pity is I have done only for powerbasic I am sad about this one. but I don't know if this is also possible with current "GDIp" feature. for me it was a very good exercise to include all important graphic features inkl. transparence and make argb color !
' // Create a Bitmap object from a JPEG file.
...
' // Draw the bitmap
hStatus = GdipDrawImageI(pGraphics, pBitmap, 0, 0)
' // Get the width and height of the bitmap
hStatus = GdipGetImageWidth(pBitmap, nWidth)
hStatus = GdipGetImageHeight(pBitmap, nHeight)
' // Make an ARGB color
pixelColor = GdiPlusMakeARGBColor(255, 0, 0, 0)
you can test the powerbasic example, I have added the dll, exe file and photos here.
1) after open the first dialog with gradient colors, open with "xmen" button new "batman" dialog. at the top you will find two new buttons ("photoPix!") and ("myHobby!"). each button open same picture (boat) as *.png and *jpg format.
- with "photoPix!" button you load a jpg picture created a checkered pattern of black pixels in the bitmap. not so bad, isn't it ?
2) you can also draw rectangle in this dialog and make black holes! ;)
test this example, if you like it. I will see if there is any possibility to adept it for thinbasic too. I think so.
good night, frank experimento