Search Results

Search found 1699 results on 68 pages for 'alpha'.

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

  • Alpha issue with SharpDX SpriteBatch in WPF

    - by Kingdom
    .Hi devs, I'm coding a game using SharpDX in a WPF context. void Load() { sb = new SpriteBatch(GraphicsDevice); t2d = Content.Load<Texture2D>("Sprite.png"); } void Draw() { sb.Begin(); sb.Draw(t2d, new Rectangle(0, 0, 64, 64), Color.White); sb.End(); } I made Sprite.png, an object with pink color (alpha = 0%) for the background. The output show me my object but with the pink square at more or less 50% rate! So if I try to draw more sprites, it's like a little poney dream. Note If I apply Color.Black on the Draw method, the sprite is like expected :|

    Read the article

  • Z-order with Alpha blending in a 3D world

    - by user41765
    I'm working on a game in a 3D world with 2D sprites only (like Don't Starve game). (OpenGL ES2 with C++) Currently, I'm ordering elements back to front before drawing them without batch (so 1 element = 1 drawcall). I would like to implement batching in my framework to decrease draw calls. Here is what I've got for the moment: Order all elements of my scene back to front. Send order list of elements to the Renderer. Renderer look in his batch manager if a batch exist for the given element with his Material. Batch didn't exist: create a new one. Batch exist for element with this Material: Add sprite to the batch. Compute big mesh with all sprite for each batch (1 material type = 1 batch). When all batches are ok, the batch manager compute draw commands for the renderer. Renderer process draw commands (bind shader, bind textures, bind buffers, draw element) Image with my problem here: Explication here But I've got some problems because objects can be behind another objects inside another batch. How can I do something like that? Thanks!

    Read the article

  • Convert a gray PNG with alpha to a 1-bit black rectanble with 8-bit alpha

    - by jcayzac
    I use a tool to render LaTeX equations as PNG. The resulting images are in RGBA8888 format. I would like to extract the luminance (grayscale from RGB channels, multiplied by the A channel) as my new alpha channel, set the picture fully black, and save the result in Gray1Alpha8 (G1A8) format. So far I've only managed to get G1A4 or G8A8 but not G1A8. Also, the resulting picture looks like it's not multiplied correctly… convert original.png \ \( -clone 0 -alpha extract \) \ \( -clone 0 -clone 1 -compose multiply -composite \) \ -delete 0 +swap -alpha off -compose copy_opacity -composite -colorspace Gray -depth 4 result.png What am I missing?

    Read the article

  • Alpha plugin in GStreamer not working

    - by Miguel Escriva
    Hi! I'm trying to compose two videos, and I'm using the alpha plug-in to make the white color transparent. To test the alpha plug-in I'm creating the pipeline with gst-launch. The first test I done was: gst-launch videotestsrc pattern=smpte75 \ ! alpha method=custom target-r=255 target-g=255 target-b=255 angle=10 \ ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink \ videotestsrc pattern=snow ! mixer. and it works great! Then I created two videos with those lines: gst-launch videotestsrc pattern=snow ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=snow.ogv gst-launch videotestsrc pattern=smpte75 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=bars75.ogv And changed the videotestsrc to a filesrc and it continues working gst-launch filesrc location=bars75.ogv ! decodebin2 \ ! alpha method=custom target-r=255 target-g=255 target-b=255 angle=10 \ ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink \ filesrc location=snow.ogv ! decodebin2 ! alpha ! mixer. But, when I use the ideo I want to compose, I'm not able to make the white color transparent gst-launch filesrc location=video.ogv ! decodebin2 \ ! alpha method=custom target-r=255 target-g=255 target-b=255 angle=10 \ ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink \ filesrc location=snow.ogv ! decodebin2 ! alpha ! mixer. Can you help me? Any idea what is happening? I'm using GStreamer 0.10.28 You can download the test videos from here: http://polimedia.upv.es/pub/gst/gst.zip Thanks in advance, Miguel Escriva

    Read the article

  • Point sample opacity/alpha in Adobe Photoshop?

    - by Josh
    I opened a PNG containing an alpha channel in Photoshop and wanted to get the opacity / alpha of a given point in the PNG file, so that I could match that opacity in a new photoshop layer. How can I do this? is there any way to get an alpha value at a point the way the color sample tool gives RGB values at a given point?

    Read the article

  • Convert TIFF with Alpha Channel to PNG?

    - by Michael Stum
    I have a TIFF File that has a blue background and an Alpha Channel. I would like to save a PNG File which has the blue background transparent, using the Alpha Channel (because some pixels are not fully transparent) I use Photoshop CS5 Standard, but I haven't found an option there. I don't want to use the Magic Wand because it struggles with half-transparent pixels and because I do have a perfect Alpha Channel. Any ideas how this can be done?

    Read the article

  • Preserving alpha issues with loaded UIImages - how to avoid discarding alpha values on import?

    - by Peter Hajas
    My application lets the user save/load images with alpha values to the camera roll on the device. I can see in the Photos application that these images are appropriately alpha'd, as alpha'd areas just appear black. However, when I load these images back into the application using the valueForKey:UIImagePickerControllerOriginalImage message to the info dictionary from (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info, the alpha values are turned to just white, making those sections opaque. Is there a way to preserve these alpha values?

    Read the article

  • When is a webapp called Beta, alpha, pre-alpha, or none

    - by dmontain
    I've come across many apps on the web that call themselves Beta. I've come across other apps that had an alpha designation. I've even come across some that called themselves pre-alpha, whatever that means (if you know please clarify). Then I've come across some really bad webapps that shouldn't have left the developer's computer and they didn't have any beta designations. I've also seen some well built apps that called themselves Beta, including Stack Exchange (the mother site of SO) which I believe is very full featured to be called a Beta. I'm a little confused. It seems people are doing it at their whims. Is there an established rule or a checklist that can help decide what stage an app is in (beta, alpha, pre-alpha, or none)? P.S. Please feel free to retag as appropriate.

    Read the article

  • Jlabel with alpha value

    - by jouzef19
    Hi: i have jLabel and i want to change its opacity (alpha value) each one second , i tried something like that but its not change each one second , jlable change its opacity with last alpha value . Color color = jLabel1.getBackground(); int alpha = 255; long initTime = System.currentTimeMillis(); while(true){ if(System.currentTimeMillis() - initTime >= 1000){ initTime = System.currentTimeMillis(); alpha -=1; Color color2 = new Color(color.getRed(),color.getGreen(),color.getBlue(),alpha); jLabel1.setBackground(color2); } if(alpha<=0) break; }

    Read the article

  • Per-pixel per-component alpha blending in Windows

    - by Crend King
    I have a 24-bit bitmaps with R, G, B color channels and a 24-bit bitmap with R, G, B alpha channels. I want to alpha blend the first bitmap to a HDC in GDI or RenderTarget in Direct2D with the alpha channels respectively. For example, suppose for one pixel, the bitmap color is (192, 192, 192), the HDC color is (0, 255, 255) and the alpha channels are (30, 40, 50). The final HDC color should be (22, 245, 242). I know I can BitBlt the HDC to a memory HDC first, do alpha blending by manually calculating the color of each pixel and finally BitBlt back. I just want to avoid the additional blitting and leave APIs do their job (faster since they are in kernel space). The first idea comes to my mind is to split the source bitmap into 3 red-only, green-only and blue-only 8-bit bitmaps, do normal alpha blending, then composite the 3 output bitmaps into the HDC. But I don't find a way to do the splitting and composition natively in Windows (would Direct2D layer help?). Also, the splitting and compositing may require many additional copying. The performance overhead would be too high. Or maybe do the alpha blending in 3 passes. Each pass apply the blending for one channel, while maintaining the other 2 unchanged. Thanks for any comment. EDIT: I found this question, and the answer should be good reference to this problem. However, besides AC_SRC_OVER, there is no other blending operation supported. Why don't Microsoft improve their API?

    Read the article

  • Controlling the alpha of a UIImageView with Slider ..Can' t get it

    - by user1824839
    first i' d like to say this Forum was really helpfull for me that just started coding some weeks ago .. I succeed to do a quite nice app for the moment , than, but i m stuck on this : HOW COULD I CONTROL THE ALPHA OF A UIIMAGEVIEW , WITH A SLIDER EMBEDED IN ANOTHER VIEW ??? ; Basically i' like to do like the alpha slider of this : http://www.edumobile.org/iphone/how-to-make-an-app-2/controlling-a-uiviews-properties-for-ipad/ , but for a UIImageView. I promised i searched for hours , and didnt find how to do it ... Could someone have some minutes to give me ideas ?? Sorry for my poor english too. Thanks if you can. L. The resume of the link i posted, only focussing on the alpha property would be : ( considering a UIView ( View ) embeded in a ViewController ( ViewController ): enter code here ----View.h----- @interface View : UIView @property ( nonatomic, assign ) CGFloat alpha; @end enter code here ----View.m---- @implementation View @synthesize alpha; ?} @end enter code here ------ViewController.h----- import "View.h" @interface ViewController : UIViewController @property (nonatomic, strong) IBOutlet View *view; ?- (IBAction)alphaChanged:(UISlider *)sender; @end enter code here -------ViewController.m------ @interface ViewController () @end @implementation ViewController @synthesize view; (View *)view {?     if (!view) {?        view = [[View alloc] init];?    }?    return view;?} enter code here (IBAction)redChanged:(UISlider *)sender? {?    self.circle.alpha = sender.value;?    [self.circle setNeedsDisplay];?} (void)viewDidLoad ?{?    [super viewDidLoad];?         ?    self.circle.alpha = (CGFloat)1;?} (void)didReceiveMemoryWarning? {?  [super didReceiveMemoryWarning];?    @end enter code here

    Read the article

  • Alpha plugin in GStreamer not working

    - by Miguel Escriva
    Hi! I'm trying to compose two videos, and I'm using the alpha plug-in to make the white color transparent. To test the alpha plug-in I'm creating the pipeline with gst-launch. The first test I done was: gst-launch videotestsrc pattern=smpte75 \ ! alpha method=custom target-r=255 target-g=255 target-b=255 angle=10 \ ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink \ videotestsrc pattern=snow ! mixer. and it works great! Then I created two videos with those lines: gst-launch videotestsrc pattern=snow ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=snow.ogv gst-launch videotestsrc pattern=smpte75 ! ffmpegcolorspace ! theoraenc ! oggmux ! filesink location=bars75.ogv And changed the videotestsrc to a filesrc and it continues working gst-launch filesrc location=bars75.ogv ! decodebin2 \ ! alpha method=custom target-r=255 target-g=255 target-b=255 angle=10 \ ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink \ filesrc location=snow.ogv ! decodebin2 ! alpha ! mixer. But, when I use the ideo I want to compose, I'm not able to make the white color transparent gst-launch filesrc location=video.ogv ! decodebin2 \ ! alpha method=custom target-r=255 target-g=255 target-b=255 angle=10 \ ! videomixer name=mixer ! ffmpegcolorspace ! autovideosink \ filesrc location=snow.ogv ! decodebin2 ! alpha ! mixer. Can you help me? Any idea what is happening? I'm using GStreamer 0.10.28 You can download the test videos from here: http://polimedia.upv.es/pub/gst/gst.zip Thanks in advance, Miguel Escriva

    Read the article

  • Detect Alpha Channel with ImageMagick

    - by brad
    Scenario I would like to save images with alpha transparency as .png and images without alpha transparency as .jpg (even if their original format is .png or .gif). How can I detect whether or not an image has alpha transparency using ImageMagick?

    Read the article

  • Alpha Beta Search

    - by Becky
    I'm making a version of Martian Chess in java with AI and so far I THINK my move searching is semi-working, it seems to work alright for some depths but if I use a depth of 3 it returns a move for the opposite side...now the game is a bit weird because when a piece crosses half of the board, it becomes property of the other player so I think this is part of the problem. I'd be really greatful if someone could look over my code and point out any errors you think are there! (pls note that my evaluation function isn't nearly complete lol) MoveSearch.java public class MoveSearch { private Evaluation evaluate = new Evaluation(); private int blackPlayerScore, whitePlayerScore; public MoveContent bestMove; public MoveSearch(int blackScore, int whiteScore) { blackPlayerScore = blackScore; whitePlayerScore = whiteScore; } private Vector<Position> EvaluateMoves(Board board) { Vector<Position> positions = new Vector<Position>(); for (int i = 0; i < 32; i++) { Piece piece = null; if (!board.chessBoard[i].square.isEmpty()) { // store the piece piece = board.chessBoard[i].square.firstElement(); } // skip empty squares if (piece == null) { continue; } // skip the other players pieces if (piece.pieceColour != board.whosMove) { continue; } // generate valid moves for the piece PieceValidMoves validMoves = new PieceValidMoves(board.chessBoard, i, board.whosMove); validMoves.generateMoves(); // for each valid move for (int j = 0; j < piece.validMoves.size(); j++) { // store it as a position Position move = new Position(); move.startPosition = i; move.endPosition = piece.validMoves.elementAt(j); Piece pieceAttacked = null; if (!board.chessBoard[move.endPosition].square.isEmpty()) { // if the end position is not empty, store the attacked piece pieceAttacked = board.chessBoard[move.endPosition].square.firstElement(); } // if a piece is attacked if (pieceAttacked != null) { // append its value to the move score move.score += pieceAttacked.pieceValue; // if the moving pieces value is less than the value of the attacked piece if (piece.pieceValue < pieceAttacked.pieceValue) { // score extra points move.score += pieceAttacked.pieceValue - piece.pieceValue; } } // add the move to the set of positions positions.add(move); } } return positions; } // EvaluateMoves() private int SideToMoveScore(int score, PieceColour colour) { if (colour == PieceColour.Black){ return -score; } else { return score; } } public int AlphaBeta(Board board, int depth, int alpha, int beta) { //int best = -9999; // if the depth is 0, return the score of the current board if (depth <= 0) { board.printBoard(); System.out.println("Score: " + evaluate.EvaluateBoardScore(board)); System.out.println(""); int boardScore = evaluate.EvaluateBoardScore(board); return SideToMoveScore(boardScore, board.whosMove); } // fill the positions with valid moves Vector<Position> positions = EvaluateMoves(board); // if there are no available positions if (positions.size() == 0) { // and its blacks move if (board.whosMove == PieceColour.Black) { if (blackPlayerScore > whitePlayerScore) { // and they are winning, return a high number return 9999; } else if (whitePlayerScore == blackPlayerScore) { // if its a draw, lower number return 500; } else { // if they are losing, return a very low number return -9999; } } if (board.whosMove == PieceColour.White) { if (whitePlayerScore > blackPlayerScore) { return 9999; } else if (blackPlayerScore == whitePlayerScore) { return 500; } else { return -9999; } } } // for each position for (int i = 0; i < positions.size(); i++) { // store the position Position move = positions.elementAt(i); // temporarily copy the board Board temp = board.copyBoard(board); // make the move temp.makeMove(move.startPosition, move.endPosition); for (int x = 0; x < 32; x++) { if (!temp.chessBoard[x].square.isEmpty()) { PieceValidMoves validMoves = new PieceValidMoves(temp.chessBoard, x, temp.whosMove); validMoves.generateMoves(); } } // repeat the process recursively, decrementing the depth int val = -AlphaBeta(temp, depth - 1, -beta, -alpha); // if the value returned is better than the current best score, replace it if (val >= beta) { // beta cut-off return beta; } if (val > alpha) { alpha = val; bestMove = new MoveContent(alpha, move.startPosition, move.endPosition); } } // return the best score return alpha; } // AlphaBeta() } This is the makeMove method public void makeMove(int startPosition, int endPosition) { // quick reference to selected piece and attacked piece Piece selectedPiece = null; if (!(chessBoard[startPosition].square.isEmpty())) { selectedPiece = chessBoard[startPosition].square.firstElement(); } Piece attackedPiece = null; if (!(chessBoard[endPosition].square.isEmpty())) { attackedPiece = chessBoard[endPosition].square.firstElement(); } // if a piece is taken, amend score if (!(chessBoard[endPosition].square.isEmpty()) && attackedPiece != null) { if (attackedPiece.pieceColour == PieceColour.White) { blackScore = blackScore + attackedPiece.pieceValue; } if (attackedPiece.pieceColour == PieceColour.Black) { whiteScore = whiteScore + attackedPiece.pieceValue; } } // actually move the piece chessBoard[endPosition].square.removeAllElements(); chessBoard[endPosition].addPieceToSquare(selectedPiece); chessBoard[startPosition].square.removeAllElements(); // changing piece colour based on position if (endPosition > 15) { selectedPiece.pieceColour = PieceColour.White; } if (endPosition <= 15) { selectedPiece.pieceColour = PieceColour.Black; } //change to other player if (whosMove == PieceColour.Black) whosMove = PieceColour.White; else if (whosMove == PieceColour.White) whosMove = PieceColour.Black; } // makeMove()

    Read the article

  • How to programmatically alpha fade a textured object in OpenGL ES 1.1 (iPhone)

    - by PewterSoft
    I've been using OpenGL ES 1.1 on the iPhone for 10 months, and in that time there is one seemingly simple task I have been unable to do: programmatically fade a textured object. To keep it simple: how can I alpha fade, under code control, a simple 2D triangle that has a texture (with alpha) applied to it. I would like to fade it in/out while it is over a scene, not a simple colored background. So far the only technique I have to do this is to create a texture with multiple pre-faded copies of the texture on it. (Yuck) As an example, I am unable to do this using Apple's GLSprite sample code as a starting point. It already textures a quad with a texture that has its own alpha. I would like to fade that object in and out.

    Read the article

  • Action script 3 bitmap glitch, alpha fade in out

    - by user150946
    I have actually solved this problem but it was a weird one so I will post it and my solution. I had a movie clip with several children each of which had it's own alpha settings. It also had a bitmap child object with a masked movie clip sitting on top of it. I was fading in and out the parent movie clip and was getting some odd results all of the alpha settings of the children were being removed and the bitmap was glitching and showing the contents of the masked object that was above it. The problem was that my alpha value for fully opaque was 100 (as in AS2) not 1 (as per AS3). It took me ages to work this out so hopefully this helps someone else.

    Read the article

  • D3D9 Alpha Blending on the surfaces

    - by Indeera
    I have a surface (OffScreenPlain or RenderTarget with D3DFMT_A8R8G8B8) which I copy pixels (ARGB) to, from a third party function. Before pixel copying, Bits are accessed by LockRect. This surface is then StretchRect to the Backbuffer which is (D3DFMT_A8R8G8B8). Surface and Backbuffer are different dimensions. Filtering is set to D3DTEXF_NONE. Just after creating the d3d device I've set following RenderState settings D3DRS_ALPHABLENDENABLE -> TRUE D3DRS_BLENDOP -> D3DBLENDOP_ADD D3DRS_SRCBLEND -> D3DBLEND_SRCALPHA D3DRS_DESTBLEND -> D3DBLEND_INVSRCALPHA But I see no alpha blending happening. I've verified that alpha is specified in pixels. I've done a simple test by creating a vertex buffer and drawing a triangle (DrawPrimitive) which displays with alpha blending. In this test surface was StretchRect first and then DrawPrimitive, and the surface content displays without alpha blending and the triangle displays with alpha blending. What am I missing here? Thanks

    Read the article

  • Does HDC use alpha channel?

    - by Crend King
    Hello. Is there a way I can determine if an HDC uses alpha channel? I read Question 333559 and Question 685684, but their questions are about BITMAP. Apparently, some HDC has alpha channel (though they may not use it. Call this "Type 1") while others do not ("Type 2"). I know this by doing the following: Given a HDC, Create a compatible DC, and create a DIB section. Select the created HBITMAP into the compatible DC. BitBlt the source HDC to the compatible DC. Now examine the DIB section bits. For type 2 HDC, after every 3 bytes there is a byte always 0 (like 255 255 255 0); for type 1, these bytes are usualy 255 (like 250 240 230 255). To avoid false positive, I memset the bits to all 0x80 prior to the calls. Use GetDIBits directly on the source HDC, specify the HBITMAP as GetCurrentObject(hdc, OBJ_BITMAP). For both types of HDC, the 4th bytes are always 0. Change the DC bitmap by calling ExtTextOut. For type 2, ExtTextOut always set the 4th bytes to 0. For type 1, ExtTextOut always leave them untouched. I also noticed that the source HDC that are created by APIs (CreateCompatibleDC(), BeginPaint() ...) are always type 2. Type 1 HDC are from standard controls (like menu text). Even the HDC I CreateCompatibleDC from a type 1 becomes a type 2. So, on one hand, I'm frustrated that Microsoft does not provide equal information to developers (another example may be that you cannot know the direction of a HBITMAP after it is created), on the other hand, I'm still wondering is there a way to distinguish these HDC. Thanks for help.

    Read the article

  • Alpha animation bug on button

    - by RaiderJ
    I have animations that fade in a Button (alpha from 0 to 1) and fade out a button (alpha from 1 to 0). This part is all working fine. Button A triggers the fade in of Button B. Button B triggers the fade out of itself. Button B totally covers up Button A. The idea is that Button B contains an image that is used like an information popup. Button A is touched and Button B fades in on top. When Button B is touched it fades itself out again. Initially, Button B's visibility is set INVISIBLE and when the fade in animation is complete, it is set to VISIBLE. When Button B is clicked it fades out and then I set the visibility to INVISIBLE. The problem is that after Button B has faded out, and it is set INVISIBLE, it is still clickable and even though it is not visible, and touches are not received by Button A. I have tried removing Button B from the parent and re-adding it after the animation is completed, and this allows for touches to reach Button A, but only once. After that button B is not longer touchable.

    Read the article

  • The best algorithm enhancing alpha-beta?

    - by Risa
    I'm studying AI. My teacher gave us source code of a chess-like game and asked us to enhance it. My exercise is to improve the alpha/beta algorithm implementing in that game. The programmer already uses transposition tables, MTD(f) with alpha/beta+memory (MTD(f) is the best algorithm I know by far). So is there any better algorithm to enhance alpha-beta search or a good way to implement MTD(f) in coding a game?

    Read the article

  • Alpha interpolation in a pixel shader

    - by c4sh
    How does the interpolation in a fragment shader work when it comes to the alpha parameter? I'm programming a shader with SharpDX, DirectX11. My idea is to interpolate 2 3d points of a segment, so that I'll have the position interpolated in between in the pixel shader. But I want to know what happens with the alpha parameter when that position is blocked by another polygon. For instance, if alpha is 1.0 at the left end of my segment and 0.0 at the other one. What is the value of alpha in the middle, 0.5? Or does it depend on the visibility at that point (meaning it could be, for instance, 1.0 OR 0.0 depending on if that part of the segment is hidden by a poolygon?

    Read the article

  • Creating blur with an alpha channel, incorrect inclusion of black

    - by edA-qa mort-ora-y
    I'm trying to do a blur on a texture with an alpha channel. Using a typical approach (two-pass, gaussian weighting) I end up with a very dark blur. The reason is because the blurring does not properly account for the alpha channel. It happily blurs in the invisible part of the image, whcih happens to be black, and thus results in a very dark blur. Is there a technique to blur that properly accounts for the alpha channel?

    Read the article

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