If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
change image to grayscale on fly
6 posts
• Page 1 of 1
change image to grayscale on fly
This is possible on the fly to change the color of the image. Methods of work with images not found
- Logado
- Posts: 62
- Joined: Tue Jan 06, 2015 5:42 pm
Re: change image to grayscale on fly
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.
- KG_is_back
- Posts: 1196
- Joined: Tue Oct 22, 2013 5:43 pm
- Location: Slovakia
Re: change image to grayscale on fly
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.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: change image to grayscale on fly
there is also the color matrix, you can use this for changing colors of images.
-
Nubeat7 - Posts: 1347
- Joined: Sat Apr 14, 2012 9:59 am
- Location: Vienna
Re: change image to grayscale on fly
Try this... (It is not mine pack)
- Attachments
-
- gui pack.fsm
- (31.31 KiB) Downloaded 797 times
- Youlean
- Posts: 176
- Joined: Mon Jun 09, 2014 2:49 pm
Re: change image to grayscale on fly
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
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
- Logado
- Posts: 62
- Joined: Tue Jan 06, 2015 5:42 pm
6 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 72 guests