RGBSurface

I am trying to increase / decrease brightness of a picture using RGBSurface.Transform
When Supports Hi-DPI is turned off Shared Build Settings, the code works fine,
but if Supports Hi-DPI is turned on then an UnsupportedOperationException error occurs.
Any help ?

This is the code I use

photo = photofolder.OpenAsVectorPicture
surf = photo.RGBSurface
br = 1 + (bright.Value/100)
for i = 0 to 255
if ibr < 255 Then
mapb.Append i
br
else
mapb.Append 255
end
next
surf.Transform mapb
drawphoto

Looks like you’re trying to open the image as a vector; then applying bitmap operations to it.

This shouldn’t work at all.

Use picture.open( folderitem) to open as a bitmap image.

No. I tried it still the same results. It works only with Supports Hi-DPI turned off.

Your code as is cannot be used.

You do not say where in the code the error occured.

Windows 10 (updated “up to date”) ?

Xojo 2019r3.1 ?

The error occurs at
surf.transform mapb

It works fine when Supports Hi-DPI is turned off in the shared settings.
The problem occurs only when Supports Hi-DPI is turned on.

Even use of picture.open does not solve the issue

I am using 2017 Release 2.1 on Mac OS X 10.10.5 (Yosemite)

Make a breakpoint before Transform and check if:
• mapb(0) have a value
• mapb is < 255 (0-255)

What type is bright ? (bright.Value)

mapb(0) = 0
all elements of array mapb have a value >= 0 and <= 255
bright is a slider control, hence bright.value is an integer.
I tried using a variable of type double instead of bright.Value, but still same problem

everything goes well under 2019 3.1
also with hi dpi

Var i,mapb(-1) As Integer
Var br As Double
Var surf As RGBSurface
Var f As FolderItem
Var loadbild,pic As picture

f=GetOpenFolderItem("")
loadbild = Picture.OpenVector(f) // New Release 3.1
pic = New picture(loadbild.Width,loadbild.height)
pic.Graphics.drawpicture loadbild,0,0,pic.Width,pic.height,0,0,loadbild.Width,loadbild.height
surf = pic.RGBSurface // Picture

br = 150 / 100 // < 100 = dark > 100 = brighter

For i = 0 To 255

If i * br < 255 Then
mapb.Append i*br
Else
mapb.Append 255
End

Next
surf.Transform mapb
zeichne(pic)
canvas1.Invalidate(False)

Thanks. This made it work.

loadbild = Picture.OpenVector(f) // New Release 3.1
pic = New picture(loadbild.Width,loadbild.height)
pic.Graphics.drawpicture loadbild,0,0,pic.Width,pic.height,0,0,loadbild.Width,loadbild.height