NEED HELP: New to GflAx, 4 simple questions.

Discussions on GFL SDK, the graphic library for reading and writing graphic files

Moderators: helmut, XnTriq, xnview

Post Reply
_GUI_
Posts: 22
Joined: Fri Sep 08, 2006 12:22 am

NEED HELP: New to GflAx, 4 simple questions.

Post by _GUI_ »

Hi all! I am a fond of photography, and I have decided to write a routine to process several photographs (same size and format) in a resulting picture using GflAx library functions. Questions:

1. What's the best distribution of Visual Studio to work with GflAx library? (I don't need a lot of power nor 1000000 available facilities, just compatibility and ease of use. I have seen for instance that VB .NET implies some syntax changes). I work in VB.

2. I intend to read some TIFF (or best CR2 Canon RAW files) at the same time, then be able to read each individual pixel colour in all of them, and generate a new image where each pixel's colour is based on the processing of that same pixel's colour in the list of images to load.
Is this possible? will the code look something like this? I specially worry about the DrawPoint statement, it really plots an individual pixel with the requested true colour value?

Sub TwoImagesAverage()

Dim i, j, pxlX, pxlY As Long
Dim lWidth,lHeight As Long
Dim Colour As OLE_COLOUR

Dim MyObj1 As GflAx.GflAx
Dim MyObj2 As GflAx.GflAx
Dim MyObj3 As GflAx.GflAx

Set MyObj1 = New GflAx.GflAx
Set MyObj2 = New GflAx.GflAx
Set MyObj3 = New GflAx.GflAx

MyObj1.LoadBitmap("C:\pic1.tif")
MyObj2.LoadBitmap("C:\pic2.tif")

lWidth = MyObj1.Width
lHeight = MyObj1.Height
MyObj3.NewBitmap(lWidth, lHeight)

For i = 1 To lWidth
For j = 1 To lHeight
Colour = CLng((MyObj1.GetColorAT(i, j) + MyObj2.GetColorAT(i, j)) / 2)
MyObj3.LineColor = Colour
MyObj3.DrawPoint(i, j)
Next j
Next i

MyObj3.SaveFormat = AX_TIFF
MyObj3.SaveBitmap("C:\pic3.tif")

Set MyObj1 = Nothing
Set MyObj2 = Nothing
Set MyObj3 = Nothing

End Sub

3. I see colours are represented thorough a long integer of the so called OLE_COLOR type. How can I convert it to the three 8 or 16 bit R, G and B components? and how should I do it back, from three R, G and B values to an appropiate OLE_COLOR value. Does exist any function? I have seen in ASP people use something like RGB(10,34,200), does it work on pure VB, not asp scripting?

4. Finally, what code header (dll declaration) must my VB project have to be able to use all GflAx functions?

Thanks a lot and CONGRATULATIONS for this fantastic library. If I manage to program my routine I will come back to share results.

Cheers.
_GUI_
Posts: 22
Joined: Fri Sep 08, 2006 12:22 am

Post by _GUI_ »

OK, I solved all of them by myself :)
Post Reply