问题描述
我在 @Composable
fun GrayscaleImage() {
val context = AmbientContext.current
val image = remember {
val drawable = ContextCompat.getDrawable(
context,R.drawable.your_drawable
).toBitmap()!!.toGrayScale().asImageBitmap()
}
Image(image)
}
object Constants{
val grayPaint = android.graphics.Paint()
init {
val cm = ColorMatrix()
cm.setSaturation(0f)
val f = ColorMatrixColorFilter(cm)
grayPaint.colorFilter = f
}
}
fun Bitmap.toGrayscale(): Bitmap {
val height: Int = this.height
val width: Int = this.width
val bmpGrayscale: Bitmap = Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888)
val c = Canvas(bmpGrayscale)
c.drawBitmap(this,0f,Constants.grayPaint)
return bmpGrayscale
}
有一个 spring eureka 服务。配置yml文件如下:
192.168.3.8:8090
网关服务配置如下(服务器IP:192.168.3.7):
server:
port: 8090
spring:
application:
name: eureka-server
eureka:
client:
healthcheck:
enabled: true
registerWithEureka: false
fetchRegistry: false
service-url:
defaultZone: http://192.168.3.8:8090/eureka
我的应用服务正在 server:
port: 80
spring:
application:
name: gateway-service
cloud:
gateway:
discovery.locator:
enabled: true
lower-case-service-id: true
eureka:
instance:
prefer-ip-address: true
client:
service-url:
defaultZone: http://192.168.3.8:8090/eureka
management:
endpoint:
gateway:
enabled: true
service-registry:
enabled: true
endpoints:
web:
exposure:
include: gateway
运行。配置如下:
http://192.168.1.115:8090/Geoportal-Service-1.4.1
application:
name: geoportal-service
server:
port: 8090
eureka:
client:
service-url:
defaultZone: http://192.168.3.8:8090/eureka
instance:
hostname: 192.168.1.115
non-secure-port: ${server.port}
prefer-ip-address: true
spring:
cloud:
config:
discovery:
enabled: true
的路由示例是 Geoportal-Service-1.4.1
。现在我可以从地址 http://192.168.1115:8090/Geoportal-Service-1.4.1/info
的网关访问此路由,但我想通过地址 http://192.168.3.7/geoportal-service/Geoportal-Service-1.4.1/info
访问它。
如何修复此配置?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)