Enum Class Stencil.Effect
- All Implemented Interfaces:
Serializable,Comparable<Stencil.Effect>,Constable
- Enclosing class:
- Stencil
Stencil.applyEffect(edu.cornell.gdiac.graphics.Stencil.Effect) to be
applied.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionAdds a stencil region the lower bufferAdds a stencil region to both the lower and upper bufferAdds a stencil region to the lower bufferLimits drawing so that each pixel is updated once.Uses the lower buffer to limit each pixel to single update.Restrict all drawing to the unified stencil region.Restrict all drawing to the unified stencil region.Restrict all drawing to the intersecting stencil region.AppliesCLIPusing the lower stencil buffer only.Restrict all drawing to the unified stencil region.Restricts all drawing to the unified stencil region.Restricts all drawing to the intersecting stencil region.AppliesFILLusing the lower stencil buffer only.Prohibits all drawing to the unified stencil region.Prohibits all drawing to the unified stencil region.Prohibits all drawing to the intersecting stencil region.AppliesMASKusing the lower stencil buffer only.Defers to the existing OpenGL stencil settings.Disables any stencil effects.Adds a stencil region to the upper bufferUses the upper buffer to limit each pixel to single update.AppliesCLIPusing the upper stencil buffer only.AppliesFILLusing the upper stencil buffer only.AppliesMASKusing the upper stencil buffer only.Adds a stencil region to the upper bufferAppliesWIPEusing the upper stencil buffer only.Adds a stencil region the unified bufferAdds a stencil region to both the lower and the upper bufferAdds a stencil region to the lower bufferErases from the unified stencil region.AppliesWIPEusing the lower stencil buffer only. -
Method Summary
Modifier and TypeMethodDescriptionstatic Stencil.EffectReturns the enum constant of this class with the specified name.static Stencil.Effect[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NATIVE
Defers to the existing OpenGL stencil settings. (DEFAULT)This effect neither enables nor disables the stencil buffer. Instead it uses the existing OpenGL settings. This is the effect that you should use when you need to manipulate the stencil buffer directly.
-
NONE
Disables any stencil effects.This effect directs a
SpriteBatchto ignore the stencil buffer (both halves) when drawing. However, it does not clear the contents of the stencil buffer. To clear the stencil buffer, you will need to callStencil.clearBuffer(int). -
CLIP
Restrict all drawing to the unified stencil region.In order for this effect to do anything, you must have created a stencil region with
STAMPor one of its variants. This effect will process the drawing commands normally, but restrict all drawing to the stencil region. This can be used to quickly draw non-convex shapes by making a stencil and drawing a rectangle over the stencil.This effect is the same as
CLIP_JOINin that it respects the union of the two halves of the stencil buffer. -
MASK
Prohibits all drawing to the unified stencil region.In order for this effect to do anything, you must have created a stencil region with
STAMPor one of its variants. This effect will process the drawing commands normally, but reject any attempts to draw to the stencil region. This can be used to quickly draw shape borders on top of a solid shape.This effect is the same as
MASK_JOINin that it respects the union of the two halves of the stencil buffer. -
FILL
Restrict all drawing to the unified stencil region.In order for this effect to do anything, you must have created a stencil region with
STAMPor one of its variants. This effect will process the drawing commands normally, but restrict all drawing to the stencil region. This can be used to quickly draw non-convex shapes by making a stencil and drawing a rectangle over the stencil.This effect is different from
CLIPin that it will zero out the pixels it draws in the stencil buffer, effectively removing them from the stencil region. In many applications, this is a fast way to clear the stencil buffer once it is no longer needed.This effect is the same as
FILL_JOINin that it respects the union of the two halves of the stencil buffer. -
WIPE
Erases from the unified stencil region.This effect will not draw anything to the screen. Instead, it will only draw to the stencil buffer directly. Any pixel drawn will be zeroed in the buffer, removing it from the stencil region. The effect
FILLis a combination of this andCLIP. Again, this is a potential optimization for clearing the stencil buffer. However, on most tiled-based GPUs, it is probably faster to simply clear the whole buffer. -
STAMP
Adds a stencil region the unified bufferThis effect will not have any immediate visible effects. Instead it creates a stencil region for the effects such as
CLIP,MASK, and the like.The shapes are drawn to the stencil buffer using a nonzero fill rule. This has the advantage that (unlike an even-odd fill rule) stamps are additive and can be drawn on top of each other. However, it has the disadvantage that it requires both halves of the stencil buffer to store the stamp (which part of the stamp is in which half is undefined).
While this effect implements a nonzero fill rule faithfully, there are technical limitations. The size of the stencil buffer means that more than 256 overlapping polygons of the same orientation will cause unpredictable effects. If this is a problem, use an even odd fill rule instead like
STAMP_NONE(which has no such limitations). -
CARVE
Adds a stencil region the lower bufferThis effect will not have any immediate visible effects. Instead it creates a stencil region for the effects such as
CLIP,MASK, and the like.Like
STAMP, shapes are drawn to the stencil buffer instead of the screen. But unlike stamp, this effect is always additive. It ignores path orientation, and does not support holes. This allows the effect to implement a nonzero fill rule while using only half of the buffer. This effect is equivalent toCARVE_NONEin that it uses only the lower half.The primary application of this effect is to create stencils from extruded paths so that overlapping sections are not drawn twice (which has negative effects on alpha blending).
-
CLAMP
Limits drawing so that each pixel is updated once.This effect is a variation of
CARVEthat also draws as it writes to the stencil buffer. This guarantees that each pixel is updated exactly once. This is used by extruded paths so that overlapping sections are not drawn twice (which has negative effects on alpha blending).This effect is equivalent to
CLAMP_NONEin that it uses only the lower half. -
NONE_CLIP
AppliesCLIPusing the upper stencil buffer only.As with
CLIP, this effect restricts drawing to the stencil region. However, this effect only uses the stencil region present in the upper stencil buffer.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
NONE_MASK
AppliesMASKusing the upper stencil buffer only.As with
MASK, this effect prohibits drawing to the stencil region. However, this effect only uses the stencil region present in the upper stencil buffer.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
NONE_FILL
AppliesFILLusing the upper stencil buffer only.As with
FILL, this effect limits drawing to the stencil region. However, this effect only uses the stencil region present in the upper stencil buffer. It also only zeroes out the upper stencil buffer.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
NONE_WIPE
AppliesWIPEusing the upper stencil buffer only.As with
WIPE, this effect zeroes out the stencil region, erasing parts of it. However, its effects are limited to the upper stencil region.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
NONE_STAMP
Adds a stencil region to the upper bufferThis effect will not have any immediate visible effect on the screen screen. Instead, it creates a stencil region for the effects such as
CLIP,MASK, and the like.Unlike
STAMP, the region created is limited to the upper half of the stencil buffer. That is because the shapes are drawn to the buffer with an even-odd fill rule (which does not require the full stencil buffer to implement). This has the disadvantage that stamps drawn on top of each other have an "erasing" effect. However, it has the advantage that the this stamp supports a wider array of effects than the simple stamp effect.Use
NONE_CLAMPif you have an simple stencil with no holes that you wish to write to the upper half of the buffer. -
NONE_CARVE
Adds a stencil region to the upper bufferThis value will not have any immediate visible effect on the screen. Instead, it creates a stencil region for the effects such as
CLIP,MASK, and the like. LikeSTAMP, shapes are drawn to the stencil buffer instead of the screen. But unlike stamp, this effect is always additive. It ignores path orientation, and does not support holes. This allows the effect to implement a nonzero fill rule while using only the upper half of the buffer.The primary application of this effect is to create stencils from extruded paths so that overlapping sections are not drawn twice (which has negative effects on alpha blending).
-
NONE_CLAMP
Uses the upper buffer to limit each pixel to single update.This effect is a variation of
NONE_CARVEthat also draws as it writes to the upper stencil buffer. This guarantees that each pixel is updated exactly once. This is used by extruded paths so that overlapping sections are not drawn twice (which has negative effects on alpha blending). -
CLIP_JOIN
Restrict all drawing to the unified stencil region.This effect is the same as
CLIPin that it respects the union of the two halves of the stencil buffer. -
CLIP_MEET
Restrict all drawing to the intersecting stencil region.This effect is the same as
CLIP, except that it limits drawing to the intersection of the stencil regions in the two halves of the stencil buffer. If a unified stencil region was created bySTAMP, then the results of this effect are unpredictable. -
CLIP_NONE
AppliesCLIPusing the lower stencil buffer only.As with
CLIP, this effect restricts drawing to the stencil region. However, this effect only uses the stencil region present in the lower stencil buffer.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
CLIP_MASK
Applies a lower bufferCLIPwith an upperMASK.This command restricts drawing to the stencil region in the lower buffer while prohibiting any drawing to the stencil region in the upper buffer. If this effect is applied to a unified stencil region created by
STAMP, then the results are unpredictable. -
CLIP_FILL
Applies a lower bufferCLIPwith an upperFILL.This command restricts drawing to the stencil region in the unified stencil region of the two buffers. However, it only zeroes pixels in the stencil region of the upper buffer; the lower buffer is untouched. If this effect is applied to a unified stencil region created by
STAMP, then the results are unpredictable. -
CLIP_WIPE
Applies a lower bufferCLIPwith an upperWIPE.As with
WIPE, this command does not do any drawing on screen. Instead, it zeroes out the upper stencil buffer. However, it is clipped by the stencil region in the lower buffer, so that it does not zero out any pixel outside this region. Hence this is a way to erase the lower buffer stencil region from the upper buffer stencil region. -
CLIP_STAMP
Applies a lower bufferCLIPwith an upperSTAMP.As with
NONE_CLAMP, this writes a shape to the upper stencil buffer using an even-odd fill rule. This means that adding a shape on top of existing shape has an erasing effect. However, it also restricts its operation to the stencil region in the lower stencil buffer. Note that if a pixel is clipped while drawing, it will not be added the stencil region in the upper buffer. -
CLIP_CARVE
Applies a lower bufferCLIPwith an upperCARVE.As with
NONE_CARVE, this writes an additive shape to the upper stencil buffer. However, it also restricts its operation to the stencil region in the lower stencil buffer. Note that if a pixel is clipped while drawing, it will not be added the stencil region in the upper buffer. Hence this is a way to copy the lower buffer stencil region into the upper buffer. -
CLIP_CLAMP
Applies a lower bufferCLIPwith an upperCLAMP.As with
NONE_CLAMP, this draws a nonoverlapping shape using the upper stencil buffer. However, it also restricts its operation to the stencil region in the lower stencil buffer. Note that if a pixel is clipped while drawing, it will not be added the stencil region in the upper buffer. -
MASK_JOIN
Prohibits all drawing to the unified stencil region.This effect is the same as
MASKin that it respects the union of the two halves of the stencil buffer. -
MASK_MEET
Prohibits all drawing to the intersecting stencil region.This effect is the same as
MASK, except that it limits drawing to the intersection of the stencil regions in the two halves of the stencil buffer. If a unified stencil region was created bySTAMP, then the results of this effect are unpredictable. -
MASK_NONE
AppliesMASKusing the lower stencil buffer only.As with
MASK, this effect prohibits drawing to the stencil region. However, this effect only uses the stencil region present in the lower stencil buffer.This effect is designed to be used with stencil regions created by
STAMP_NONE. While it can be used by a stencil region created bySTAMP, the upper stencil buffer is ignored, and hence the results are unpredictable. -
MASK_CLIP
Applies a lower bufferMASKwith an upperCLIP.This command restricts drawing to the stencil region in the upper buffer while prohibiting any drawing to the stencil region in the lower buffer. If this effect is applied to a unified stencil region created by
STAMP, then the results are unpredictable. -
MASK_FILL
Applies a lower bufferMASKwith an upperFILL.This command restricts drawing to the stencil region in the upper buffer while prohibiting any drawing to the stencil region in the lower buffer. However, it only zeroes the stencil region in the upper buffer; the lower buffer is untouched. In addition, it will only zero those pixels that were drawn.
If this effect is applied to a unified stencil region created by
STAMP, then the results are unpredictable. -
MASK_WIPE
-
MASK_STAMP
Applies a lower bufferMASKwith an upperSTAMP.As with
NONE_STAMP, this writes a shape to the upper stencil buffer using an even-odd fill rule. This means that adding a shape on top of existing shape has an erasing effect. However, it also masks its operation by the stencil region in the lower stencil buffer. Note that if a pixel is masked while drawing, it will not be added the stencil region in the upper buffer. -
MASK_CARVE
Applies a lower bufferMASKwith an upperCARVE.As with
NONE_CARVE, this writes an additive shape to the upper stencil buffer. However, it also prohibits any drawing to the stencil region in the lower stencil buffer. Note that if a pixel is masked while drawing, it will not be added the stencil region in the upper buffer. -
MASK_CLAMP
Applies a lower bufferMASKwith an upperCLAMP.As with
NONE_CLAMP, this draws a nonoverlapping shape using the upper stencil buffer. However, it also prohibits any drawing to the stencil region in the lower stencil buffer. Note that if a pixel is masked while drawing, it will not be added the stencil region in the upper buffer. -
FILL_JOIN
Restricts all drawing to the unified stencil region.This effect is the same as
FILLin that it respects the union of the two halves of the stencil buffer. -
FILL_MEET
Restricts all drawing to the intersecting stencil region.This effect is the same as
FILL, except that it limits drawing to the intersection of the stencil regions in the two halves of the stencil buffer.When zeroing out pixels, this operation zeroes out both halves of the stencil buffer. If a unified stencil region was created by
STAMP, the results of this effect are unpredictable. -
FILL_NONE
AppliesFILLusing the lower stencil buffer only.As with
FILL, this effect restricts drawing to the stencil region. However, this effect only uses the stencil region present in the lower stencil buffer. It also only zeroes the stencil region in this lower buffer.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
FILL_MASK
Applies a lower bufferFILLwith an upperMASK.This command restricts drawing to the stencil region in the lower buffer while prohibiting any drawing to the stencil region in the upper buffer.
When zeroing out the stencil region, this part of the effect is only applied to the lower buffer. If this effect is applied to a unified stencil region created by
STAMP, then the results are unpredictable. -
FILL_CLIP
Applies a lower bufferFILLwith an upperCLIP.This command restricts drawing to the stencil region in the unified stencil region of the two buffers. However, it only zeroes pixels in the stencil region of the lower buffer; the lower buffer is untouched. If this effect is applied to a unified stencil region created by
STAMP, then the results are unpredictable. -
WIPE_NONE
AppliesWIPEusing the lower stencil buffer only.As with
WIPE, this effect zeroes out the stencil region, erasing parts of it. However, its effects are limited to the lower stencil region.This effect is designed to be used with stencil regions created by
NONE_STAMP. While it can be used by a stencil region created bySTAMP, the lower stencil buffer is ignored, and hence the results are unpredictable. -
WIPE_MASK
Applies a lower bufferWIPEwith an upperMASK.This command erases from the stencil region in the lower buffer. However, it limits its erasing to locations that are not masked by the stencil region in the upper buffer. If this effect is applied to a unified stencil region created by
STAMP, the results are unpredictable. -
WIPE_CLIP
Applies a lower bufferWIPEwith an upperCLIP.This command erases from the stencil region in the lower buffer. However, it limits its erasing to locations that are contained in the stencil region in the upper buffer. If this effect is applied to a unified stencil region created by
STAMP, the results are unpredictable. -
STAMP_NONE
Adds a stencil region to the lower bufferThis effect will not have any immediate visible effect on the screen screen. Instead, it creates a stencil region for the effects such as
CLIP,MASK, and the like.Unlike
STAMP, the region created is limited to the lower half of the stencil buffer. That is because the shapes are drawn to the buffer with an even-odd fill rule (which does not require the full stencil buffer to implement). This has the disadvantage that stamps drawn on top of each other have an "erasing" effect. However, it has the advantage that the this stamp supports a wider array of effects than the simple stamp effect. -
STAMP_CLIP
Applies a lower bufferSTAMPwith an upperCLIP.As with
STAMP_NONE, this writes a shape to the lower stencil buffer using an even-odd fill rule. This means that adding a shape on top of existing shape has an erasing effect. However, it also restricts its operation to the stencil region in the upper stencil buffer. Note that if a pixel is clipped while drawing, it will not be added the stencil region in the lower buffer. -
STAMP_MASK
Applies a lower bufferSTAMPwith an upperMASK.As with
STAMP_NONE, this writes a shape to the lower stencil buffer using an even-odd fill rule. This means that adding a shape on top of existing shape has an erasing effect. However, it also masks its operation by the stencil region in the upper stencil buffer. Note that if a pixel is masked while drawing, it will not be added the stencil region in the lower buffer. -
STAMP_BOTH
Adds a stencil region to both the lower and the upper bufferThis effect will not have any immediate visible effect on the screen screen. Instead, it creates a stencil region for the effects such as
CLIP,MASK, and the like.Unlike
STAMP, the region is create twice and put in both the upper and the lower stencil buffer. That is because the shapes are drawn to the buffer with an even-odd fill rule (which does not require the full stencil buffer to implement). This has the disadvantage that stamps drawn on top of each other have an "erasing" effect. However, it has the advantage that the this stamp supports a wider array of effects than the simple stamp effect.The use of both buffers to provide a greater degree of flexibility.
-
CARVE_NONE
Adds a stencil region to the lower bufferThis effect is equivalent to
CARVE, since it only uses half of the stencil buffer. -
CARVE_CLIP
Applies a lower bufferCARVEwith an upperCLIP.As with
CARVE_NONE, this writes an additive shape to the lower stencil buffer. However, it also restricts its operation to the stencil region in the upper stencil buffer. Note that if a pixel is clipped while drawing, it will not be added the stencil region in the lower buffer. Hence this is a way to copy the upper buffer stencil region into the lower buffer. -
CARVE_MASK
Applies a lower bufferCARVEwith an upperMASK.As with
CARVE_NONE, this writes an additive shape to the lower stencil buffer. However, it also prohibits any drawing to the stencil region in the upper stencil buffer. Note that if a pixel is masked while drawing, it will not be added the stencil region in the lower buffer. -
CARVE_BOTH
Adds a stencil region to both the lower and upper bufferThis effect is similar to
CARVE, except that it uses both buffers. This is to give a wider degree of flexibility. -
CLAMP_NONE
Uses the lower buffer to limit each pixel to single update.This effect is equivalent to
CLAMP, since it only uses half of the stencil buffer. -
CLAMP_CLIP
Applies a lower bufferCLAMPwith an upperCLIP.As with
CLAMP_NONE, this draws a nonoverlapping shape using the lower stencil buffer. However, it also restricts its operation to the stencil region in the upper stencil buffer. Note that if a pixel is clipped while drawing, it will not be added the stencil region in the lower buffer. -
CLAMP_MASK
Applies a lower bufferCLAMPwith an upperMASK.As with
CLAMP_NONE, this draws a nonoverlapping shape using the lower stencil buffer. However, it also prohibits any drawing to the stencil region in the upper stencil buffer. Note that if a pixel is masked while drawing, it will not be added the stencil region in the lower buffer.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-