-
Nov 25th, 2024, 12:19 PM
#1
RC6 BUG Report: Image JPGs loaded from RC collection upside down
Raising this here as it concerns RC6 and I'd like Olaf to see it. I don't think it is a RC6 bug but Olaf might be able to throw some additional light on it.
The bug report is here: https://github.com/twinbasic/twinbasic/issues/1939
I am using Olaf's Richclient image collection, loading a JPG from disc:
Code:
Cairo.ImageList.AddImage "config-icon-dark", App.Path & "\Resources\images\config-icon-dark-1010.jpg"
Later, I set an imageBox to that image in the collection.
Code:
Set imgConfig.Picture = Cairo.ImageList("config-icon-dark").Picture
Later still I resize that icon image to a desired size.
Code:
Public Sub resizeControls(ByRef thisForm As Form, ByRef m_ControlPositions() As ControlPositionType, ByVal m_FormWid As Double, ByVal m_FormHgt As Double, ByVal formFontSize As Long)
Dim I As Integer: I = 0
Dim Ctrl As Control
Dim x_scale As Single: x_scale = 0
Dim y_scale As Single: y_scale = 0
On Error GoTo ResizeControls_Error
' Get the form's current scale factors.
x_scale = thisForm.ScaleWidth / m_FormWid
y_scale = thisForm.ScaleHeight / m_FormHgt
' Position the controls.
I = 1
For Each Ctrl In thisForm.Controls
With m_ControlPositions(I)
If (TypeOf Ctrl Is Image) Then
Ctrl.Stretch = True
Ctrl.Left = x_scale * .Left
Ctrl.Top = y_scale * .Top
Ctrl.Width = x_scale * .Width
Ctrl.Height = Ctrl.Width ' always square in our case
Ctrl.Visible = True
End If
End If
End With
I = I + 1
Next Ctrl
On Error GoTo 0
Exit Sub
ResizeControls_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ResizeControls of Form formSoftwareList"
End Sub
Somewhere during that process, the image is flipped and the icon appears upside down.

See the top bar and note that all the images loaded from an RC collection are flipped.
IF I replace :
Code:
Set imgConfig.Picture = Cairo.ImageList("config-icon-dark").Picture
with:
Code:
Set imgConfig.Picture = LoadPicture(App.Path & "\Resources\images\config-icon-dark-1010.jpg")
- to load directly from a file on disc the image is loaded correctly and appears the right way up.
It seems that when TwinBasic is loading the byte stream from an RC collection it incorrectly determines the orientation of the image, perhaps it is loading it back to front?
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Nov 26th, 2024, 06:49 AM
#2
Re: RC6 BUG Report: Image JPGs loaded from RC collection upside down
 Originally Posted by yereverluvinuncleber
It seems that when TwinBasic is loading the byte stream from an RC collection it incorrectly determines the orientation of the image, perhaps it is loading it back to front? 
TwinBasic does not load a "bytestream from an RC-collection" (this collection stores cCairoSurface-instances) -
it receives a (Std)Picture-Object instead (from the right side of the assignment)...
And those StdPicture-Objects the RC6 hands out via cCairoSurface.Picture-Property,
make no problems at all when set to "(Std)Picture-consumers" in a VB6-hosted Form (with VB6-Controls).
The error is probably in, how the imgConfig-Control (the left-hand-side of the assignment) -
handles the incoming StdPicture-Object in its "Set-Picture-Property"-implementation...
Not sure about your original JPGs - do you have an original JPG-image somewhere accessible in an Upload?
Olaf
-
Nov 26th, 2024, 08:41 AM
#3
Re: RC6 BUG Report: Image JPGs loaded from RC collection upside down
Olaf,
development-icon-light-1010.zip
This is a zip containing a single JPG, one of the types that were displayed upside down.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
-
Nov 26th, 2024, 09:33 AM
#4
Re: RC6 BUG Report: Image JPGs loaded from RC collection upside down
 Originally Posted by yereverluvinuncleber
Just unpacked your zipped *.jpg into my temp-Folder - and each of the following lines:
Code:
Private Sub Form_Load()
Set Me.Picture = Cairo.ImageList.AddImage("", "c:\temp\development-icon-light-1010.jpg").Picture
'Set Me.Picture = LoadPicture("c:\temp\development-icon-light-1010.jpg")
End Sub
... will produce the same Image-Output on the Form -
(setting the Picture-Property of a normal VB6-Form, having an RC6-reference in the Project).
Olaf
-
Mar 20th, 2025, 02:54 AM
#5
Re: RC6 BUG Report: Image JPGs loaded from RC collection upside down
Please check if this was fixed in Beta 714, which fixed this similar issue in XYplorer (fixed: 32bpp bitmaps would sometimes be rendered upside down [ XYplorer, private ])
-
Mar 20th, 2025, 07:24 AM
#6
Re: RC6 BUG Report: Image JPGs loaded from RC collection upside down
Will do Faf. reporting back soon.
https://github.com/yereverluvinunclebert
Skillset: VMS,DOS,Windows Sysadmin from 1985, fault-tolerance, VaxCluster, Alpha,Sparc. DCL,QB,VBDOS- VB6,.NET, PHP,NODE.JS, Graphic Design, Project Manager, CMS, Quad Electronics. classic cars & m'bikes. Artist in water & oils. Historian.
By the power invested in me, all the threads I start are battle free zones - no arguing about the benefits of VB6 over .NET here please. Happiness must reign.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|