ImageLib

ceaser

Active Member
Licensed User
Why don't you use Agraham's graphics library? I have used it for my CAD program and it has all that I required.

Michael
 

ceaser

Active Member
Licensed User
OOPS!!:sign0148::BangHead:

Monsterman, buy the program then all your problems are over!:sign0060:
 
There is one more feature I'm missing in the ImageLib:
Bitmap.SetPixel(R,G,B | Color constant)
instead there is only ...SetPixel(Color as color)

May I know if such feature available in the ImageLibEx?
 

klaus

Expert
Licensed User
It's the same in ImageLibEx.
But you can use in both libraries.
Bitmap.SetPixel(x,y,RGB(R,G,B))
Best regards.
 
Hello Klaus.
Bitmap.SetPixel(x,y,RGB(R,G,B))
I have tried.....Can't figure the proper syntax.Can you help me out please?

Bitmap.GetPixel returns such values as
-1
-330010
-1457575
etc .They don't look like RGB :)
 

specci48

Well-Known Member
Licensed User
Bitmap.GetPixel returns such values as
-1
-330010
-1457575
etc .They don't look like RGB :)
As mentioned in the help file, Bitmap.GetPixel1 returns a color, not RGB values:
"Syntax: GetPixel1 (x As Int32, y As Int32) As Color"

You can convert a color to RGB with:
B4X:
Dim Type (R,G,B) clr
clr() = GetRGB(Bitmap.GetPixel1(x,y))
Msgbox("Red=" & clr.R & " Green=" & clr.G & " Blue=" & clr.B)

specci48
 

klaus

Expert
Licensed User
What exactly do you want to do ?
Do you really need the R,G,B values and what for ?

You can use a variable for the color, like col
col = Bimap.GetPixel(x1,y1)

you can then use
Bitmap.SetPixel(x2,y2,col)

Best regards.
 
Do you really need the R,G,B values and what for ?

You can use a variable for the color, like col
I have more purpose. I need RGB to edit and create sprites and bitmaps.
I want to get a good knowledge of computer graphics :):)

You can convert a color to RGB with:

Code:
Dim Type (R,G,B) clr
clr() = GetRGB(Bitmap.GetPixel1(x,y))
Msgbox("Red=" & clr.R & " Green=" & clr.G & " Blue=" & clr.B)
Thanks Specci I should have thought of it myself. Probably I've spent too much time at my comp today :)
 

appie21

Active Member
Licensed User
Hello

i have this

B4X:
ToastMessageShow(bmpBackground.GetPixel(20,20),True)
Dim Type (R,G,B) clr
clr() = GetRGB(bmpBackground.GetPixel1(20,20))
Msgbox("Red=" & clr.R & " Green=" & clr.G & " Blue=" & clr.B)
but GetRGB is red what do i wrong?

my i dea is to get the RGB of a pixel of a image
 

klaus

Expert
Licensed User
This is a Basic4PPC library and not a Basic4Android library !
getPixel is in the BitmapExtended library.
I haven't found a direct GetRGB function in Basic4Android.
But there is a code here.

Best regards.
 
Top