Page 1 of 1
change image to grayscale on fly
Posted: Thu Apr 02, 2015 7:47 am
by Logado
This is possible on the fly to change the color of the image. Methods of work with images not found

Re: change image to grayscale on fly
Posted: Thu Apr 02, 2015 2:46 pm
by KG_is_back
In ruby, there are no methods to read or change pixels of a bitmap. In green, there are getPixel and setPixel prims, but to alter entire image you'd need enormous loops, which would likely create massive CPU waste.
Re: change image to grayscale on fly
Posted: Thu Apr 02, 2015 4:12 pm
by tulamide
You could make use of the FreeImage Project. You would then download the FreeImage DLL (
http://freeimage.sourceforge.net/download.html) and access the functions you need using Ruby's Win32API dll access as explained in the User Guide. It takes some time to set them up, but then you are able to do those on-the-fly conversions.
Re: change image to grayscale on fly
Posted: Thu Apr 02, 2015 8:32 pm
by Nubeat7
there is also the color matrix, you can use this for changing colors of images.
Re: change image to grayscale on fly
Posted: Thu Apr 02, 2015 8:59 pm
by Youlean
Try this... (It is not mine pack)
Re: change image to grayscale on fly
Posted: Fri Apr 03, 2015 5:25 am
by Logado
Thanks for answers.
I need it to show that the element is not active. Make a simple method.
v.drawBitmapSection @Spriteimg,[0,image_y,48,16],[0,0,6,2]
if @disable == 1
c1 = Color.new 180,53,60,70 #background color
c1 = Color.new 180,53,40,70
r = [0,0,v.width,v.height]
b = LinearGradientBrush.new r,c1,c2,0,true
v.drawRectangle b,r
end