ImageLibEx library

klaus

Expert
Licensed User
Longtime User
Hi Andrew,

What's wrong with

Rect1.New1(x-radius, y-radius, radius*2, radius*2)
DrawEllipse(Pen1.Value, Rect1.Value)
There is nothing wrong with that, I'm already using it.
For the circles on the forelayer I use Form.FCircle, and the wish was to have the equivalent function in the drawer.

At least the new FloodFill function would be of the biggest interest for me.

Thank you for your help and best regards.
 

klaus

Expert
Licensed User
Longtime User
Hi Andrew,

tsteward found an error with the DrawerEx when loading an image file with gif format, I get the same.

B4X:
[SIZE=2][FONT=Courier New][SIZE=2][FONT=Courier New]bmpImage.New1([/FONT][/SIZE][/FONT][/SIZE][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]AppPath[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]&[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000][FONT=Courier New][SIZE=2][COLOR=#800000]"\Rose.gif"[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2])[/SIZE][/FONT]
[SIZE=2][FONT=Courier New]drwImage.New2(bmpImage.Value)[/FONT][/SIZE]
[/SIZE][/FONT]

Is this a bug or a DrawerEx limitation ?

Thank you in advance and best regards.
 

agraham

Expert
Licensed User
Longtime User
Version 1.5 has the three improvements requested by Klaus in post #79

FloodFill.Flood overwrites everything until a specified boundary color is found.

DrawerEX.DrawCircle draws a circle - (now there's a surprise!)

DrawerEX.FillCircle draws a filled circle.
 

klaus

Expert
Licensed User
Longtime User
Hi Andrew, you are really great !

The new functions are already included in the Draw program.

Thank's for also having added the circle functions, so we find now in the Drawer also the Form's functions.

Thank you very much for your quick and valuable help.

Best regards.
 

Byak@

Active Member
Licensed User
Hello Agraham!i'm find outflow of memory when using DrawImage method!
please,see this example.i'm compil it (optimizing) and observe of it in TaskManager and i'm see outflow every time,when i press button and image drawed =(((
 

agraham

Expert
Licensed User
Longtime User
i'm find outflow of memory when using DrawImage method!
It's probably a bug in Basic4ppc, post #16 onwards of this thread has the details http://www.b4x.com/forum/questions-help-needed/3655-image-zoom-memory-problem-2.html Erel should fix this in the next release. You can minimise the problem by Bitmap.Dispose then AddObject as in the code fragment in post#16 of the thread. You will still lose a small amount of memory for each time you New the same Bitmap object until the bug is fixed but it probably won't be noticable.

The bug exists for any library object that is reinitialised by Newing it more than once, it just shows up "best" on Bitmaps as they use a lot of memory.
 

Byak@

Active Member
Licensed User
Agrham, Klaus big thanks!
 

Byak@

Active Member
Licensed User
I have a problem again: - [
i set TransparencyKey for form and draw image on it.but this color on image is not transparented! why?

p.s. in second option when checkbox1.checked all right but for my real program it is not good :BangHead:
 

Attachments

  • test_transp.zip
    3.4 KB · Views: 13

klaus

Expert
Licensed User
Longtime User
What exactly do you want to have transparent ?
I tried your program and for me it works OK.

In your case the whole form is transparent, and after clicking the button, the image corner is transparent like the form.
I have changed the form color to RGB(220,220,220) and clicking on the button gives:
- checkbox unchecked: makes the corner of the image transparent and shows the background behind the form, the color on the form is transparent and shows the screen background
- checkbox checked: the corner of the image is drawn transparent onto the form, the image corner shows the form background color.

Best regards.
 

Attachments

  • FormTransp.jpg
    FormTransp.jpg
    20.6 KB · Views: 12
  • ImageFormTransp.jpg
    ImageFormTransp.jpg
    9 KB · Views: 11
  • ImageTransp.jpg
    ImageTransp.jpg
    9 KB · Views: 10

Byak@

Active Member
Licensed User
o_O
but what have i... (formex.color=rgb(200,200,200))
 

Byak@

Active Member
Licensed User
emmm...no:)

B4X:
Sub App_Start
formex.New1("main.form1")
'form1.Show
[COLOR=Red]formex.Color=Rgb(200,200,200)
formex.TransparencyKey=Rgb(255,0,255)[/COLOR]
formex.Run
End Sub

Sub Button1_Click
bitmapex.New1(AppPath&"\smallimage2.bmp")
bitmapex2.New2(formex.Width,formex.Height)
'bitmapex2.New2(form1.Width,form1.Height)
drawerex.New2(bitmapex2.Value)
rect1.New1(0,0,bitmapex.Width,bitmapex.Height)
rect2.New1(0,0,bitmapex.Width,bitmapex.Height)
If checkbox1.Checked Then
drawerex.SetTransparentColor(Rgb(255,0,255))
drawerex.DrawImage(bitmapex.Value,rect1.Value,rect2.Value,True)
Else
drawerex.DrawImage(bitmapex.Value,rect1.Value,rect2.Value,False)
End If
formex.Image=bitmapex2.Value
'form1.Image=bitmapex2.Value
End Sub
 

agraham

Expert
Licensed User
Longtime User
I cut and pasted your code and on my system the top right of the Bitmap IS transparent as in the second of KLaus' screen captures. It must be something to do with the setup of your system. According to MSDN "This property is not supported when RightToLeftLayout is true." I can find no other reason for it not to work :(
 

Byak@

Active Member
Licensed User
on my second PC all works fine...
i get RightToLeftLayout property of form and it is false...
OS in first and second PC isWindows XP sp3
but version of .Net in second PC is 2.0.50727.42 (on first is 2.0.50727.3053)
maybe it is problem?
Agraham,what version of dotnet do you have?
 

Byak@

Active Member
Licensed User
i'm update dotnet but not happend
 

agraham

Expert
Licensed User
Longtime User
I've tried your latest code on my XP laptop and get a different result to my Vista desktop :confused:

Vista Desktop .NET version2.0.50727.3074
Chkbox1 checked - top right of bitmap gray
Chkbox1 unchecked - top right of bitmap transparent, see underlying desktop
If I set formex.Color=Rgb(255,00,255) the entire form is transparent, including the top right of the bitmap whatever the state of Chkbox1.

XP Laptop .NET version2.0.50727.3082
Chkbox1 checked - top right of bitmap gray
Chkbox1 unchecked - top right of bitmap violet, like your screenshot.
If I set formex.Color=Rgb(255,00,255) the entire form is transparent, including the top right of the bitmap if Chkbox1 is checked but if I uncheck it the top right of the bitmap is violet.

I've Googled around and it is a known BUG: The TransparencyKey property is not effective for Windows forms if the color depth of the monitor is set to a value that is greater than 24-bit. My laptop only supports 16bit and 32bit color and was set to 32bit, setting it to 16bits makes TransparencyKey work. This bug may only affect XP as my Vista desktop is also set to 32bit color and TransparencyKey works as expected on that.

I'm afraid it looks like all you can do is draw the bitmaps using a transparent color in the Drawer.
 

Byak@

Active Member
Licensed User
thanks agraham.i'm change color depth to 16 on my EeePC and Itransparent now work...
BUT im my desctop this setting setted 32 bits and all works fine!and OS not Vista!maybe it is problem of our Graphical adapter?
 
Top