Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (500)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  drawing image??  (Read 1762 times)
0 Members and 1 Guest are viewing this topic.
Offline role

Senior Member


Projects: 3


Java manmoth is coming!


« Posted 2003-01-22 01:30:42 »

i create a map editor.
and now i'm in progress in making selection tools
but i stuck in drawing the selected image different from the others?  Angry example i pick a fence object, and i want the fence object drawn red or transparent.
is anyone know how to draw image in one color?
or make the image transparent? or whatever to change the image into something different from the other

thanxx

Golden T Game Engine - Java2D/OpenGL Game Engine
Golden T Website | Golden T Forum
Offline markuskidd

Junior Member


Medals: 1



« Reply #1 - Posted 2003-01-22 01:42:10 »

have some links:
http://www.java-gaming.org/cgi-bin/JGOForums/YaBB.cgi?board=2D;action=display;num=1042426804
http://www.josrts.org/cgi-bin/ikonboard/ikonboard.cgi?s=3a577701605d528cec40323a938dffad;act=ST;f=1;t=138;st=0;&#entry1567
Offline vydias

Senior Newbie




Welcome to my world!


« Reply #2 - Posted 2003-01-22 05:18:40 »

Quote
anyone know how to draw image in one color?
or make the image transparent? or whatever to change the image into something different from the other


The easiest way to do this for something static like a map editor where your images can be prerender is to use the pixelGrabber class. After you have all of your pixels in an int array simply pass them through a color parser that modifies the pixels that aren't transparent to one set color (red). Then call use the memoryImageSource class to create an image out of it. This image won't be accelerated but if you then copy that image onto a offscreen image through createCompatibleImage(..) you can gain hardware acceleration.

You can find many examples by doing a search for PixelGrabber.  They will show you how to do the shifting to set each of the Red,Green,Blue and Alpha's of your pixel. I also have some code I could dig up if you can't find anything useful and you decide to use this technique.

There are better (memory wise) ways to create this effect, but this is probably the easiest and a map editor shouldn't be too memory intensive.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline role

Senior Member


Projects: 3


Java manmoth is coming!


« Reply #3 - Posted 2003-01-22 08:28:54 »

yup. i get the point.  Cheesy
but it'll take to much overhead since i have many images  Cry
my map editor use big memory and slow in performance, cos it open more than one map each time(each map dimension is about 2000x2000), i use JInternalFrame for that.
if i use pixelgrabber, i'm afraid the editor will be very very slow.  Embarrassed
any faster idea  Wink

Golden T Game Engine - Java2D/OpenGL Game Engine
Golden T Website | Golden T Forum
Offline Abuse

JGO Coder


Medals: 10


falling into the abyss of reality


« Reply #4 - Posted 2003-01-22 21:58:01 »

have you had a look at java.awt.image.ColorConvertOp
(and all the other RasterOp classes for that matter)

Make Elite IV:Dangerous happen! Pledge your backing at KICKSTARTER here! https://dl.dropbox.com/u/54785909/EliteIVsmaller.png
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #5 - Posted 2003-01-23 02:14:00 »

Look into compositing modes of java2D

You can likely blend the image with a colour simply by changing the compositing mode and the alpha value, so that you can 'tint' the object a certain color and then draw it to the screen.

I think that would be the simplest way, and likely the fastest.

Offline role

Senior Member


Projects: 3


Java manmoth is coming!


« Reply #6 - Posted 2003-01-23 02:24:31 »

okay guys.. i have solved this problem
thanxx
i use composite like swpalmer said.
the fence now look transparent   Grin

thank you

Golden T Game Engine - Java2D/OpenGL Game Engine
Golden T Website | Golden T Forum
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (51 views)
2014-04-15 18:08:23

BurntPizza (48 views)
2014-04-15 03:46:01

UprightPath (63 views)
2014-04-14 17:39:50

UprightPath (45 views)
2014-04-14 17:35:47

Porlus (62 views)
2014-04-14 15:48:38

tom_mai78101 (86 views)
2014-04-10 04:04:31

BurntPizza (146 views)
2014-04-08 23:06:04

tom_mai78101 (243 views)
2014-04-05 13:34:39

trollwarrior1 (202 views)
2014-04-04 12:06:45

CJLetsGame (209 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!