-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
Start with the last few posts on previous page and post #562 on this page.
Got it, passed an hour reading your material and reference on MSDN. it raised some question... (see below)
Quote:
Originally Posted by
LaVolpe
If passing the handle worked but passing the picture object did not work, then what I described in my previous reply is the reason. Just FYI.
Forgive me, can you be more specific ? What cause the problem ?
Ok, here from component 2.1.32
Code:
If ipic.KeepOriginalFormat Then
ipic.SaveAsFile ByVal ObjPtr(IStream), False, lResult
If lResult = 0& Then ipic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
Else
ipic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
End If
Of, I'm not sure I understand something...
bSaveMemCopy is Declared as Boolean but never Initialized... (so it was false all the time) So Let replace all code but removing the unused bSaveMemCopy
We got this:
Code:
If ipic.KeepOriginalFormat Then
ipic.SaveAsFile ByVal ObjPtr(IStream), False, lResult
'old: If lResult = 0& Then ipic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult
'If lResult = 0& Then ipic.SaveAsFile ByVal ObjPtr(IStream), False, lResult
Else
'old: ipic.SaveAsFile ByVal ObjPtr(IStream), bSaveMemCopy, lResult 'Wich MEAN FALSE
'bug Fix 2.1.33 (not released yet)
ipic.SaveAsFile ByVal ObjPtr(IStream), True, lResult
End If
That work as Intended, bug fixed.. now my question is about the other part
Code:
If ipic.KeepOriginalFormat Then
ipic.SaveAsFile ByVal ObjPtr(IStream), False, lResult
'If lResult = 0& Then ipic.SaveAsFile ByVal ObjPtr(IStream), False, lResult
Else
IPicture.SaveAsFile:
IPicture.SaveAsFile Link
Return Value:
IPicture.SaveAsFile Return Value Link
E_FAIL = 0x80004005 'Unspecified failure
E_INVALIDARG = 0x80070057 'One or more arguments are not valid
S_OK = 0x00000000 'Operation successful
so, if lResult = 0 mean S_OK, why are we doing the same operation a second time ?
is there any benefit ?
just wondering... I'm confused.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
so, if lResult = 0 mean S_OK, why are we doing the same operation a second time ?
is there any benefit ?
just wondering... I'm confused.
You're confused? So was I as to why it failed on occasion.
lResult is not the return value of ipic.SaveAsFile. It is the number of bytes copied to the stream (3rd parameter of the function). If zero bytes, then failure.
Reason why doing it twice was mentioned in the routine's comment I believe. Inconsistencies. However, I think part of the problem I was having, discovered couple years later, could be the parameter being passed. Is it boolean? Is it long? Is it something else? Per object explorer in VB (F2 key), it is "Boolean". But that may not be trustworthy. For example, ipic.Render states parameters as long, but if you pass long you get type mismatch unless you pass single.
As to why passing FALSE can work when passing a boolean variable doesn't work is likely due to imperfect documentation and/or my misunderstanding of the function.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
It's a typo in the original stdole2.tlb. How it doesn't crash every time boggles the mind.
OCIdl.idl uses BOOL (32bit) while stdole2.tlb uses VARIANT_BOOL (16bit)
Have you tried invoking SaveAsFile using DispCallFunc() instead?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
lResult is not the return value of ipic.SaveAsFile. It is the number of bytes copied to the stream (3rd parameter of the function). If zero bytes, then failure.
Oups!! How could have I been so distracted! lool...
Quote:
Originally Posted by
LaVolpe
...could be the parameter being passed. Is it boolean? Is it long? Is it something else?
as per "non official" version 2.1.33 of mine, I have changed the parameter for LONG and I also have put something like:
if (lresult=0) then
msgbox "nope, wasn't that..."
end if
so if it glitch in any of my program in like next 6 month, I'll know, otherwise, I'll consider the matter fixed for good.
Thanks for fixing this. I love this component.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
DEXWERX
It's a typo in the original stdole2.tlb. How it doesn't crash every time boggles the mind.
OCIdl.idl uses BOOL (32bit) while stdole2.tlb uses VARIANT_BOOL (16bit)
Have you tried invoking SaveAsFile using DispCallFunc() instead?
DispCallFunc()?? didn't know... but the fix work now, so...
Got a couple of question though...
1. where can we get documentation about OCIdl.idl and stdole2.tlb for the matter at hand ??
2. I saw you did a vb6.tlb, what does it does and would it be possible to create a vb6.tlb to fix and replace stdole2.tlb ?
thanks
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
DispCallFunc()?? didn't know... but the fix work now, so...
Got a couple of question though...
1. where can we get documentation about OCIdl.idl and stdole2.tlb for the matter at hand ??
I always read the source, as MSDN documentation can be lacking and is often wrong.
stdole2.tlb can be decompiled to IDL using the OLE-Com Object viewer (which comes with Visual Studio)
OCIdl.idl comes with any of the Windows or Driver Development kits (or visual studio / visual c++)
Quote:
Originally Posted by
VbNetMatrix
2. I saw you did a vb6.tlb, what does it does and would it be possible to create a vb6.tlb to fix and replace stdole2.tlb ?
thanks
VB6.tlb's main use is to allow easier use of pointers, by aliasing some of the built in runtime functions.
like getting the safearray reference of an array, and read/write access to memory via pointer,
as well as r/w access to the pointers of VB's reference types (string/array/object).
It's also declares often used functions like CopyMemory.
It's possible to correctly VB-Ize the IPicture definition from OCIdl.idl and include it in a typelib like my VB6.lib
That's actually a great idea. I need to finish adding in Control Array interfaces anyway, might as well add a fixed IPicture.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi i completed my game project but have2 problem with AIC
https://cdn.pbrd.co/images/GMdp41f.png
movie of result : here
1-i have a one sprite sheet png file and one alpha image control,my images is like this :
https://cdn.pbrd.co/images/GLOMFf3.png
i want when mouse entered on normal state then "fade in" to over state and show over state image and stop and then when mouse down pressed on over state then fade in to down state and then start animation frame 1 to 100 play with custom duration speed for example (500 miliseconds)
matter is for me to make fade in simulation
i dont want make frames for simulate fade in
how can do that ?
and my question 2 : how can mirror face from left to right or from top to down without reverse frame? i hv a sprite sheet for walking but when i used mirror method AIC mirrored and frames reversed but i want just face mirror and dont want frame reveres too.
in my project i designer each left view animation of characher like as sperate because i cant use mirror or AIC(alpha image control).
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
any body here can answer to my 2 questions in #607
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi i wantt use AIC user control in another user control
i set backstyle of myusercontrol to transparent and then i used aic user control in my user control.
when i puted my user control on a test form background of my user control was been transparent but AIC was been white backcolor !!!
i have this problem with ImgEx or stdPicEx.
how can fix it? (i want use my user control with transaparent AIC or ImgEx or stdPicEx in same time on a form)
Attachment 154321
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I'll try to get back with you this weekend. My system just updated with latest Win10 update & things are not working right. Took me quite awhile to get VB up and running again (reinstalled it), but it's still not quite right. Only decision I have now is to try to figure out to fix what still needs fixing or rollback the Win10 update. Until then...
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
i am waiting so. and i am waiting for imgex or stdex class updgare to apng support too.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
From your screenshot, I'd expect the bkg color to be gray not white. In any case, if you make your UC transaprent, then also set its Windowless property to true. Then transparency should be shown throughout. If that is not an acceptable solution, you can try compiling the AIC to a separate OCX and see if the issue continues. Or try different combinations of your usercontrol. Changing any combination in the AIC will fail to produce the desired effect.
Bottom line, the AIC gets its hDC, that it draw on, from VB. If VB gives it a solid fill background, that's what is drawn on.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
i tested with windowless but now how can move my custorm usercontrol on form with mouse?
and can u answer to my old question?
how can mirror face from left to right or from top to down without reverse frame? i hv a sprite sheet for walking but when i used mirror method AIC mirrored and frames reversed but i want just face mirror and dont want frame reveres too.
in my project i designer each left view animation of characher like as sperate because i cant use mirror or AIC(alpha image control).
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Don't understand what you are describing, regarding mirroring and sprites?
Here are two related links that discusses placing windowless transparent UCs in another transparent UC. It is not going to make you happy.
http://www.vbforums.com/showthread.p...Transparent-UC
http://www.vbforums.com/showthread.p...ntrol-Question
The behavior you are seeing can be replicated with VB's Image Control too.
1. Create a new UC, set these properties: BackStyle=transparent, ClipBehavior=none, Windowless=true
2. Add a VB image control and place a transparent GIF on the UC. This is kinda like my AIC
3. Now, create another UC and place the first UC in it. Without setting this UC's BackStyle=transparent & Windowless=true, the GIF background is no longer transparent.
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Attachment 154423
i write my problem on picture.
my porblem is with mirror animation.
i want mirror animation to horizontal or vertical and when mirrored,animation play from first frame to last frame(when i used aic mirror animation play from last to first frame).
i want just turn back my animation face to left or right or top to bottom without reverse frames too.
and if u can help me in this thread
any way to use nine patch picures(png) in vb6? can i use aic for nine patch too?how?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
How are you animating? Are you using the GDIpImage.SegmentImage method to tile the image? More details would be helpful
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
i am use segment images, i sent picture used in #615 but i attachment here too.make a animation with this attachment for test and then check with horizontal mirror too.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Now I can better understand and found a logic flaw too
1. Open the class GDIpImage and find this routine SegmentImage
2. Change this line: newSEQ(0, lCount) = Val(sSeq(lCount)) - 1&
to this: newSEQ(0, lCount) = Val(sSeq(lCount - 1)) - 1&
3. Provide the new sequence manually... example:
Code:
With AlphaImgCtl1
.Animate2.PauseAnimation
.Mirror = lvicMirrorHorizontal
.Picture.SegmentImage 5, 2, , , "5,4,3,2,1,10,9,8,7,6"
.Animate2.ResumeAnimation
End With
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
i changed class GDIpImage and routine SegmentImage to :
Code:
newSEQ(0, lCount) = Val(sSeq(lCount - 1)) - 1&
and then i writed manual code :
Code:
With AlphaImgCtl1
.Animate2.PauseAnimation
.Mirror = lvicMirrorHorizontal
.Picture.SegmentImage 5, 2, , , "5,4,3,2,1,10,9,8,7,6"
.Animate2.ResumeAnimation
End With
and worked but if i hv been more than 10 sprites images and each image have been random frames for example more than 100 frames so i should be write code manual for each animation .
how can fix this problem to work always without this part :
Code:
With AlphaImgCtl1
.Animate2.PauseAnimation
.Mirror = lvicMirrorHorizontal
.Picture.SegmentImage 5, 2, , , "5,4,3,2,1,10,9,8,7,6"
.Animate2.ResumeAnimation
End With
my means is i want just set mirror to horizontal mirror in property page.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
You have to mirror the cells in the image, so don't mirror the complete image.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Arnoutdv
You have to mirror the cells in the image, so don't mirror the complete image.
Another option. The SegmentImage function also can accept a byte arrray (if the class comments are read). Now, it's only a matter of sizing an array for 100 items and creating a short loop to populate the array. This, in my opinion, is minimal effort.
@BlackStorm. Suggest the method just described. I won't be modifying the class for this purpose. One of the beauties of this project is that is open source and nearly anything that one may want to add or alter can be done outside of the control. I really concentrated on trying to expose every possible thing to the coder via control/class properties and methods. The goal was not to have to make custom tweaks to the UC, simply call its methods/properties to change the control's behavior.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
i simulated this model :
Code:
'example :
'when columns is 5 and rows is 2
'5 4 3 2 1 10 9 8 7 6
'example :
'when columns is 4 and rows is 3
'4 3 2 1 8 7 6 5 12 11 10 9
'example :
'when columns is 4 and rows is 2
'4 3 2 1 8 7 6 5
'example :
'when columns is 3 and rows is 4
' 3 2 1 6 5 4 9 8 7 12 11 10
and then i changed this part from SegmentImage rutin :
orginal code :
Code:
else
For lCount = 1& To TileCount
newSEQ(0, lCount) = lCount - 1&
newSEQ(1, lCount) = FrameDuration
Next
to :
Code:
Dim MySeq() As String, MyTempSeq() As String: ReDim MyTempSeq(TileCount)
Dim MyMasterSeq As String
Dim s As Long, cnt As Long, cnt2 As Long
Dim Lngi As Long, Lngi2 As Long
cnt = 0: cnt2 = 0: s = Columns
For Lngi = 1 To Rows
s = Lngi * Columns
cnt = s
For Lngi2 = s To (s - (Columns - 1)) Step -1
cnt2 = cnt2 + 1
MyTempSeq(cnt2) = cnt
cnt = cnt - 1
Next
Next
MyMasterSeq = Join(MyTempSeq, ",")
MyMasterSeq = Replace(MyMasterSeq, ",", "", 1, 1, vbBinaryCompare)
MySeq() = Split(CStr(MyMasterSeq), ",")
For lCount = 1& To TileCount
newSEQ(0, lCount) = Val(MySeq(lCount - 1)) - 1&
' newSEQ(0, lCount) = Val(sSeq(lCount)) - 1& ' ensure values in range of 1-TileCount
If Err Then ' internally, range is 0 to TileCount-1
Err.Clear
newSEQ(0, lCount) = 0&
ElseIf newSEQ(0, lCount) > TileCount - 1& Then
newSEQ(0, lCount) = TileCount - 1&
ElseIf newSEQ(0, lCount) < 0& Then
newSEQ(0, lCount) = 0&
End If
newSEQ(1, lCount) = FrameDuration
Next
and now i can set mirror with property page without any codes needed.is that correct?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
If it works for you, then it's correct. But one of my long-standing principles apply... you break it, you fix it; no more help from me. In other words, once someone modifies my code for their purposes, I don't offer advice on how to fix it if it fails.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
If it works for you, then it's correct. But one of my long-standing principles apply... you break it, you fix it; no more help from me. In other words, once someone modifies my code for their purposes, I don't offer advice on how to fix it if it fails.
work for me but i want ask from you because i dont know other method means used in that class or any classes maybe used inthis class too.i want know any idea for any problem to maybe happen in feature.what problem maybe happen?
and apng not added to imgex or stdex yet?when time will be start?(i am waiting to apng support too)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Black_Storm
work for me but i want ask from you because i dont know other method means used in that class or any classes
Yes, already mentioned it. Build your array outside the AIC, i.e., in your form, and pass the array. Don't customize a generic routine to no longer be generic.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
My system just updated with latest Win10 update & things are not working right. Took me quite awhile to get VB up and running again (reinstalled it), but it's still not quite right.
Hi Lavolpe, hope you fixed your problem with last version of Win10. As for myself, I gave up on "Win10 & Vb6"
I installed Oracle VM and on my Win10 machine, I ran a VirtualBox of Win7 in full screen. work like a charm :)
if that can help:
https://www.virtualbox.org/wiki/Downloads
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
... If anyone downloads that zip and doesn't have your DLL, then this thread will get posts with questions about that project.
Ok, good enough point for me, to remove the stuff I've posted from this thread - moving suggestion (and example) over into the Main-VB6-Forum:
http://www.vbforums.com/showthread.p...ing-direction)
Olaf
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi,i have this png sprite picture and used in aic :
Attachment 154545
i changed AIC to segment type and then i want extract one of splited picture in to a image box with keep transparent? can i do that?
or can extract and then use imgex for show in image box? (image box is matter for me).
i dont want save as png on hard drive i need just use my image index selected from aic control (segmented images) and show direct to imagebox with transparency.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
VB's image control won't do transparency except for GIF, WMF, icons less than 32 bit.
You can extract the tile to another AIC using the SavePictureGDIp function with the optional SaveStruct parameter.
1. Set the image index to the tile you want
2. In the SaveStruct, set the ExtractCurrentFrameOnly member to true
3. Save the tile as a stand-alone image, probably as PNG if sending to ImageEx
Also, the AIC can display any tile in a segmented image simply by changing the .Picture.ImageIndex property
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hi Keith, I have just started to use your control.
I am showing Album Art to the user in a 200 x 200 AIC. If the file does not contain a picture in the metadata, I am downloading just 10 images and placing them in 10 36 x 36 AIC's for the user to choose.
I have already discovered by playing that the AIC's picture property always contains the original picture size and quality, no matter how small I have scaled it. This, I think, is great.
My question is do I really need 10 mini AIC's or is there some way I can display the 10 images in 1 AIC and the user select which one they want?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
You can do that a couple of ways, here is maybe the easiest?
Use a picturebox sized 360x36, borderless if desired
As you load each image, you can paint it to the appropriate tile in the picture box. Simple math will tell you which tile the user clicked on. Use the Render method of the Picture property.
If that isn't good enough, you can actually create one 360x36 AIC but requires more effort. That process is basically the same principle and that can be done at least two ways. But I won't go into the details if the easier option suits your needs.
Edited: Since one of the options requires drawing into an AIC, I whipped up an example because I don't think I've provided one of those yet...
This is probably the next easiest method that allows you to keep the "combined" image in an AIC. Note in this example, I'm creating a horizontal strip of images. Obviously just a sample, and you'd need to adjust for any scaling you may want and/or creating a grid vs strip.
Code:
Private Declare Function GdipGetImageGraphicsContext Lib "GdiPlus.dll" (ByVal pImage As Long, ByRef graphics As Long) As Long
Private Declare Function GdipDeleteGraphics Lib "GdiPlus.dll" (ByVal mGraphics As Long) As Long
' don't need to initialize GDI+ for your form since the AIC already using it
Private Sub Command1_Click()
Dim tImg As GDIpImage, SS As SAVESTRUCT
Dim x As Long, y As Long, cx As Long, cy As Long
Dim hGraphics As Long
cx = AlphaImgCtl1.Picture.Width
cy = AlphaImgCtl1.Picture.Height
Set tImg = New GDIpImage ' create a new image 10x original width & same height
SS.Height = cy
SS.Width = cx * 10
SS.ColorDepth = lvicConvert_TrueColor32bpp_ARGB
' special purpose call to create a new image from nothing (documented)
SavePictureGDIplus Nothing, tImg, lvicSaveAsPNG, SS
' get GDI+ hDC-like pointer from the newly created image
GdipGetImageGraphicsContext tImg.Handle, hGraphics
' render each 'tile' to the strip
For x = 0 To tImg.Width - 1 Step cx
AlphaImgCtl1.Picture.Render 0&, x, y, cx, cy, , , , , , , hGraphics
Next
GdipDeleteGraphics hGraphics ' release that pointer
Set AlphaImgCtl2.Picture = tImg ' assign to a new/existing control & size the control
With AlphaImgCtl2
.Move .Left, .Top, Me.ScaleX(cx * 10, vbPixels, Me.ScaleMode), Me.ScaleY(cy, vbPixels, Me.ScaleMode)
End With
End Sub
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
Edited: Since one of the options requires drawing into an AIC, I whipped up an example because I don't think I've provided one of those yet...
Thanks for this code... was waiting for it long time ;)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
VbNetMatrix
Thanks for this code... was waiting for it long time ;)
Sorry if I didn't reply to a request -- may have just missed it. Hope the example helps.
Note: there are restrictions (bit depths & image format types) regarding usage of GdipGetImageGraphicsContext. Bottom line: suggest bitmap, png and 16bpp or better.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
Sorry if I didn't reply to a request -- may have just missed it. Hope the example helps.
Note: there are restrictions (bit depths & image format types) regarding usage of GdipGetImageGraphicsContext. Bottom line: suggest bitmap, png and 16bpp or better.
Thanks Keith, very much appreciated...
as a side note, I work ONLY with BMP and PNG
(for image quality purpose)
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi,i hv two problem now.
1- i created new user control and then i used aic control in it too.i want create new property or new method for use some of functions or others to use it.
for exampe i created this sub :
Code:
private sub loadimage()
' i want use LoadPictureGDIplus from aic control
LoadPictureGDIplus (...)
end sub
my porblem is about functions called from aic control in my user control.
when i want write function name.vb can know it but when i type ( for example "LoadPictureGDIplus(" vb dont know this function with parameters.
and when i use LoadPictureGDIplus with parameters and when i want use my user control vb show error to me about LoadPictureGDIplus unknow function or ... .
how can fix it?
-
2 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi,my problem in #636 not fixed yet and i am waiting to answers.
and i hv 2 problem now,can help me for fix it?
1- i writed my problem in my picture :
Attachment 154749
my problem is about when i want use aic control compiled(ocx of it) on vb.net form.
when i add and set image i can not see image in box on form.how can fix it?
2-i designed my user control and used aic control in it too.i set properties like picture and i compiled and worked in vb6 good but when i wanted test my ocx(my user control compiled) in vb.net i can see just background of aic control without any image(my user control is transparent but aic control is just opaque and dont show images too),how can fix it?
Attachment 154751
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
I can't answer your questions regarding vb.net
There is a lot of documentation on requiring VB user controls to be modified for .net. I think Microsoft event created some conversion/migration functions, but not sure. You may want to browse the .NET portion of the forums for answers regarding VB6 user controls. Key search terms: VB6 usercontrol migration
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
I can't answer your questions regarding vb.net
There is a lot of documentation on requiring VB user controls to be modified for .net. I think Microsoft event created some conversion/migration functions, but not sure. You may want to browse the .NET portion of the forums for answers regarding VB6 user controls. Key search terms: VB6 usercontrol migration
1-#636 not answered yet ( its about vb6) ( i can not call loadgdipplus or other functions when i used aic user control in my user control)
2-i created a user control in vb6 and properties seted to transparent backstyle and tested in vb.net and worked good so my problem is not about user control my question is about aic user control because when i want use aic user control in vb.net backcolor is opaque so problem is about aic.
3-i hv a question about how use UserDocument class , i want get percent ( 0 to 100 progress) of download and show percent in form too,i readed about UserDocument class and events in it like AsyncReadProgress(AsyncProp As AsyncProperty) and AsyncProp.BytesMax,AsyncProp.BytesRead.can u send a sample code for download more than 1 pictures as async and with percent downloading(0 to 100)?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
You should really start a new thread for your problems.
The problems you have are not bugs in the control, but have to do with how you want to use the control.
And if you are not satisfied with the control you should ask for a refund.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Black_Storm
1-#636 not answered yet ( its about vb6) ( i can not call loadgdipplus or other functions when i used aic user control in my user control)
Can you show me how you are using the control in your project? Specifically, the project tree view. Group project? Is the AIC compiled to an ocx? More details needed.
Quote:
Originally Posted by
Black_Storm
2-i created a user control in vb6 and properties seted to transparent backstyle and tested in vb.net and worked good so my problem is not about user control my question is about aic user control because when i want use aic user control in vb.net backcolor is opaque so problem is about aic.
Already mentioned, I can't answer your .Net questions. The control was designed for VB6 not .Net and .Net can have issues with VB6 developed controls.
Quote:
Originally Posted by
Black_Storm
3-i hv a question about how use UserDocument class , i want get percent ( 0 to 100 progress) of download and show percent in form too,i readed about UserDocument class and events in it like AsyncReadProgress(AsyncProp As AsyncProperty) and AsyncProp.BytesMax,AsyncProp.BytesRead.can u send a sample code for download more than 1 pictures as async and with percent downloading(0 to 100)?
This should be posted in the VB forums as it appears to have nothing to do with this control.
Quote:
Originally Posted by
Arnoutdv
And if you are not satisfied with the control you should ask for a refund.
And being the Xmas holiday week - refunds are extended for another year ;)
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Hopefully just a quickie. I realised this morning that the sizes for my Coverart were always returned correctly by Alpha, but the colour depth isn't.
I am attaching a Cover which I believe is 24BPP but alpha reports 32. Mp3Tag and Irfanview show the same sizes but only 24BPP.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
How is the cover art being extracted? Your attachment is JPG (forums probably converted it).
Is the cover art being resized before being added to the AIC? Reason I ask is that resizing can introduce 32bpp alphadepending on the interpolation method. GDI+ can blur the edges when higher interpolation modes are used. This alphablending may not be noticeable by the human eye (typically 1 pixel edges), but exists nonetheless. In addition, using the clipboard to set an image can report the image as 32bpp because the DIB placed on the clipboard may be 32bpp when the O/S screen depth is 32bpp.
Edited: Clipboard scenario was incorrect/misleading. The 32bpp scenario applies to screen captures and DIB placed on clipboard.
Otherwise, probably going to need the source file zipped up so I can take a look see, if it's important enough. If the source is MP3 or WMA, the parsing routines will attempt to use the cover art, as-is, if only 1 image exists. If multiple images exist, a conversion from the original format to TIFF is performed, per image, and all images in the source become a multi-page TIFF. But IIRC, there is no conversion to other bit depths during the process of adding the image to a TIFF page (exception may be color-lossless depth reduction to 24/8/4/1 from higher depth, if possible)
Edited: Why multi-page tiff? The AIC has no way of returning multiple images in any format other than ICO/CUR/GIF/APNG/TIFF. GIF is restricted by depth (8bpp or less), APNG not a widely accepted format, and ICO/CUR not really appropriate in this case. Since the parsing routines weren't designed to return an array of images, TIFF seemed an acceptable solution since each tiff page can be a different color depth and size from any other page. In addition, the AIC has methods to navigate/select individual pages
-
1 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Thanks for looking at this Keith. I don't use the AIC for extraction as my programme can load and play any format.
The AIC is on Form2 'the Edit form' and I have set the AIC to scale the images to its size. I use the TagsLibrary dll from 3delite over at Un4seen.com. It sends the data out as a stream so I do the following;
Code:
If CoverArt.Data <> 0 Then 'See is there is any data in memory
Form2.A1.Picture = LoadPictureGDIplus(PFM.MemToHBitmap(ByVal CoverArt.Data, ByVal CoverArt.DataSize.LowPart - 1)) 'Get an hBitmap handle from the memory and pass it to AIC. jpg's only.
End If
I can use the same handle (converted to stdpicture) to load an image control. Both the Image and the AIC report the same sizes. But the image handle sent to GetObject returns 24bit AIC returns 32. Also mp3Tag, dbPoweramp and Irfanview report 24.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
First. That image is JPG. When loaded into VB image/picturebox, the JPG is converted to bitmap. Therefore, what is being passed from the .Picture.Handle property is a 24bpp bitmap handle. If you were to load that JPG file into the AIC or pass the VB image/picturebox .Picture.Handle value, you should get 24bpp also.
This JPG you posted must have been converted from bitmap at some point?
Your MemToHBitmap() returns a bitmap handle not a JPG. When a handle is passed to AIC, it is processed by modCommon.pvProcessGDIhandleSource. That routine uses API GetObject to return info about the handle. Included in that info is the bit depth. If the depth is being reported as 32bpp, then that explains it. Now, if bit depth returned in that info < 32, then the routine calls GdipCreateBitmapFromHBITMAP API to create a GDI+ image from that handle. I doubt that API creates a 32bpp image from the handle if the handle was to a 24bpp image.
As a more definitive test, suggest this and let me know what it returns.
Code:
hBmp = PFM.MemToHBitmap(ByVal CoverArt.Data, ByVal CoverArt.DataSize.LowPart - 1)
GetObject hBmp, Len(udtBmp), udtBmp: Debug.Print udtBmp.bmBitsPixel
DeleteObject hBmp
Edited: If GetObject info indicates 32bpp, here is what I'm thinking... MemToHBitmap creates a DIB based on the O/S screen depth, then converts the cover art image to bitmap and passes that DIB handle. Since your screen depth is likely 32bpp, a 32bpp handle.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Ok the returned value is 32. Here is the code for the converter, it is part of a Class from Emil Weiss. It doesn't look like it uses the clipboard but I am sure you will pinpoint the problem.
Just so I understand, if I load the same jpg into an image control using LoadPicture it still says 24. is that for the reasons stated above? I can post the entire class if you want.
Code:
Public Function MemToHBitmap(ByVal DataPtr As Long, ByVal Size As Long) As Long
Dim bArray() As Byte
Dim stream As IUnknown
Dim Img As Long
Dim hBitmap As Long
' Array Redimensionieren
ReDim bArray(Size - 1)
CopyMemory bArray(0), ByVal DataPtr, ByVal Size
' Stream erstellen
CreateStreamOnHGlobal bArray(0), False, stream
' ist ein Stream vorhanden
If Not (stream Is Nothing) Then
' GDI+ Bitmapobjekt vom Stream erstellen
If Execute(GdipLoadImageFromStream(stream, Img)) = OK Then
' Handle des Bitmapobjektes ermitteln
If Execute(GdipCreateHBITMAPFromBitmap(Img, hBitmap, 0)) = OK Then
' hBitmap zurück geben
MemToHBitmap = hBitmap
End If
' Bitmapobjekt löschen
Execute GdipDisposeImage(Img)
End If
End If
End Function
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Took a little bit to troubleshoot. The answer: GdipCreateHBITMAPFromBitmap creates a 32bpp bitmap from at least 24bpp images. Not tested whether this also applies to 16 bits or less.
Bottom line: AIC is reporting correctly. The bitmap depth associated with the handle from your routine is 32bpp. If you were to pass the MP3/WMA file name to the AIC, you'd likely return the 24bpp bitmap/jpg you are expecting.
Note to self: Should I ever rebuild this project, that's another thing I'll have to keep in mind. I also use that API in some cases and wasn't aware it appears to use the screen color depth when creating a bitmap. Never fully tested that API to understand various what-if scenarios.
Oops, didn't answer your other question
Quote:
Just so I understand, if I load the same jpg into an image control using LoadPicture it still says 24. is that for the reasons stated above?
Kinda apples and oranges. JPG and BMP are different animals. That function you posted does not produce JPGs, it produces a bitmap. Your JPG is coming from some other routine. Regarding JPGs, VB converts JPG internally to BMP in order to display it in the image/picturebox controls. All JPGs should report 24bpp or less; therefore, VB's .Picture.Handle will be a 24bpp (or less) bitmap. The problem, if you want to call it that, is your routine's GdipCreateHBITMAPFromBitmap defaulting to screen depth in this case.
In fact, if you use a function like "HandleToStdPicture" and pass the hBmp returned from your function to create a stdPicture object for VB's use, then GetObject will return 32bpp when passed .Picture.Handle. BTW: HandleToPicture or HandleToStdPicture can be found on this site for converting a hBmp handle to a VB stdPicture object. It is also available in the AIC: modCommon.HandleToStdPicture
Code:
' copy HandleToStdPicture and related APIs to your form, then...
hBmp = PFM.MemToHBitmap(ByVal CoverArt.Data, ByVal CoverArt.DataSize.LowPart - 1)
Set Me.Picture = HandleToStdPicture(hBmp, vbPicTypeBitmap)
GetObject Me.Picture.Handle, Len(udtBmp), udtBmp: Debug.Print udtBmp.bmBitsPixel
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Thank you very much. There was me thinking it might be a 'quickie'!
Happy New Year to you & yours.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
Can you show me how you are using the control in your project? Specifically, the project tree view. Group project? Is the AIC compiled to an ocx? More details needed.
Already mentioned, I can't answer your .Net questions. The control was designed for VB6 not .Net and .Net can have issues with VB6 developed controls.
This should be posted in the VB forums as it appears to have nothing to do with this control.
And being the Xmas holiday week - refunds are extended for another year ;)
1-i maked a copy of aic orginal source and then opened.then added another user control under aic user control and then used aic control in my user control.then i create a new property for example loadpic name by vb6 activex interface wizard and then when i called loadgdiplus or other functions so vb know that function but dont know parameter so show error to me about unknow function called.
about question 3 : my means about use aic control because i seen UserDocument class in aic control and events definiition of it and i seen AsyncReadProgress(AsyncProp As AsyncProperty) and AsyncProp.BytesMax,AsyncProp.BytesRead. too in aic control. i want use aic control and get percent of download image between 0 to 100 %and show on form too.i think if i can use AsyncProp.BytesMax and AsyncProp.BytesRead used in UserDocument class of aic control so i can make percent but my problem about how use of this class?can you send a simple sample to how use aic control and use UserDocument class to can get percent of download?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Ah, now I understand the problem for #1. Those functions are part of a class. The class is "Global" for projects that include the AIC, not for the AIC itself. If you'll look at code in the AIC, you will notice no code calls those functions, rather they call the functions in the bas module. Since the bas module cannot be made public to projects that include the AIC but a class can, the class wraps some of the bas module functions. If you want the intellisense, you'll need to create an instance of the class and then call the functions in that class, then release the class.
Regarding #3. There are many examples on this site and one exists in this codebank for using a usercontrol to download from the internet with a percent-like status. Here is one: http://www.vbforums.com/showthread.p...tra-dependency
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
i want use aic for download images but i want can see percent download too and show on form percent.how can do that?how can use of "UserDocument class" dinnifition in aic in my project too? can i use of their events ? can u send a simple sample ?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
You can use another usercontrol (or other methods) to download whatever you want. With those other methods, create your percentage display as needed, and when the complete file has been downloaded, then send the data to the AIC to display the image. You are asking questions that are not relative to this control and I am not not going to help you modify/rewrite my control for your purposes. If you have questions about UserDocuments, post those in the questions portion of the forum. Good luck.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
any body here can help me about show png image on form or desktop with blur effect under it ?
my thread : how can show my png image on form with display blur effect under it-need user control
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Black_Storm
can i use aic control for display image with blur effect under it ? if possible so how?
i want test on form and use for dekstop (layred windows ) too
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
@Black_Storm, please start your own threads for questions
You are polluting this CodeBank submission with questions about your own project.
-
2 Attachment(s)
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
hi i hv new question when i want use aic control,
1-i want just a png image and when resize to horizontal or vertical then repeat image like repeater(i want use png or apng image and use resize action too.(like attached picture)
how can do that?
i want like number 2 after resize
Attachment 155491
2-i am using aic control, now i want make mask clipping how can do that like this picture?
or any other idea?
http://imageupper.com/s12/1/8/R15165228811714830_1.gif
3- i am doing use aic control but now i want put my pnd or apng image on other controls like text box frame or .... ? (see this picture)
if not possible so any idea?
Attachment 155495
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
1. Repeating, tiling. In the previous page (post 631), I gave an example of creating a blank GDIpImage and drawing into it. You can use something like that to create an image on the fly. You could also look at the TilePictureGDIplus global function, but that draws to a DC, does not create a new image.
2. Mask clipping. Never looked into it. Your animation looks neat. I'd imagine this would not be something really simple. One may need to define pixels in 3D space and apply 3D rendering algorithms? That's just a guess and good luck -- should be challenging.
3. You have asked this question several times in the other part of the forums. I'm not going to use this thread to discuss topics not related to this control. I've said that before and from this point forward, will simply ignore such questions in the future. Sounds like you are using my control inside another one you created and/or extracting my controls code for your own purposes. That's not a problem, but I'm not going to spend time making that work for you, or anyone else. No insult intended.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
LaVolpe
1. Repeating, tiling. In the previous page (post 631), I gave an example of creating a blank GDIpImage and drawing into it. You can use something like that to create an image on the fly. You could also look at the TilePictureGDIplus global function, but that draws to a DC, does not create a new image.
2. Mask clipping. Never looked into it. Your animation looks neat. I'd imagine this would not be something really simple. One may need to define pixels in 3D space and apply 3D rendering algorithms? That's just a guess and good luck -- should be challenging.
3. You have asked this question several times in the other part of the forums. I'm not going to use this thread to discuss topics not related to this control. I've said that before and from this point forward, will simply ignore such questions in the future. Sounds like you are using my control inside another one you created and/or extracting my controls code for your own purposes. That's not a problem, but I'm not going to spend time making that work for you, or anyone else. No insult intended.
i writed tag in question about png or apng,how work with animated png too ? i seen post 636 but was been about single image static. can u send a sample code to can repeat apng too(my means i want duplicate one animation to example 10 count in result was been in a single image box)
2- i dont work with 3d space but i want just can use mask clipping for can show something under my image or front on my image by hidding some curves,no way ? or simple mask cliping sample code ?
3-because i am waiting for find solution for this problem yet.
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Quote:
Originally Posted by
Black_Storm
i writed tag in question about png or apng,how work with animated png too ? i seen post 636 but was been about single image static. can u send a sample code to can repeat apng too(my means i want duplicate one animation to example 10 count in result was been in a single image box)
2- i dont work with 3d space but i want just can use mask clipping for can show something under my image or front on my image by hidding some curves,no way ? or simple mask cliping sample code ?
3-because i am waiting for find solution for this problem yet.
can u send a sample code for repeat apng too ?
-
Re: [vb6]Alpha Image Control v2 - Final Update (15 Jan 2012)
Can some moderator/admin please move those posts to a new thread?
This thread is not for supporting the usage of the control.