Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
does anyone know the managed DX9 equivelent of DX8's D3DCOLORVALUE - im trying to convert an vb app to vb.net. also the functions that go with colouts like D3DXColorLerp ...
  • *Experts*
Posted

Hmmm... I think you can just declare your own struct, as in:

public struct ColorType
{
	public byte b;
	public byte g;
	public byte r;
	public byte a;

	public ColorType(byte r, byte g, byte b)
	{ 
		this.r = r;
		this.g = g;
		this.b = b;
		this.a = 255;
	}
	public ColorType(Color c)
	{ 
		this.r = c.R;
		this.g = c.G;
		this.b = c.B;
		this.a = c.A;
	}
}

 

At least, that's what I used for returns to the LockRectangle call.

 

The SDK might have a default color struct defined, I can't remember offhand.

 

-nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

the soluction i found was to use

System.Drawing.Color

and the

Microsoft.DirectX.Direct3D.ColorOperator

module to manipulate them

 

from the ms dx9 sdk documentation:

ColorOperator Class

 

--------------------------------------------------------------------------------

 

Contains methods for manipulating colors.

 

Definition

 

Visual Basic NotInheritable Public Class ColorOperator

Inherits Object

C# public sealed class ColorOperator : Object

Managed C++ public __gc __sealed class ColorOperator : public Object

JScript public class ColorOperator extends Object

 

Members Table

 

The following table lists the members exposed by the ColorOperator object.

 

Add - Adds two color values together to create a new color value.

AdjustContrast - Adjusts the contrast value of a color.

AdjustSaturation - Adjusts the saturation value of a color.

Lerp - Uses linear interpolation to create a color value.

Modulate - Blends two colors.

Negative - Creates the negative color value of a color value.

Scale - Scales a color value.

Subtract - Subtracts two color values to create a new color value.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...