Search Results

Search found 603 results on 25 pages for 'rgb'.

Page 5/25 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Theme confusion in SpreadsheetML.

    - by dmaruca
    I've been fighting this all day. Inside my styles.xml file I have color information given like so: <fgColor theme="0" tint="-0.249977111117893" / ECMA 376 defines a theme color reference as: Index into the <clrScheme collection, referencing a particular <sysClr or <srgbClr value expressed in the Theme part. Ok, that sounds easy. Here is an excerpt from my clrScheme xml: <a:clrScheme name="Office" <a:dk1 <a:sysClr val="windowText" lastClr="000000" / </a:dk1 <a:lt1 <a:sysClr val="window" lastClr="FFFFFF" / </a:lt1 Index zero is black, and they are wanting to darken it? I can tell you that after the tint is applied, the color should be #F2F2F2. My confusion is what does theme="0" really mean? It can't possible mean to darken #000000. Checking MSDN only confuses me even more. From http://msdn.microsoft.com/en-us/library/dd560821.aspx note that the theme color integer begins counting from left to right in the palette starting with zero. Theme color 3 is the dark 2 text/background color. Actually, if you start counting at zero the third entry is Light 2. Dark 2 is the second one. Can anyone here shed some light on this subject for me? What does theme="0" really mean? Here is the VB6 code I have been working with to apply the tint. You can paste it into your vba editor and run the test sub. Public Type tRGB R As Byte G As Byte B As Byte End Type Public Type tHSL H As Double S As Double L As Double End Type Sub TestRgbTint() Dim c As tRGB RGB_Hex2Type "ffffff", c RGB_ApplyTint c, -0.249977111117893 Debug.Print Hex(c.R) & Hex(c.G) & Hex(c.B) End Sub Public Sub RGB_Hex2Type(ByVal HexString As String, RGB As tRGB) 'Remove the alpha channel if it exists If Len(HexString) = 8 Then HexString = mID(HexString, 3) End If RGB.R = CByte("&H" & Left(HexString, 2)) RGB.G = CByte("&H" & mID(HexString, 3, 2)) RGB.B = CByte("&H" & Right(HexString, 2)) End Sub Public Sub RGB_ApplyTint(RGB As tRGB, tint As Double) Const HLSMAX = 1# Dim HSL As tHSL If tint = 0 Then Exit Sub RGB2HSL RGB, HSL If tint < 0 Then HSL.L = HSL.L * (1# + tint) Else HSL.L = HSL.L * (1# - tint) + (HLSMAX - HLSMAX * (1# - tint)) End If HSL2RGB HSL, RGB End Sub Public Sub HSL2RGB(HSL As tHSL, RGB As tRGB) HSL2RGB_ByVal HSL.H, HSL.S, HSL.L, RGB End Sub Private Sub HSL2RGB_ByVal(ByVal H As Double, ByVal S As Double, ByVal L As Double, RGB As tRGB) Dim v As Double Dim R As Double, G As Double, B As Double 'Default color to gray R = L G = L B = L If L < 0.5 Then v = L * (1# + S) Else v = L + S - L * S End If If v > 0 Then Dim m As Double, sv As Double Dim sextant As Integer Dim fract As Double, vsf As Double, mid1 As Double, mid2 As Double m = L + L - v sv = (v - m) / v H = H * 6# sextant = Int(H) fract = H - sextant vsf = v * sv * fract mid1 = m + vsf mid2 = v - vsf Select Case sextant Case 0 R = v G = mid1 B = m Case 1 R = mid2 G = v B = m Case 2 R = m G = v B = mid1 Case 3 R = m G = mid2 B = v Case 4 R = mid1 G = m B = v Case 5 R = v G = m B = mid2 End Select End If RGB.R = R * 255# RGB.G = G * 255# RGB.B = B * 255# End Sub Public Sub RGB2HSL(RGB As tRGB, HSL As tHSL) Dim R As Double, G As Double, B As Double Dim v As Double, m As Double, vm As Double Dim r2 As Double, g2 As Double, b2 As Double R = RGB.R / 255# G = RGB.G / 255# B = RGB.B / 255# 'Default to black HSL.H = 0 HSL.S = 0 HSL.L = 0 v = IIf(R > G, R, G) v = IIf(v > B, v, B) m = IIf(R < G, R, G) m = IIf(m < B, m, B) HSL.L = (m + v) / 2# If HSL.L < 0 Then Exit Sub End If vm = v - m HSL.S = vm If HSL.S > 0 Then If HSL.L <= 0.5 Then HSL.S = HSL.S / (v + m) Else HSL.S = HSL.S / (2# - v - m) End If Else Exit Sub End If r2 = (v - R) / vm g2 = (v - G) / vm b2 = (v - B) / vm If R = v Then If G = m Then HSL.H = 5# + b2 Else HSL.H = 1# - g2 End If ElseIf G = v Then If B = m Then HSL.H = 1# + r2 Else HSL.H = 3# - b2 End If Else If R = m Then HSL.H = 3# + g2 Else HSL.H = 5# - r2 End If End If HSL.H = HSL.H / 6# End Sub

    Read the article

  • Html5: How to handle RGB pixel with commands from prompt ? (just a browser)

    - by Rocket Surgeon
    In the browser tools, say in debugging (any browser will do, but IE9 preferred) how can I access things like html5 canvas and modify individual pixels by typing commands from prompt ? I know, it is possible to accomplish in miriad normal ways with preparing the markup and loading the page, but what is the shortest path ? The browser is running with some content, then I hit F12-Console- what exactly should I type to cause a canvas to change ? Thank you

    Read the article

  • Given a RGB color x, how to find the most contrasting color y?

    - by Arthur Wulf White
    I have to mark a certain item in a way that will make it stick-out in the background. I need it to be surrounded with the color that contrasts the background as much as possible so it will pop out and easily noticeable by the player. Lets say I know the background is color 'x', how do I find 'y' such that it will be very contrasting to 'x' and easy to notice in a background where 'x' is a dominant color? I first thought about inverting color 'x' and then I noticed that when 'x' is a medium shade of gray, if I invert 'x' to get 'y', then 'y' is also a medium shade of gray which does not work.

    Read the article

  • How to draw an RGB pixel with bare hands ? (no extra document just a browser)

    - by Rocket Surgeon
    In the browser tools, say in debugging (any browser will do, but IE9 preferred) how can I access things like html5 canvas and modify individual pixels by typing commands from prompt ? I know, it is possible to accomplish in miriad normal ways with preparing the markup and loading the page, but what is the shortest path ? The browser is running with some content, then I hit F12-Console- what exactly should I type to cause a canvas to change ? Thank you

    Read the article

  • RGB? CMYK? Alpha? What Are Image Channels and What Do They Mean?

    - by Eric Z Goodnight
    They’re there, lurking in your image files. But have you ever wondered what are image channels are? And what do they have to do with RGB and CMYK? Here’s the answer. The channels panel in Photoshop is one of the most disused and misunderstood parts of the program. But images have color channels with or without Photoshop. Read on to find out what color channels are, what RGB and CMYK are, and learn a little bit more about how image files work Latest Features How-To Geek ETC How to Recover that Photo, Picture or File You Deleted Accidentally How To Colorize Black and White Vintage Photographs in Photoshop How To Get SSH Command-Line Access to Windows 7 Using Cygwin The How-To Geek Video Guide to Using Windows 7 Speech Recognition How To Create Your Own Custom ASCII Art from Any Image How To Process Camera Raw Without Paying for Adobe Photoshop What is the Internet? From the Today Show January 1994 [Historical Video] Take Screenshots and Edit Them in Chrome and Iron Using Aviary Screen Capture Run Android 3.0 on a Hacked Nook Google Art Project Takes You Inside World Famous Museums Emerald Waves and Moody Skies Wallpaper Change Your MAC Address to Avoid Free Internet Restrictions

    Read the article

  • RBG to CbyCr conversion code

    - by user1446688
    I am wondering why this code does not work. Basically it is supposed to convert between RGB and CbYCr. When I convert from RGB to CbYCr then back to RGB I do not get the original RGB values. What is wrong with this code? #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)(b))?(a):(b)) struct _rgb { int R; int G; int B; }; typedef struct _rgb rgb; struct _cbycr { int Cb; int Y; int Cr; }; typedef struct _cbycr cbycr; void cbycr2rgb(rgb *c, double Y, double Cb, double Cr) { int r = (int)(Y + 1.40200 * (Cr - 0x80)); int g = (int)(Y - 0.34414 * (Cb - 0x80) - 0.71414 * (Cr - 0x80)); int b = (int)(Y + 1.77200 * (Cb - 0x80)); c->R = MAX(0, MIN(255, r)); c->G = MAX(0, MIN(255, g)); c->B = MAX(0, MIN(255, b)); } void rgb2cbycr(cbycr *c, int R, int G, int B) { c->Y = (int)(0.299 * R + 0.587 * G + 0.114 * B); c->Cb = (int)(-0.16874 * R - 0.33126 * G + 0.50000 * B); c->Cr =(int)(0.50000 * R - 0.41869 * G - 0.08131 * B); } int main() { cbycr _cbycr; rgb _rgb; _rgb.R = 50; _rgb.G = 50; _rgb.B = 50; rgb2cbycr(&_cbycr, _rgb.R, _rgb.G, _rgb.B); cbycr2rgb(&_rgb, _cbycr.Y, _cbycr.Cb, _cbycr.Cr); printf("rgb=%d %d %d\n", _rgb.R, _rgb.G, _rgb.B); return 0; } output: rgb=0 185 0

    Read the article

  • Can I interpolate two HEX color values without converting them to RGB?

    - by navand
    I'm trying to make a Gradient Class for a Blackberry app. At first I thought about converting the HEX values to RGB and then interpolating them before converting the result back into HEX, but since I will be doing this for every pixel line of an area, and the calculations will be made by a mobile, I thought that maybe there's a more efficient way of doing it. Maybe involving those pesky bitwise operators which I know nothing of... or something. So, is there a way of interpolating without converting to RGB and back? If so, is it faster than the original way? In any case, can you help me make the most efficient color interpolation? Thank you in advance!

    Read the article

  • OpenGL ES rotate texture

    - by 0xSina
    I just got started with OpenGL ES... I have a fragment: const char * sFragment = _STRINGIFY( varying highp vec2 coordinate; precision mediump float; uniform vec4 maskC; uniform float threshold; uniform sampler2D videoframe; uniform sampler2D videosprite; uniform vec4 mask; uniform vec4 maskB; uniform int recording; vec3 normalize(vec3 color, float meanr) { return color*vec3(0.75 + meanr, 1., 1. - meanr); } void main() { float d; float dB; float dC; float meanr; float meanrB; float meanrC; float minD; vec4 pixelColor; vec4 spriteColor; pixelColor = texture2D(videoframe, coordinate); spriteColor = texture2D(videosprite, coordinate); meanr = (pixelColor.r + mask.r)/8.; meanrB = (pixelColor.r + maskB.r)/8.; meanrC = (pixelColor.r + maskC.r)/8.; d = distance(normalize(pixelColor.rgb, meanr), normalize(mask.rgb, meanr)); dB = distance(normalize(pixelColor.rgb, meanrB), normalize(maskB.rgb, meanrB)); dC = distance(normalize(pixelColor.rgb, meanrC), normalize(maskC.rgb, meanrC)); minD = min(d, dB); minD = min(minD, dC); gl_FragColor = spriteColor; if (minD > threshold) { gl_FragColor = pixelColor; } } Now, depending on wether recording is 0 or 1, I want to rotate uniform sampler2D videosprite 180 degrees (reflection in x-axis, flip vertically). How can I do that? I found the function glRotatef(), but how do i specify that I want to rotate video sprite and not videoframe? Thanks

    Read the article

  • How to translate legacy system colors to (A)RGB?

    - by Paul Sasik
    I have a list of color values encoded as signed integers in a legacy INI file that I need to translate into (A)RGB values with .NET. An INI example: [INI_Section] Color=-2147483633 Doing something like: Color.FromArgb(-2147483633) gives an alpha-blended version of a color that is not at all what I expect. Is there a .NET method for translating these legacy colors properly? Note that pInvoke to OlePro32.dll is not an option.

    Read the article

  • linearRGB conversion to/from HSL

    - by Otaku
    Does anyone know of a way to get HSL from an linearRGB color (not an sRGB color)? I've seen a lot of sRGB<-HSL conversions, but nothing for linearRGB<-HSL. Not sure if it is fundementally the same conversion with minor tweaks, but I'd appreciate any insight someone may have on this. Linear RGB is not the same as linearizing sRGB (which is taking [0,255] and making it [0,1]). Linear RGB transformation from/to sRGB is at http://en.wikipedia.org/wiki/SRGB. In VBA, this would be expressed (taking in linearized sRGB values [0,1]): Public Function sRGB_to_linearRGB(value As Double) If value < 0# Then sRGB_to_linearRGB = 0# Exit Function End If If value <= 0.04045 Then sRGB_to_linearRGB = value / 12.92 Exit Function End If If value <= 1# Then sRGB_to_linearRGB = ((value + 0.055) / 1.055) ^ 2.4 Exit Function End If sRGB_to_linearRGB = 1# End Function Public Function linearRGB_to_sRGB(value As Double) If value < 0# Then linearRGB_to_sRGB = 0# Exit Function End If If value <= 0.0031308 Then linearRGB_to_sRGB = value * 12.92 Exit Function End If If value < 1# Then linearRGB_to_sRGB = 1.055 * (value ^ (1# / 2.4)) - 0.055 Exit Function End If linearRGB_to_sRGB = 1# End Function I have tried sending in Linear RGB values to standard RGB_to_HSL routines and back out from HSL_to_RGB, but it does not work. I have seen almost no references that this can be done, except for two: A reference on http://en.wikipedia.org/wiki/HSL_and_HSV#cite_note-9 (numbered item 10). A reference on an open source project Grafx2 @ http://code.google.com/p/grafx2/issues/detail?id=63#c22 in which the contributor states that he has done Linear RGB <- HSL conversion and provides some C code in an attachment to his comment in a .diff file (which I can't really read :( ) My intent is to send from sRGB (for example, FF99FF (R=255, G=153, B=255)) to Linear RGB (R=1.0, G=0.318546778125092, B=1.0) using the code above (for example, the G=153 would be obtained in Linear RGB from sRGB_to_linearRGB(153 / 255)) to HSL, modify the Saturation by 350% and going back from HSL-Linear RGB-sRGB, the result would be FF19FF (R=255, G=25, B=255). Using available functions from .NET, such as .getHue from a System.Drawing.Color does not work in any sRGB space above 100% modulation of any HSL value, hence the need for Linear RGB to be sent in instead of sRGB.

    Read the article

  • How to translate legacy system (OLE) colors to (A)RGB?

    - by Paul Sasik
    I have a list of color values encoded as signed integers (OLE I think) in a legacy INI file that I need to translate into (A)RGB values with .NET. An INI example: [INI_Section] Color=-2147483633 Doing something like: Color.FromArgb(-2147483633) gives an alpha-blended version of a color that is not at all what I expect. I think that a value like -2147483633 is supposed to represent a system-defined, or named color like ButtonFace. Is there a .NET method for translating these legacy colors properly? Note that pInvoke to OlePro32.dll is not an option.

    Read the article

  • Why 32-bit color EGL configurations fail with EGL_BAD_MATCH on Moto Droid?

    - by Gilead
    I'm trying to figure out why certain EGL configurations cause eglMakeCurrent() call to return EGL_BAD_MATCH on Motorola Droid running Android 2.1u1. This is a full list of hardware-accelerated EGL configurations (those with EGL_CONFIG_CAVEAT == EGL_NONE) as there's a few others with EGL_CONFIG_CAVEAT == EGL_SLOW_CONFIG but those are backed by PixelFlinger 1.2 meaning they're using software renderer. ID: 0 RGB: 8, 8, 8 Alpha: 8 Depth: 24 Stencil: 8 // BAD MATCH ID: 1 RGB: 8, 8, 8 Alpha: 8 Depth: 0 Stencil: 0 // BAD MATCH ID: 2 RGB: 8, 8, 8 Alpha: 8 Depth: 24 Stencil: 8 // BAD MATCH ID: 3 RGB: 8, 8, 8 Alpha: 8 Depth: 24 Stencil: 8 // BAD MATCH ID: 4 RGB: 8, 8, 8 Alpha: 8 Depth: 0 Stencil: 0 // BAD MATCH ID: 5 RGB: 8, 8, 8 Alpha: 8 Depth: 24 Stencil: 8 // BAD MATCH ID: 6 RGB: 5, 6, 5 Alpha: 0 Depth: 24 Stencil: 8 ID: 7 RGB: 5, 6, 5 Alpha: 0 Depth: 0 Stencil: 0 ID: 8 RGB: 5, 6, 5 Alpha: 0 Depth: 24 Stencil: 8 Clearly, all configurations with 32-bit color depth fail and all 16-bit ones are OK but: 1. Why? 2. WHY?! :) 3. How do I tell which ones would fail before actually trying to use them? The code below is as simple as it can get. I put if (v[0] == 6) there to check different configs, normally they're chosen by half-clever config matcher :) private void createSurface(SurfaceHolder holder) { egl = (EGL10)EGLContext.getEGL(); eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); egl.eglInitialize(eglDisplay, null); int[] numConfigs = new int[1]; egl.eglChooseConfig(eglDisplay, new int[] { EGL10.EGL_NONE }, null, 0, numConfigs); EGLConfig[] configs = new EGLConfig[numConfigs[0]]; egl.eglChooseConfig(eglDisplay, new int[] { EGL10.EGL_NONE }, configs, numConfigs[0], numConfigs); int[] v = new int[1]; for (EGLConfig c : configs) { egl.eglGetConfigAttrib(eglDisplay, c, EGL10.EGL_CONFIG_ID, v); if (v[0] == 6) { eglConfig = c; } } eglContext = egl.eglCreateContext(eglDisplay, eglConfig, EGL10.EGL_NO_CONTEXT, null); if (eglContext == null || eglContext == EGL10.EGL_NO_CONTEXT) { throw new RuntimeException("Unable to create EGL context"); } eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, holder, null); if (eglSurface == null || eglSurface == EGL10.EGL_NO_SURFACE) { throw new RuntimeException("Unable to create EGL surface"); } if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) { throw new RuntimeException("Unable to make EGL current"); } gl = (GL10)eglContext.getGL(); }

    Read the article

  • How to detect if a RGB is fully transparent?

    - by omega
    In java, I want to make a fully transparent RGBA, and I do that by using public static int getTransparentRGB() { int r = 0; int g = 0; int b = 0; int a = 0; int new_pixel = (a << 24) | (r << 16) | (g << 8) | b; return new_pixel; } Color color = new Color(getTransparentRGB()); System.out.println(color.getAlpha()); // -> 255 ?! I purposely keep all rgba values 0. However after I create the Color object with the rgba value as the constructor, if I call .getAlpha(), I get 255 even though I made the rgb value with a 0 alpha. If it returns 255, how could I tell the difference between a Color object that wasn't transparent, because that would also have a 255 alpha. I expect the color object to return a 0 alpha based on the function above. Does anyone know whats going on? Thanks

    Read the article

  • Very slow direct3D texture sampling

    - by __dominic
    Hi, So I'm writing a small game using Direct3D 9 and I'm using multitexturing for the terrain. All I'm doing is sampling 3 textures and a blend map and getting the overall color from the three textures based on the color channels from the blend map. Anyway, I am getting a massive frame rate drop when I sample more than 1 texture, I'm going from 120+ fps to just under 50. This is the HLSL code responsible for the slow down: float3 ground = tex2D(GroundTex, multiTex).rgb; float3 stone = tex2D(StoneTex, multiTex).rgb; float3 grass = tex2D(GrassTex, multiTex).rgb; float3 blend = tex2D(BlendMapTex, blendMap).rgb; Am I doing it wrong ? If anyone has any info or tips about texture sampling or anything, that would be nice. Thanks.

    Read the article

  • My Linux desktop sees my HDMI-connected monitor, but my monitor says "No signal"

    - by hrunting
    I have a Gigabyte H55M-UD2H motherboard and an Acer S271HL monitor. When I connect the monitor to the motherboard via VGA, signal works perfectly. When I connect the monitor via HDMI, the system "sees" the connection, but the monitor receives no signal (the monitor shows a blue box which reads "No Signal" and then the monitor goes into power-saving state). Some fun facts about this: if I hook a different monitor to this box via HDMI, the monitor receives the output without issue (same computer/motherboard, same cable, different monitor) if I connect a different computer to the monitor via HDMI, the monitor receives the output without issue (different computer, same cable, same monitor) no signal is received whether in the OS or in the BIOS there are no BIOS options for controlling video output other than for selection of onboard vs. PCI/PCI-E-based video card (the system has no dedicated video card installed) The box is running Linux, so I have the output of xrandr which shows the connection and the monitor modes detected via DDC: ~$ xrandr --prop Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192 VGA1 disconnected (normal left inverted right x axis y axis) HDMI1 disconnected (normal left inverted right x axis y axis) Broadcast RGB: Full supported: Full Limited 16:2 audio: auto supported: force-dvi off auto on DP1 disconnected (normal left inverted right x axis y axis) Broadcast RGB: Full supported: Full Limited 16:2 audio: auto supported: force-dvi off auto on HDMI2 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 598mm x 336mm EDID: 00ffffffffffff000472ca028d128022 1c160103803c2278ca7b45a4554aa227 0b5054bfef80714f8140818081c08100 9500b300d1c0023a801871382d40582c 450056502100001e000000fd00384c1f 5311000a202020202020000000fc0053 323731484c0a202020202020000000ff 004c55573044303130383531300a01e5 020324f14f0102030405060790111213 1415161f230907078301000067030c00 1000382d023a801871382d40582c4500 56502100001f011d8018711c1620582c 250056502100009f011d007251d01e20 6e28550056502100001e8c0ad08a20e0 2d10103e960056502100001800000000 000000000000000000000000000000de Broadcast RGB: Full supported: Full Limited 16:2 audio: auto supported: force-dvi off auto on 1920x1080 60.0*+ 50.0 25.0 30.0 1680x1050 59.9 1680x945 60.0 1400x1050 74.9 59.9 1600x900 60.0 1280x1024 75.0 60.0 1440x900 75.0 59.9 1280x960 60.0 1366x768 60.0 1360x768 60.0 1280x800 74.9 59.9 1152x864 75.0 1280x768 74.9 60.0 1280x720 50.0 60.0 1440x576 25.0 1024x768 75.1 70.1 60.0 1440x480 30.0 1024x576 60.0 832x624 74.6 800x600 72.2 75.0 60.3 56.2 720x576 50.0 848x480 60.0 720x480 59.9 640x480 72.8 75.0 66.7 60.0 59.9 720x400 70.1 HDMI3 disconnected (normal left inverted right x axis y axis) Broadcast RGB: Full supported: Full Limited 16:2 audio: auto supported: force-dvi off auto on DP2 disconnected (normal left inverted right x axis y axis) Broadcast RGB: Full supported: Full Limited 16:2 audio: auto supported: force-dvi off auto on DP3 disconnected (normal left inverted right x axis y axis) Broadcast RGB: Full supported: Full Limited 16:2 audio: auto supported: force-dvi off auto on How do I get this monitor to recognize the output from this HDMI socket?

    Read the article

  • adding onTap method on path direction between 2 point

    - by idham
    I have a problem in my Android application I have a path direction on my application and I want to add an onTap method for the path, so if I touch that path my application will display information with alert dialog. This my activity code: hasilrute hr = new hasilrute(); for (int k = 0;k < hr.r2.size(); k++){ String angkot = hr.r2.get(i).angkot; Cursor c = db.getLatLong(hasilrute.a); Cursor cc = db.getLatLong(hasilrute.b); String x = (c.getString(3)+","+c.getString(2)); String xx = (cc.getString(3)+","+cc.getString(2)); String pairs[] = getDirectionData(x, xx); String[] lnglat = pairs[0].split(","); GeoPoint point = new GeoPoint((int) (Double.parseDouble(lnglat[1]) *1E6),(int)(Double.parseDouble(lnglat[0]) * 1E6)); GeoPoint gp1; GeoPoint gp2 = point; for (int j = 1;j < pairs.length; j++){ lnglat = pairs[j].split(","); gp1 = gp2; gp2 = new GeoPoint((int) (Double.parseDouble(lnglat[1]) *1E6),(int) (Double.parseDouble(lnglat[0]) * 1E6)); mapView.getOverlays().add(new jalur(gp1, gp2,angkot)); } } and it's my jalur.java code public class jalur extends Overlay { private GeoPoint gp1; private GeoPoint gp2; private String angkot; private Context mContext; public jalur(GeoPoint gp1, GeoPoint gp2, String angkot){ this.gp1 = gp1; this.gp2 = gp2; this.angkot = angkot; } @Override public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when){ Projection projection = mapView.getProjection(); if (shadow == false){ if (angkot.equals("Cimahi-Leuwipanjang")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(118,171,127)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Cangkorah")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(67,204,255)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimindi-Cipatik")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(42,82,0)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Jalan Kaki")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(0,0,0)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Padalarang")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(229,66,66)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); } if (angkot.equals("Pasantren-Sarijadi")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(4,39,255)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Parongpong")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(141,0,200)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Cibeber")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(255,246,0)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Cimindi")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(220,145,251)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Contong")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(242,138,138)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Soreang")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(0,255,78)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); }if (angkot.equals("Cimahi-Batujajar")){ Paint paint = new Paint(); paint.setAntiAlias(true); Point point = new Point(); projection.toPixels(gp1,point); Point point2 = new Point(); projection.toPixels(gp2, point2); paint.setColor(Color.rgb(137,217,51)); paint.setStrokeWidth(2); canvas.drawLine((float) point.x, (float) point.y, (float) point2.x, (float) point2.y, paint); } } return super.draw(canvas, mapView, shadow, when); } @Override public void draw(Canvas canvas, MapView mapView, boolean shadow){ super.draw(canvas, mapView, shadow); } } thanks for your attention :)

    Read the article

  • How to convert a string color to its hex code or RGB value?

    - by Abs
    Hello all, I am not sure if its possible but I would like to create some sort of function where you pass in a string such as "yellow" or "green" and it returns its hex code or the range of hex codes that greens or yellows fit into. Is this possible in PHP? If not possible, I am willing to try anything else that can do this! Thanks all

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >